# rupesh155/ai_project architecture

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

- Interactive diagram: https://gitdiagram.com/rupesh155/ai_project
- Repository: https://github.com/rupesh155/ai_project

## Overview

This repository implements an interview-management web app with email/password and Google sign-in, plus an authenticated interview-creation API. The visible workflow is browser login or signup → Express authentication routes → MongoDB-backed users; interview creation separately verifies a JWT, then stores interview parameters. The UI also exposes a Google-login component, though its implementation was not excerpted. The interview routes excerpt shows creation only; listing, detail, and deletion appear only in commented-out code, so they are not represented as active capabilities.

Main entry points: [`server/app.js`](https://github.com/rupesh155/ai_project/blob/main/server/app.js) (Express app), [`react/my-react-app/src/App.jsx`](https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/App.jsx) (Login/signup switch), [`server/models/User.js`](https://github.com/rupesh155/ai_project/blob/main/server/models/User.js) (User model), [`server/routes/authRoutes.js`](https://github.com/rupesh155/ai_project/blob/main/server/routes/authRoutes.js) (Google auth handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_entry["React entry<br/>[main.jsx]"]
  node_app["Login/signup switch<br/>[App.jsx]"]
  node_login["Email login<br/>[Login.jsx]"]
  node_signup["Account signup<br/>[Signup.jsx]"]
  node_googlebutton["Google login button"]
end

subgraph group_auth["Authentication API"]
  node_server["Express app<br/>[app.js]"]
  node_loginroute["Login handler<br/>[loginRoutes.js]"]
  node_signuproute["Signup handler<br/>[signupRoutes.js]"]
  node_googleroute["Google auth handler<br/>[authRoutes.js]"]
  node_authcheck["JWT middleware<br/>[auth.js]"]
  node_user["User model<br/>[User.js]"]
end

subgraph group_interviews["Interview API"]
  node_interviewroute["Interview creation<br/>[interview.js]"]
  node_interviewmodel["Interview model<br/>[Interview.js]"]
end

node_visitor(("User"))
node_google{{"Google identity service"}}
node_mongo[("MongoDB")]

node_visitor -.->|"uses"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"renders"| node_login
node_app -->|"renders"| node_signup
node_app -->|"renders"| node_googlebutton
node_login -->|"POSTs login"| node_loginroute
node_signup -->|"POSTs signup"| node_signuproute
node_server -->|"mounts"| node_googleroute
node_server -->|"mounts"| node_loginroute
node_server -->|"mounts"| node_signuproute
node_server -->|"mounts"| node_interviewroute
node_server -->|"connects"| node_mongo
node_loginroute -->|"finds user"| node_user
node_signuproute -->|"creates user"| node_user
node_googleroute -->|"finds or creates"| node_user
node_googleroute -->|"verifies credential"| node_google
node_authcheck -->|"loads user"| node_user
node_interviewroute -->|"uses middleware"| node_authcheck
node_interviewroute -->|"creates record"| node_interviewmodel

click node_entry "https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/main.jsx"
click node_app "https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/App.jsx"
click node_login "https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/Login.jsx"
click node_signup "https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/Signup.jsx"
click node_googlebutton "https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/GoogleLoginButton.jsx"
click node_server "https://github.com/rupesh155/ai_project/blob/main/server/app.js"
click node_loginroute "https://github.com/rupesh155/ai_project/blob/main/server/routes/loginRoutes.js"
click node_signuproute "https://github.com/rupesh155/ai_project/blob/main/server/routes/signupRoutes.js"
click node_googleroute "https://github.com/rupesh155/ai_project/blob/main/server/routes/authRoutes.js"
click node_authcheck "https://github.com/rupesh155/ai_project/blob/main/server/authCheck/auth.js"
click node_user "https://github.com/rupesh155/ai_project/blob/main/server/models/User.js"
click node_interviewroute "https://github.com/rupesh155/ai_project/blob/main/server/routes/interview.js"
click node_interviewmodel "https://github.com/rupesh155/ai_project/blob/main/server/models/Interview.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_entry,node_app,node_login,node_signup,node_googlebutton,node_visitor toneBlue
class node_server,node_loginroute,node_signuproute,node_googleroute,node_authcheck,node_user,node_mongo toneAmber
class node_interviewroute,node_interviewmodel toneMint
class node_google toneIndigo
```

## Components

### React client

- [React entry](https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/main.jsx): `react/my-react-app/src/main.jsx`
- [Login/signup switch](https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/App.jsx): `react/my-react-app/src/App.jsx`
- [Email login](https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/Login.jsx): `react/my-react-app/src/Login.jsx`
- [Account signup](https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/Signup.jsx): `react/my-react-app/src/Signup.jsx`
- [Google login button](https://github.com/rupesh155/ai_project/blob/main/react/my-react-app/src/GoogleLoginButton.jsx): `react/my-react-app/src/GoogleLoginButton.jsx`

### Authentication API

- [Express app](https://github.com/rupesh155/ai_project/blob/main/server/app.js): `server/app.js`
- [Login handler](https://github.com/rupesh155/ai_project/blob/main/server/routes/loginRoutes.js): `server/routes/loginRoutes.js`
- [Signup handler](https://github.com/rupesh155/ai_project/blob/main/server/routes/signupRoutes.js): `server/routes/signupRoutes.js`
- [Google auth handler](https://github.com/rupesh155/ai_project/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [JWT middleware](https://github.com/rupesh155/ai_project/blob/main/server/authCheck/auth.js): `server/authCheck/auth.js`
- [User model](https://github.com/rupesh155/ai_project/blob/main/server/models/User.js): `server/models/User.js`

### Interview API

- [Interview creation](https://github.com/rupesh155/ai_project/blob/main/server/routes/interview.js): `server/routes/interview.js`
- [Interview model](https://github.com/rupesh155/ai_project/blob/main/server/models/Interview.js): `server/models/Interview.js`

### Other components

- **User**
- **Google identity service**
- **MongoDB**

## Connections

- User → React entry: uses
- React entry → Login/signup switch: renders (evidence: `react/my-react-app/src/main.jsx`)
- Login/signup switch → Email login: renders (evidence: `react/my-react-app/src/App.jsx`)
- Login/signup switch → Account signup: renders (evidence: `react/my-react-app/src/App.jsx`)
- Login/signup switch → Google login button: renders (evidence: `react/my-react-app/src/App.jsx`)
- Email login → Login handler: POSTs login (evidence: `react/my-react-app/src/Login.jsx`)
- Account signup → Signup handler: POSTs signup (evidence: `react/my-react-app/src/Signup.jsx`)
- Express app → Google auth handler: mounts (evidence: `server/app.js`)
- Express app → Login handler: mounts (evidence: `server/app.js`)
- Express app → Signup handler: mounts (evidence: `server/app.js`)
- Express app → Interview creation: mounts (evidence: `server/app.js`)
- Express app → MongoDB: connects (evidence: `server/app.js`)
- Login handler → User model: finds user (evidence: `server/routes/loginRoutes.js`)
- Signup handler → User model: creates user (evidence: `server/routes/signupRoutes.js`)
- Google auth handler → User model: finds or creates (evidence: `server/routes/authRoutes.js`)
- Google auth handler → Google identity service: verifies credential (evidence: `server/routes/authRoutes.js`)
- JWT middleware → User model: loads user (evidence: `server/authCheck/auth.js`)
- Interview creation → JWT middleware: uses middleware (evidence: `server/routes/interview.js`)
- Interview creation → Interview model: creates record (evidence: `server/routes/interview.js`)
