# subhamdey1234/ai_assistant architecture

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

- Interactive diagram: https://gitdiagram.com/subhamdey1234/ai_assistant
- Repository: https://github.com/subhamdey1234/ai_assistant

## Overview

This is a virtual-assistant web app with account flows and a broader social layer in the backend. Users sign in, configure an assistant, then speak commands; the browser sends recognized text through shared client state to the API, which classifies the intent and returns a response for browser-side actions or speech. The backend also contains profile, post, comment, and admin domains. The tree and sampled controllers show their models and operations, but excerpts do not establish all route-to-controller wiring, so those links are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/App.jsx) (App routing), [`frontend/src/context/Context.jsx`](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/context/Context.jsx) (Client context), [`backend/controllers/UserController.js`](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/UserController.js) (User operations), [`backend/server.js`](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/server.js) (Express server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routing<br/>[App.jsx]"]
  node_context["Client context<br/>[Context.jsx]"]
  node_home["Assistant home<br/>[Home.jsx]"]
  node_authpages["Login and signup<br/>[Login.jsx]"]
  node_customize["Assistant setup<br/>[Customize.jsx]"]
  node_customize2["Assistant setup 2<br/>[Customize2.jsx]"]
end

subgraph group_api["API and assistant"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[Userroute.js]"]
  node_profileroutes["User routes"]
  node_usercontroller["User operations<br/>[UserController.js]"]
  node_jwt["JWT verification<br/>[jwt.js]"]
  node_is_auth["Auth middleware<br/>[isAuth.js]"]
  node_gemini_code["Intent classification<br/>[gemini.js]"]
end

subgraph group_social["Social features"]
  node_post_controller["Post operations<br/>[PostController.js]"]
  node_comment_controller["Comment operations"]
  node_profile_controller["Profile operations"]
  node_admin_controller["Admin operations<br/>[AdminController.js]"]
end

subgraph group_state["Persistence and integrations"]
  node_user_model[("User records<br/>[User.js]")]
  node_post_model[("Post records<br/>[Post.js]")]
  node_comment_model[("Comment records<br/>[Comment.js]")]
  node_profile_model[("Profile records<br/>[Profile.js]")]
  node_admin_model[("Admin records<br/>[Admin.js]")]
  node_db["Database connection<br/>[dbconnect.js]"]
end

node_user(("User"))
node_browser{{"Browser speech and actions"}}
node_gemini_service{{"Gemini service"}}
node_cloudinary{{"Cloudinary upload"}}

node_user -->|"uses"| node_app
node_app -->|"provides state"| node_context
node_app -->|"routes"| node_authpages
node_app -->|"routes"| node_home
node_app -->|"routes"| node_customize
node_app -->|"routes"| node_customize2
node_authpages -->|"authenticates via"| node_context
node_customize -->|"uses"| node_context
node_customize2 -->|"uses"| node_context
node_home -->|"requests assistant"| node_context
node_home -->|"uses speech and actions"| node_browser
node_context -->|"HTTP requests"| node_server
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_profileroutes
node_server -->|"connects"| node_db
node_server -->|"invokes"| node_gemini_code
node_authroutes -->|"uses"| node_is_auth
node_profileroutes -->|"uses"| node_is_auth
node_is_auth -->|"verifies token"| node_jwt
node_usercontroller -->|"verifies token"| node_jwt
node_usercontroller -->|"reads and writes"| node_user_model
node_usercontroller -->|"uses"| node_profile_model
node_usercontroller -->|"classifies command"| node_gemini_code
node_usercontroller -.->|"uploads image"| node_cloudinary
node_gemini_code -.->|"requests intent"| node_gemini_service
node_post_controller -->|"reads and writes"| node_post_model
node_post_controller -->|"deletes related"| node_comment_model
node_comment_controller -->|"reads and writes"| node_comment_model
node_comment_controller -->|"checks post"| node_post_model
node_profile_controller -->|"reads and writes"| node_profile_model
node_admin_controller -->|"manages users"| node_user_model
node_admin_controller -->|"deletes profile"| node_profile_model
node_admin_controller -->|"manages posts"| node_post_model

click node_app "https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/App.jsx"
click node_context "https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/context/Context.jsx"
click node_home "https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Home.jsx"
click node_authpages "https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Login.jsx"
click node_customize "https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Customize.jsx"
click node_customize2 "https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Customize2.jsx"
click node_server "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/server.js"
click node_authroutes "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/Routes/Userroute.js"
click node_profileroutes "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/Routes/Userprofileroute.js"
click node_usercontroller "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/UserController.js"
click node_jwt "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/config/jwt.js"
click node_is_auth "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/Middleware/isAuth.js"
click node_gemini_code "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/gemini.js"
click node_post_controller "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/PostController.js"
click node_comment_controller "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/CommentController.js"
click node_profile_controller "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/ProfileController.js"
click node_admin_controller "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/AdminController.js"
click node_user_model "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/User.js"
click node_post_model "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Post.js"
click node_comment_model "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Comment.js"
click node_profile_model "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Profile.js"
click node_admin_model "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Admin.js"
click node_db "https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/config/dbconnect.js"

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_context,node_home,node_authpages,node_customize,node_customize2,node_user,node_browser toneBlue
class node_server,node_authroutes,node_profileroutes,node_usercontroller,node_jwt,node_is_auth,node_gemini_code toneAmber
class node_post_controller,node_comment_controller,node_profile_controller,node_admin_controller toneMint
class node_user_model,node_post_model,node_comment_model,node_profile_model,node_admin_model,node_db toneRose
class node_gemini_service,node_cloudinary toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Client context](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/context/Context.jsx): `frontend/src/context/Context.jsx`
- [Assistant home](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Login and signup](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Assistant setup](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Customize.jsx): `frontend/src/pages/Customize.jsx`
- [Assistant setup 2](https://github.com/subhamdey1234/ai_assistant/blob/remote/frontend/src/pages/Customize2.jsx): `frontend/src/pages/Customize2.jsx`

### API and assistant

- [Express server](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/Routes/Userroute.js): `backend/Routes/Userroute.js`
- [User routes](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/Routes/Userprofileroute.js): `backend/Routes/Userprofileroute.js`
- [User operations](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/UserController.js): `backend/controllers/UserController.js`
- [JWT verification](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/config/jwt.js): `backend/config/jwt.js`
- [Auth middleware](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/Middleware/isAuth.js): `backend/Middleware/isAuth.js`
- [Intent classification](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/gemini.js): `backend/gemini.js`

### Social features

- [Post operations](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/PostController.js): `backend/controllers/PostController.js`
- [Comment operations](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/CommentController.js): `backend/controllers/CommentController.js`
- [Profile operations](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/ProfileController.js): `backend/controllers/ProfileController.js`
- [Admin operations](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/controllers/AdminController.js): `backend/controllers/AdminController.js`

### Persistence and integrations

- [User records](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/User.js): `backend/models/User.js`
- [Post records](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Post.js): `backend/models/Post.js`
- [Comment records](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Comment.js): `backend/models/Comment.js`
- [Profile records](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Profile.js): `backend/models/Profile.js`
- [Admin records](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/models/Admin.js): `backend/models/Admin.js`
- [Database connection](https://github.com/subhamdey1234/ai_assistant/blob/remote/backend/config/dbconnect.js): `backend/config/dbconnect.js`

### Other components

- **User**
- **Browser speech and actions**
- **Gemini service**
- **Cloudinary upload**

## Connections

- User → App routing: uses
- App routing → Client context: provides state
- App routing → Login and signup: routes
- App routing → Assistant home: routes
- App routing → Assistant setup: routes
- App routing → Assistant setup 2: routes
- Login and signup → Client context: authenticates via
- Assistant setup → Client context: uses
- Assistant setup 2 → Client context: uses
- Assistant home → Client context: requests assistant
- Assistant home → Browser speech and actions: uses speech and actions
- Client context → Express server: HTTP requests
- Express server → Auth routes: mounts
- Express server → User routes: mounts
- Express server → Database connection: connects
- Express server → Intent classification: invokes
- Auth routes → Auth middleware: uses
- User routes → Auth middleware: uses
- Auth middleware → JWT verification: verifies token
- User operations → JWT verification: verifies token
- User operations → User records: reads and writes
- User operations → Profile records: uses
- User operations → Intent classification: classifies command
- User operations → Cloudinary upload: uploads image
- Intent classification → Gemini service: requests intent
- Post operations → Post records: reads and writes
- Post operations → Comment records: deletes related
- Comment operations → Comment records: reads and writes
- Comment operations → Post records: checks post
- Profile operations → Profile records: reads and writes
- Admin operations → User records: manages users
- Admin operations → Profile records: deletes profile
- Admin operations → Post records: manages posts
