# sakshiyadav78876/-secure-task-manager architecture

> Architecture diagram of the GitHub repository sakshiyadav78876/-secure-task-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sakshiyadav78876/-secure-task-manager
- Repository: https://github.com/sakshiyadav78876/-secure-task-manager

## Overview

1. **Overall shape**
   - This is a two-tier full-stack app: a **React/Vite frontend** in `frontend/` and a **Node.js/Express backend** at the repository root.
   - The frontend and backend are separated cleanly, with the backend exposing REST endpoints and the frontend consuming them over HTTP.

2. **Backend entrypoint and runtime**
   - `server.js` is the backend bootstrap for the Express app.
   - The backend is responsible for request handling, authentication, task CRUD, and connecting to the database through `config/db.js`.

3. **Persistence layer**
   - Data is modeled with Mongoose-style models in `models/User.js` and `models/Task.js`.
   - The README says persistence is in **MongoDB Atlas**, so the core data store is cloud-hosted MongoDB rather than an embedded or SQL database.

4. **Domain boundaries**
   - The repository centers on two main domain objects:
     - **Users**: account creation, login, password recovery, verification.
     - **Tasks**: user-owned task records with create/read/update/delete behavior.
   - The important architectural boundary is that task data is scoped per user, not global.

5. **Authentication and authorization**
   - `routes/authRoutes.js` plus `middleware/authMiddleware.js` form the security boundary.
   - The README indicates **bcrypt** for password hashing and **JWT** for session/auth tokens.
   - The middleware likely protects task routes and ensures only authenticated users can access their own resources.

6. **Task management API**
   - `routes/taskRoutes.js` exposes the task-related REST API.
   - Tasks are stored in the database and accessed through the backend only, with authorization enforced before any user can read or mutate task records.

7. **Account recovery and email-driven flows**
   - The frontend includes `ForgotPassword`, `ResetPassword`, and `VerifyOTP` pages, which implies account recovery and verification flows are first-class parts of the architecture.
   - The README mentions **Resend** for email notifications, so email is part of the authentication/account lifecycle rather than just a side feature.

8. **Frontend application structure**
   - The frontend is a **React app built with Vite** (`frontend/vite.config.js`, `frontend/src/main.jsx`).
   - UI entry and routing are centered in `frontend/src/App.jsx`, with page-level screens under `frontend/src/pages/`.
   - This suggests a page-based client architecture rather than a heavily nested component system.

9. **Client-server integration**
   - `frontend/src/api/api.js` and `frontend/src/services/api.js` indicate a dedicated HTTP client layer, most likely wrapping Axios as noted in the README.
   - This layer is the key boundary between UI state and backend resources, handling request construction and probably token attachment.

10. **Primary user flows**
    - The common flow is: register or log in on the frontend, receive a JWT from the backend, then use that token for protected task operations.
    - Additional flows cover password recovery and OTP verification, which route through the auth subsystem and email delivery path.

11. **Admin/user-facing screens**
    - `AdminPanel.jsx` and `Dashboard.jsx` suggest a split between general task management and a more privileged or consolidated view.
    - Even without implementation details, these pages indicate the app has distinct post-login user experiences rather than a single generic task screen.

12. **Deployment and environment separation**
    - The README says the frontend is deployed on **Vercel** and the backend on **Render**.
    - `frontend/vercel.json` reinforces that the frontend is configured as a separately hosted deployment unit.
    - Sensitive configuration is expected to live in environment variables, especially for database, JWT, and email credentials.

13. **What an architecture diagram should emphasize**
    - Show three core runtime blocks: **React frontend**, **Express API**, and **MongoDB Atlas**.
    - Add the **auth middleware** as a control point between the API and protected resources.
    - Show the **email service (Resend)** as a side-channel supporting registration/recovery flows.
    - The key data flow is: UI actions → API client → Express routes → auth/middleware → models/database → response back to UI.

Main entry points: [`routes/authRoutes.js`](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/routes/authRoutes.js) (Auth routes), [`frontend/src/App.jsx`](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/App.jsx) (App routes), [`routes/taskRoutes.js`](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/routes/taskRoutes.js) (Task routes), [`server.js`](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/server.js) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_ui["React app<br/>React/Vite client<br/>[main.jsx]"]
  node_router["App routes<br/>Page router<br/>[App.jsx]"]
  node_api_client["API client<br/>HTTP client<br/>[api.js]"]
  node_services_api["Service API<br/>Service wrapper<br/>[api.js]"]
  node_login["Login<br/>Auth page<br/>[Login.jsx]"]
  node_register["Register<br/>Auth page<br/>[Register.jsx]"]
  node_forgot["Forgot password<br/>Recovery page<br/>[ForgotPassword.jsx]"]
  node_reset["Reset password<br/>Recovery page<br/>[ResetPassword.jsx]"]
  node_verify["Verify OTP<br/>Verification page<br/>[VerifyOTP.jsx]"]
  node_dashboard["Dashboard<br/>Task screen<br/>[Dashboard.jsx]"]
  node_admin["Admin panel<br/>Privileged screen<br/>[AdminPanel.jsx]"]
end

subgraph group_backend["Backend"]
  node_server["Express API<br/>Node/Express backend<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>REST routes<br/>[authRoutes.js]"]
  node_task_routes["Task routes<br/>REST routes<br/>[taskRoutes.js]"]
  node_auth_mw{{"Auth middleware<br/>Security boundary<br/>[authMiddleware.js]"}}
end

subgraph group_data["Data"]
  node_db["Database config<br/>Mongo connector<br/>[db.js]"]
  node_user_model["User model<br/>Mongoose model<br/>[User.js]"]
  node_task_model["Task model<br/>Mongoose model<br/>[Task.js]"]
  node_mongo[("MongoDB Atlas<br/>Cloud database")]
end

subgraph group_integrations["Integrations"]
  node_resend["Resend email<br/>Email service"]
end

node_ui -->|"renders"| node_router
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_register
node_router -->|"routes to"| node_forgot
node_router -->|"routes to"| node_reset
node_router -->|"routes to"| node_verify
node_router -->|"routes to"| node_dashboard
node_router -->|"routes to"| node_admin
node_ui -->|"calls"| node_api_client
node_api_client -->|"wraps"| node_services_api
node_services_api -->|"requests"| node_server
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_task_routes
node_auth_routes -->|"uses"| node_auth_mw
node_task_routes -->|"protects"| node_auth_mw
node_auth_routes -->|"reads/writes"| node_user_model
node_task_routes -->|"reads/writes"| node_task_model
node_auth_mw -.->|"verifies against"| node_db
node_db -->|"connects to"| node_mongo
node_user_model -->|"persists in"| node_mongo
node_task_model -->|"persists in"| node_mongo
node_auth_routes -->|"sends email"| node_resend
node_forgot -->|"submits to"| node_auth_routes
node_reset -->|"submits to"| node_auth_routes
node_verify -->|"submits to"| node_auth_routes
node_login -->|"submits to"| node_auth_routes
node_register -->|"submits to"| node_auth_routes
node_dashboard -->|"manages tasks"| node_task_routes
node_admin -.->|"oversees"| node_task_routes

click node_ui "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/main.jsx"
click node_router "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/api/api.js"
click node_services_api "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/services/api.js"
click node_login "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/Login.jsx"
click node_register "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/Register.jsx"
click node_forgot "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/ForgotPassword.jsx"
click node_reset "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/ResetPassword.jsx"
click node_verify "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/VerifyOTP.jsx"
click node_dashboard "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/Dashboard.jsx"
click node_admin "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/AdminPanel.jsx"
click node_server "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/server.js"
click node_auth_routes "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/routes/authRoutes.js"
click node_task_routes "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/routes/taskRoutes.js"
click node_auth_mw "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/middleware/authMiddleware.js"
click node_db "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/config/db.js"
click node_user_model "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/models/User.js"
click node_task_model "https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/models/Task.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_ui,node_router,node_api_client,node_services_api,node_login,node_register,node_forgot,node_reset,node_verify,node_dashboard,node_admin toneBlue
class node_server,node_auth_routes,node_task_routes,node_auth_mw toneAmber
class node_db,node_user_model,node_task_model,node_mongo toneMint
class node_resend toneRose
```

## Components

### Frontend

React/Vite client and its page flow

- [React app](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/main.jsx): React/Vite client · Browser frontend entry and app shell · `frontend/src/main.jsx`
- [App routes](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/App.jsx): Page router · Top-level client routing and layout · `frontend/src/App.jsx`
- [API client](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/api/api.js): HTTP client · Shared browser-side request wrapper · `frontend/src/api/api.js`
- [Service API](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/services/api.js): Service wrapper · Higher-level frontend API helper · `frontend/src/services/api.js`
- [Login](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/Login.jsx): Auth page · User sign-in screen · `frontend/src/pages/Login.jsx`
- [Register](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/Register.jsx): Auth page · Account creation screen · `frontend/src/pages/Register.jsx`
- [Forgot password](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/ForgotPassword.jsx): Recovery page · Starts password reset flow · `frontend/src/pages/ForgotPassword.jsx`
- [Reset password](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/ResetPassword.jsx): Recovery page · Completes password reset flow · `frontend/src/pages/ResetPassword.jsx`
- [Verify OTP](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/VerifyOTP.jsx): Verification page · OTP confirmation screen · `frontend/src/pages/VerifyOTP.jsx`
- [Dashboard](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/Dashboard.jsx): Task screen · Primary post-login task view · `frontend/src/pages/Dashboard.jsx`
- [Admin panel](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/frontend/src/pages/AdminPanel.jsx): Privileged screen · Higher-privilege management view · `frontend/src/pages/AdminPanel.jsx`

### Backend

Express API, security, and persistence

- [Express API](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/server.js): Node/Express backend · Backend bootstrap and HTTP server · `server.js`
- [Auth routes](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/routes/authRoutes.js): REST routes · Registration, login, reset, verification endpoints · `routes/authRoutes.js`
- [Task routes](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/routes/taskRoutes.js): REST routes · Task CRUD endpoints · `routes/taskRoutes.js`
- [Auth middleware](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/middleware/authMiddleware.js): Security boundary · JWT-protected request guard · `middleware/authMiddleware.js`

### Data

Primary domain models and database connection

- [Database config](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/config/db.js): Mongo connector · MongoDB Atlas connection setup · `config/db.js`
- [User model](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/models/User.js): Mongoose model · Account and credential data · `models/User.js`
- [Task model](https://github.com/sakshiyadav78876/-secure-task-manager/blob/main/models/Task.js): Mongoose model · User-owned task records · `models/Task.js`
- **MongoDB Atlas**: Cloud database · Primary persistent datastore

### Integrations

External services used by auth and recovery flows

- **Resend email**: Email service · OTP and account recovery delivery

## Connections

- React app → App routes: renders · Frontend entry mounts the app router
- App routes → Login: routes to · Public auth screen
- App routes → Register: routes to · Account creation screen
- App routes → Forgot password: routes to · Recovery start screen
- App routes → Reset password: routes to · Password reset screen
- App routes → Verify OTP: routes to · OTP verification screen
- App routes → Dashboard: routes to · Main task workspace
- App routes → Admin panel: routes to · Privileged management view
- React app → API client: calls · Browser UI talks to backend through HTTP client
- API client → Service API: wraps · Shared request layer feeds higher-level services
- Service API → Express API: requests · Client calls the Express API
- Express API → Auth routes: mounts · Auth endpoints are registered on the server
- Express API → Task routes: mounts · Task endpoints are registered on the server
- Auth routes → Auth middleware: uses · Protected auth flows pass through security checks
- Task routes → Auth middleware: protects · Task access is gated by authentication
- Auth routes → User model: reads/writes · Account lifecycle uses the user collection
- Task routes → Task model: reads/writes · Task CRUD uses the task collection
- Auth middleware → Database config: verifies against · Middleware relies on backend state and DB-backed identity
- Database config → MongoDB Atlas: connects to · MongoDB Atlas connection target
- User model → MongoDB Atlas: persists in · User documents are stored in MongoDB
- Task model → MongoDB Atlas: persists in · Task documents are stored in MongoDB
- Auth routes → Resend email: sends email · Verification and recovery emails
- Forgot password → Auth routes: submits to · Starts recovery workflow
- Reset password → Auth routes: submits to · Completes recovery workflow
- Verify OTP → Auth routes: submits to · Completes OTP verification
- Login → Auth routes: submits to · Authenticates user credentials
- Register → Auth routes: submits to · Creates new account
- Dashboard → Task routes: manages tasks · Authenticated task CRUD
- Admin panel → Task routes: oversees · Privileged access to task data
