# laptop-iq/copycode architecture

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

- Interactive diagram: https://gitdiagram.com/laptop-iq/copycode
- Repository: https://github.com/laptop-iq/copycode

## Overview

This repository presents an Expense Tracker-branded web application whose visible core is a command-group library, alongside account access and contact-email features. The principal supported workflow is a user opening the routed frontend and reaching the command library; backend command routes expose group listing and authenticated management handlers backed by MongoDB. Account controllers implement registration, OTP verification, login, password reset, and profile management. The excerpts do not establish most frontend-to-API calls, so those links are omitted; dashed edges mark integrations whose wiring was not shown.

Main entry points: [`frontend/src/App.jsx`](https://github.com/laptop-iq/copycode/blob/main/frontend/src/App.jsx) (Routes and session), [`backend/controllers/userController.js`](https://github.com/laptop-iq/copycode/blob/main/backend/controllers/userController.js) (Account operations), [`backend/server.js`](https://github.com/laptop-iq/copycode/blob/main/backend/server.js) (HTTP API server), [`backend/routes/commandRoutes.js`](https://github.com/laptop-iq/copycode/blob/main/backend/routes/commandRoutes.js) (Command routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Routes and session<br/>[App.jsx]"]
  node_authui["Account screens"]
  node_libraryui["Command library UI<br/>[CommandLibrary.jsx]"]
  node_layout["Signed-in layout<br/>[Layout.jsx]"]
  node_sidebar["Sidebar navigation<br/>[Sidebar.jsx]"]
end

subgraph group_identity["Account and identity"]
  node_useroutes["User routes<br/>[userRoute.js]"]
  node_usercontroller["Account operations<br/>[userController.js]"]
  node_users[("User records<br/>[userModel.js]")]
  node_otp["OTP mail delivery<br/>[sendOtpMail.js]"]
  node_verifyotp["Verification mail<br/>[verifyOtpMail.js]"]
end

subgraph group_commands["Command library"]
  node_commandroutes["Command routes<br/>[commandRoutes.js]"]
  node_commandcontroller["Group operations"]
  node_commandstore[("Command groups")]
end

subgraph group_services["Backend services"]
  node_api["HTTP API server<br/>[server.js]"]
  node_cloudinary["Cloudinary"]
  node_authguard["Command auth guard<br/>[authMiddleware.js]"]
  node_contact["Contact email handler<br/>[contactRoutes.js]"]
  node_email["Email service"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"renders"| node_libraryui
node_app -->|"wraps"| node_layout
node_layout -->|"renders"| node_sidebar
node_app -->|"validates session"| node_api
node_api -->|"mounts"| node_useroutes
node_useroutes -->|"dispatches"| node_usercontroller
node_usercontroller -->|"reads and writes"| node_users
node_usercontroller -->|"sends reset OTP"| node_otp
node_usercontroller -->|"sends verification OTP"| node_verifyotp
node_usercontroller -->|"uploads profile image"| node_cloudinary
node_api -->|"mounts"| node_commandroutes
node_commandroutes -->|"dispatches"| node_commandcontroller
node_commandroutes -->|"guards mutations"| node_authguard
node_commandcontroller -->|"reads and writes"| node_commandstore
node_api -->|"mounts"| node_contact
node_contact -->|"sends contact emails"| node_email

click node_app "https://github.com/laptop-iq/copycode/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/laptop-iq/copycode/tree/main/frontend/src/Context"
click node_libraryui "https://github.com/laptop-iq/copycode/blob/main/frontend/src/components/CommandLibrary.jsx"
click node_layout "https://github.com/laptop-iq/copycode/blob/main/frontend/src/components/Layout.jsx"
click node_sidebar "https://github.com/laptop-iq/copycode/blob/main/frontend/src/components/Sidebar.jsx"
click node_api "https://github.com/laptop-iq/copycode/blob/main/backend/server.js"
click node_useroutes "https://github.com/laptop-iq/copycode/blob/main/backend/routes/userRoute.js"
click node_usercontroller "https://github.com/laptop-iq/copycode/blob/main/backend/controllers/userController.js"
click node_users "https://github.com/laptop-iq/copycode/blob/main/backend/models/userModel.js"
click node_otp "https://github.com/laptop-iq/copycode/blob/main/backend/emailVerify/sendOtpMail.js"
click node_verifyotp "https://github.com/laptop-iq/copycode/blob/main/backend/emailVerify/verifyOtpMail.js"
click node_commandroutes "https://github.com/laptop-iq/copycode/blob/main/backend/routes/commandRoutes.js"
click node_commandcontroller "https://github.com/laptop-iq/copycode/blob/main/backend/controllers/commandController.js"
click node_commandstore "https://github.com/laptop-iq/copycode/blob/main/backend/models/commandGroupModel.js"
click node_authguard "https://github.com/laptop-iq/copycode/blob/main/backend/middleware/authMiddleware.js"
click node_contact "https://github.com/laptop-iq/copycode/blob/main/backend/routes/contactRoutes.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_authui,node_libraryui,node_layout,node_sidebar,node_user toneBlue
class node_useroutes,node_usercontroller,node_users,node_otp,node_verifyotp toneAmber
class node_commandroutes,node_commandcontroller,node_commandstore toneMint
class node_api,node_cloudinary,node_authguard,node_contact,node_email toneRose
```

## Components

### Web application

- [Routes and session](https://github.com/laptop-iq/copycode/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Account screens](https://github.com/laptop-iq/copycode/tree/main/frontend/src/Context): `frontend/src/Context`
- [Command library UI](https://github.com/laptop-iq/copycode/blob/main/frontend/src/components/CommandLibrary.jsx): `frontend/src/components/CommandLibrary.jsx`
- [Signed-in layout](https://github.com/laptop-iq/copycode/blob/main/frontend/src/components/Layout.jsx): `frontend/src/components/Layout.jsx`
- [Sidebar navigation](https://github.com/laptop-iq/copycode/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`

### Account and identity

- [User routes](https://github.com/laptop-iq/copycode/blob/main/backend/routes/userRoute.js): `backend/routes/userRoute.js`
- [Account operations](https://github.com/laptop-iq/copycode/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [User records](https://github.com/laptop-iq/copycode/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [OTP mail delivery](https://github.com/laptop-iq/copycode/blob/main/backend/emailVerify/sendOtpMail.js): `backend/emailVerify/sendOtpMail.js`
- [Verification mail](https://github.com/laptop-iq/copycode/blob/main/backend/emailVerify/verifyOtpMail.js): `backend/emailVerify/verifyOtpMail.js`

### Command library

- [Command routes](https://github.com/laptop-iq/copycode/blob/main/backend/routes/commandRoutes.js): `backend/routes/commandRoutes.js`
- [Group operations](https://github.com/laptop-iq/copycode/blob/main/backend/controllers/commandController.js): `backend/controllers/commandController.js`
- [Command groups](https://github.com/laptop-iq/copycode/blob/main/backend/models/commandGroupModel.js): `backend/models/commandGroupModel.js`

### Backend services

- [HTTP API server](https://github.com/laptop-iq/copycode/blob/main/backend/server.js): `backend/server.js`
- **Cloudinary**
- [Command auth guard](https://github.com/laptop-iq/copycode/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Contact email handler](https://github.com/laptop-iq/copycode/blob/main/backend/routes/contactRoutes.js): `backend/routes/contactRoutes.js`
- **Email service**

### Other components

- **User**

## Connections

- User → Routes and session: uses (evidence: `frontend/src/App.jsx`)
- Routes and session → Account screens: routes to (evidence: `frontend/src/App.jsx`)
- Routes and session → Command library UI: renders (evidence: `frontend/src/App.jsx`)
- Routes and session → Signed-in layout: wraps (evidence: `frontend/src/App.jsx`)
- Signed-in layout → Sidebar navigation: renders (evidence: `frontend/src/components/Layout.jsx`)
- Routes and session → HTTP API server: validates session (evidence: `frontend/src/App.jsx`)
- HTTP API server → User routes: mounts (evidence: `backend/server.js`)
- User routes → Account operations: dispatches (evidence: `backend/routes/userRoute.js`)
- Account operations → User records: reads and writes (evidence: `backend/controllers/userController.js`)
- Account operations → OTP mail delivery: sends reset OTP (evidence: `backend/controllers/userController.js`)
- Account operations → Verification mail: sends verification OTP (evidence: `backend/controllers/userController.js`)
- Account operations → Cloudinary: uploads profile image (evidence: `backend/controllers/userController.js`)
- HTTP API server → Command routes: mounts (evidence: `backend/server.js`)
- Command routes → Group operations: dispatches (evidence: `backend/routes/commandRoutes.js`)
- Command routes → Command auth guard: guards mutations (evidence: `backend/routes/commandRoutes.js`)
- Group operations → Command groups: reads and writes (evidence: `backend/controllers/commandController.js`)
- HTTP API server → Contact email handler: mounts (evidence: `backend/server.js`)
- Contact email handler → Email service: sends contact emails (evidence: `backend/routes/contactRoutes.js`)
