# sarthak-jangid/viscoai architecture

> Architecture diagram of the GitHub repository sarthak-jangid/viscoai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sarthak-jangid/viscoai
- Repository: https://github.com/sarthak-jangid/viscoai

## Overview

ViscoAI is a resume-analysis SaaS: users sign in, submit a resume with job context, receive AI-generated career feedback, and can purchase a subscription for premium access. The graph follows the evidenced frontend routing and API handlers, then shows authentication, analysis, payment, and user-state responsibilities. Several capabilities and integrations are documented in the README but their full implementation was not sampled; those links are marked as documented or unverified rather than inferred from module names.

Main entry points: [`server/src/controllers/user.controller.ts`](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/user.controller.ts) (User API), [`client/src/App.tsx`](https://github.com/sarthak-jangid/viscoai/blob/main/client/src/App.tsx) (React application), [`server/src/index.ts`](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/index.ts) (Express API server), [`server/src/controllers/ai.controller.ts`](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/ai.controller.ts) (Analysis API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["React application<br/>[App.tsx]"]
  node_resume_ui["Resume analyzer<br/>[Analyse.tsx]"]
  node_login_ui["Login page<br/>[Login.tsx]"]
  node_account_ui["Account page<br/>[Account.tsx]"]
  node_pricing_ui["Pricing plans<br/>[Pricing.tsx]"]
  node_client_state["Session state<br/>[AppContext.tsx]"]
end

subgraph group_identity["Identity and accounts"]
  node_user_api["User API<br/>[user.controller.ts]"]
  node_auth["Authentication guard"]
  node_google(("Google identity"))
end

subgraph group_analysis["Resume analysis"]
  node_analysis_api["Analysis API<br/>[ai.controller.ts]"]
  node_ai_service["AI analysis service"]
  node_prompt["Analysis prompt<br/>[prompt.ts]"]
  node_gemini(("Google Generative AI"))
end

subgraph group_billing["Subscriptions and payments"]
  node_payment_api["Payment API"]
  node_razorpay(("Razorpay"))
end

subgraph group_platform["API and persistence"]
  node_api_server["Express API server<br/>[index.ts]"]
  node_user_store[("User records<br/>[user.model.ts]")]
  node_database_connection[("MongoDB connection<br/>[db.config.ts]")]
end

node_visitor(("Website user"))

node_visitor -->|"uses"| node_app
node_app -->|"routes to"| node_resume_ui
node_app -->|"routes to"| node_login_ui
node_app -->|"routes to"| node_account_ui
node_app -->|"reads session"| node_client_state
node_resume_ui -->|"submits resume"| node_analysis_api
node_login_ui -.->|"signs in"| node_user_api
node_client_state -->|"loads profile"| node_user_api
node_client_state -->|"logs out"| node_user_api
node_user_api -->|"verifies identity"| node_google
node_user_api -->|"reads and writes"| node_user_store
node_auth -->|"loads account"| node_user_store
node_api_server -->|"mounts routes"| node_user_api
node_api_server -->|"mounts routes"| node_analysis_api
node_api_server -->|"mounts routes"| node_payment_api
node_analysis_api -->|"checks usage"| node_user_store
node_analysis_api -->|"requests analysis"| node_ai_service
node_ai_service -->|"uses prompt"| node_prompt
node_ai_service -.->|"requests generation"| node_gemini
node_payment_api -->|"updates subscription"| node_user_store
node_payment_api -->|"creates and verifies"| node_razorpay
node_pricing_ui -.->|"starts checkout"| node_payment_api
node_api_server -->|"connects to"| node_database_connection

click node_app "https://github.com/sarthak-jangid/viscoai/blob/main/client/src/App.tsx"
click node_resume_ui "https://github.com/sarthak-jangid/viscoai/blob/main/client/src/pages/Analyse.tsx"
click node_login_ui "https://github.com/sarthak-jangid/viscoai/blob/main/client/src/pages/Login.tsx"
click node_account_ui "https://github.com/sarthak-jangid/viscoai/blob/main/client/src/pages/Account.tsx"
click node_pricing_ui "https://github.com/sarthak-jangid/viscoai/blob/main/client/src/components/Pricing.tsx"
click node_client_state "https://github.com/sarthak-jangid/viscoai/blob/main/client/src/context/AppContext.tsx"
click node_user_api "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/user.controller.ts"
click node_auth "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/middlewares/isAuth.middleware.ts"
click node_analysis_api "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/ai.controller.ts"
click node_ai_service "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/services/aiServices.service.ts"
click node_prompt "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/config/prompt.ts"
click node_payment_api "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/payment.controller.ts"
click node_api_server "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/index.ts"
click node_user_store "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/models/user.model.ts"
click node_database_connection "https://github.com/sarthak-jangid/viscoai/blob/main/server/src/config/db.config.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_resume_ui,node_login_ui,node_account_ui,node_pricing_ui,node_client_state,node_visitor toneBlue
class node_user_api,node_auth,node_google toneAmber
class node_analysis_api,node_ai_service,node_prompt,node_gemini toneMint
class node_payment_api,node_razorpay toneRose
class node_api_server,node_user_store,node_database_connection toneIndigo
```

## Components

### Web application

- [React application](https://github.com/sarthak-jangid/viscoai/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Resume analyzer](https://github.com/sarthak-jangid/viscoai/blob/main/client/src/pages/Analyse.tsx): `client/src/pages/Analyse.tsx`
- [Login page](https://github.com/sarthak-jangid/viscoai/blob/main/client/src/pages/Login.tsx): `client/src/pages/Login.tsx`
- [Account page](https://github.com/sarthak-jangid/viscoai/blob/main/client/src/pages/Account.tsx): `client/src/pages/Account.tsx`
- [Pricing plans](https://github.com/sarthak-jangid/viscoai/blob/main/client/src/components/Pricing.tsx): `client/src/components/Pricing.tsx`
- [Session state](https://github.com/sarthak-jangid/viscoai/blob/main/client/src/context/AppContext.tsx): `client/src/context/AppContext.tsx`

### Identity and accounts

- [User API](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/user.controller.ts): `server/src/controllers/user.controller.ts`
- [Authentication guard](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/middlewares/isAuth.middleware.ts): `server/src/middlewares/isAuth.middleware.ts`
- **Google identity**

### Resume analysis

- [Analysis API](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/ai.controller.ts): `server/src/controllers/ai.controller.ts`
- [AI analysis service](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/services/aiServices.service.ts): `server/src/services/aiServices.service.ts`
- [Analysis prompt](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/config/prompt.ts): `server/src/config/prompt.ts`
- **Google Generative AI**

### Subscriptions and payments

- [Payment API](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/controllers/payment.controller.ts): `server/src/controllers/payment.controller.ts`
- **Razorpay**

### API and persistence

- [Express API server](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/index.ts): `server/src/index.ts`
- [User records](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/models/user.model.ts): `server/src/models/user.model.ts`
- [MongoDB connection](https://github.com/sarthak-jangid/viscoai/blob/main/server/src/config/db.config.ts): `server/src/config/db.config.ts`

### Other components

- **Website user**

## Connections

- Website user → React application: uses (evidence: `README.md`)
- React application → Resume analyzer: routes to (evidence: `client/src/App.tsx`)
- React application → Login page: routes to (evidence: `client/src/App.tsx`)
- React application → Account page: routes to (evidence: `client/src/App.tsx`)
- React application → Session state: reads session (evidence: `client/src/App.tsx`)
- Resume analyzer → Analysis API: submits resume (evidence: `client/src/pages/Analyse.tsx`)
- Login page → User API: signs in (evidence: `README.md`)
- Session state → User API: loads profile (evidence: `client/src/context/AppContext.tsx`)
- Session state → User API: logs out (evidence: `client/src/context/AppContext.tsx`)
- User API → Google identity: verifies identity (evidence: `server/src/controllers/user.controller.ts`)
- User API → User records: reads and writes (evidence: `server/src/controllers/user.controller.ts`)
- Authentication guard → User records: loads account (evidence: `server/src/middlewares/isAuth.middleware.ts`)
- Express API server → User API: mounts routes (evidence: `server/src/index.ts`)
- Express API server → Analysis API: mounts routes (evidence: `server/src/index.ts`)
- Express API server → Payment API: mounts routes (evidence: `server/src/index.ts`)
- Analysis API → User records: checks usage (evidence: `server/src/controllers/ai.controller.ts`)
- Analysis API → AI analysis service: requests analysis (evidence: `server/src/controllers/ai.controller.ts`)
- AI analysis service → Analysis prompt: uses prompt (evidence: `server/src/services/aiServices.service.ts`)
- AI analysis service → Google Generative AI: requests generation (evidence: `README.md`)
- Payment API → User records: updates subscription (evidence: `server/src/controllers/payment.controller.ts`)
- Payment API → Razorpay: creates and verifies (evidence: `server/src/controllers/payment.controller.ts`)
- Pricing plans → Payment API: starts checkout (evidence: `README.md`)
- Express API server → MongoDB connection: connects to (evidence: `server/src/index.ts`)
