# ananya-hegde2001/codevault architecture

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

- Interactive diagram: https://gitdiagram.com/ananya-hegde2001/codevault
- Repository: https://github.com/ananya-hegde2001/codevault

## Overview

1. CodeVault- is split into two deployable surfaces: a React/Vite single-page frontend in `frontend-main` and an Express/Node backend in `backend-main`. The frontend is the presentation layer; the backend owns authentication, repository workflow, and data mutations.

2. The frontend is organized by user journey rather than by API domain. `src/components/auth` handles login/signup, `dashboard` is the landing workspace, and `src/components/user` contains repository-centric screens such as create repository, repository details, profile, and a heatmap view. `App.jsx`, `Routes.jsx`, `authContext.jsx`, and `themeContext.jsx` provide app-wide routing and state.

3. Authentication is a first-class boundary. The backend has `userController` plus `authMiddleware` and `authorizeMiddleware`, which suggests protected endpoints and role/ownership checks. On the frontend, auth state is likely lifted into `authContext` and used to gate routes and navigation.

4. The backend is organized as an API layer over feature controllers. Routes are separated into `main.router`, `repo.router`, `user.router`, and `issue.router`, which map to controllers for repo operations, commits, push/pull/revert flows, user actions, and issues. This separation is important for diagramming because it shows the app is domain-driven rather than monolithic.

5. Repository/version-control behavior is the core subsystem. Controllers like `init`, `add`, `commit`, `push`, `pull`, and `revert` indicate CodeVault implements a GitHub-like workflow, not just generic CRUD. These operations likely transform repository state, create commit records, and synchronize local snapshots with stored repository metadata.

6. The storage model appears to mix conventional app models with custom filesystem-backed artifacts. `models/` contains `userModel`, `repoModel`, and `issueModel`, while `.codeVault/commits` contains per-commit folders with `commit.json` and tracked files. That suggests a hybrid architecture: structured app data through models, plus versioned repository contents stored as on-disk artifacts.

7. The `.codeVault` directory is an important architectural boundary. It looks like an internal repository workspace/history store containing commit snapshots and configuration, separate from the normal source tree. For architecture purposes, treat it as the persistence layer for repository history and local workflow state.

8. Issue tracking is a secondary subsystem tied to repositories and users. `issueController` and `issueModel` imply CRUD-style issue management, likely linked to a repository and created from the repo detail or dashboard views. It is distinct from commit history but shares the same authentication and repository context.

9. There is an external integration seam for AWS. `config/aws-config.js` indicates the backend can be wired to cloud services, though the exact service is not visible here. Architecturally, this is a configurable integration point rather than the app’s core runtime.

10. The request flow is straightforward: user action in the React UI goes through routed components, hits Express endpoints, passes auth/authorization middleware, then reaches controllers. Controllers either read/write model data or manipulate `.codeVault` repository artifacts, and the response drives UI updates in the dashboard or repository detail screens.

11. A few files suggest supporting workflows rather than runtime features: `WORKFLOW_GUIDE.md` and root-level `commit.json`/`update.js` likely help with the project’s custom development or repository sync process. They are useful to note on a diagram as operational tooling, but they are not the main product path.

12. The cleanest architecture diagram should therefore show: frontend SPA → backend API → auth/authorization → repo/user/issue controllers → models and `.codeVault` storage, with AWS as an optional side integration and the issue subsystem attached to repository/user data.

Main entry points: [`frontend-main/src/Routes.jsx`](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/Routes.jsx) (Routes), [`backend-main/routes/main.router.js`](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/main.router.js) (Main routes), [`backend-main/controllers/commit.js`](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/controllers/commit.js) (Repo ops), [`frontend-main/src/App.jsx`](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/App.jsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend SPA"]
  node_frontend_app["App shell<br/>react shell<br/>[App.jsx]"]
  node_frontend_routes["Routes<br/>route map<br/>[Routes.jsx]"]
  node_frontend_auth_ctx(("Auth state<br/>context<br/>[authContext.jsx]"))
  node_frontend_theme_ctx(("Theme state<br/>context<br/>[themeContext.jsx]"))
  node_frontend_auth["Auth screens<br/>ui flow<br/>[Login.jsx]"]
  node_frontend_dashboard["Dashboard<br/>workspace view<br/>[Dashboard.jsx]"]
  node_frontend_user["Repo screens<br/>user journey"]
end

subgraph group_backend["Backend API"]
  node_backend_entry["API entry<br/>express app<br/>[index.js]"]
  node_backend_main_routes["Main routes<br/>router<br/>[main.router.js]"]
  node_backend_repo_routes["Repo routes<br/>router<br/>[repo.router.js]"]
  node_backend_user_routes["User routes<br/>router<br/>[user.router.js]"]
  node_backend_issue_routes["Issue routes<br/>router<br/>[issue.router.js]"]
  node_backend_auth{{"Auth guard<br/>middleware<br/>[authMiddleware.js]"}}
  node_backend_repo_ctrl["Repo ops<br/>controller<br/>[commit.js]"]
  node_backend_user_ctrl["User ctrl<br/>controller<br/>[userController.js]"]
  node_backend_issue_ctrl["Issue ctrl<br/>controller<br/>[issueController.js]"]
  node_integration_aws{{"AWS config<br/>integration<br/>[aws-config.js]"}}
end

subgraph group_storage["Persistence"]
  node_storage_models[("App models<br/>data models<br/>[repoModel.js]")]
  node_storage_codevault[(".codeVault<br/>repo store<br/>[.codeVault]")]
end

subgraph group_tooling["Operational Tools"]
  node_tooling_workflow["Workflow docs<br/>ops guide<br/>[WORKFLOW_GUIDE.md]"]
end

node_frontend_app -->|"uses"| node_frontend_routes
node_frontend_app -->|"shares"| node_frontend_auth_ctx
node_frontend_app -->|"shares"| node_frontend_theme_ctx
node_frontend_routes -->|"routes"| node_frontend_auth
node_frontend_routes -->|"routes"| node_frontend_dashboard
node_frontend_routes -->|"routes"| node_frontend_user
node_frontend_auth -->|"updates"| node_frontend_auth_ctx
node_frontend_dashboard -.->|"api calls"| node_backend_entry
node_frontend_user -.->|"api calls"| node_backend_entry
node_backend_entry -->|"mounts"| node_backend_main_routes
node_backend_main_routes -->|"delegates"| node_backend_repo_routes
node_backend_main_routes -->|"delegates"| node_backend_user_routes
node_backend_main_routes -->|"delegates"| node_backend_issue_routes
node_backend_repo_routes -->|"protected by"| node_backend_auth
node_backend_user_routes -->|"protected by"| node_backend_auth
node_backend_issue_routes -->|"protected by"| node_backend_auth
node_backend_repo_routes -->|"handled by"| node_backend_repo_ctrl
node_backend_user_routes -->|"handled by"| node_backend_user_ctrl
node_backend_issue_routes -->|"handled by"| node_backend_issue_ctrl
node_backend_repo_ctrl -->|"reads/writes"| node_storage_models
node_backend_user_ctrl -->|"reads/writes"| node_storage_models
node_backend_issue_ctrl -->|"reads/writes"| node_storage_models
node_backend_repo_ctrl -->|"manages"| node_storage_codevault
node_backend_repo_ctrl -.->|"optional"| node_integration_aws
node_tooling_workflow -.->|"describes"| node_storage_codevault

click node_frontend_app "https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/App.jsx"
click node_frontend_routes "https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/Routes.jsx"
click node_frontend_auth_ctx "https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/authContext.jsx"
click node_frontend_theme_ctx "https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/themeContext.jsx"
click node_frontend_auth "https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/components/auth/Login.jsx"
click node_frontend_dashboard "https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/components/dashboard/Dashboard.jsx"
click node_frontend_user "https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/components/user/RepositoryDetails.jsx"
click node_backend_entry "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/index.js"
click node_backend_main_routes "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/main.router.js"
click node_backend_repo_routes "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/repo.router.js"
click node_backend_user_routes "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/user.router.js"
click node_backend_issue_routes "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/issue.router.js"
click node_backend_auth "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/middleware/authMiddleware.js"
click node_backend_repo_ctrl "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/controllers/commit.js"
click node_backend_user_ctrl "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/controllers/userController.js"
click node_backend_issue_ctrl "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/controllers/issueController.js"
click node_storage_models "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/models/repoModel.js"
click node_storage_codevault "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/.codeVault"
click node_integration_aws "https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/config/aws-config.js"
click node_tooling_workflow "https://github.com/ananya-hegde2001/codevault/blob/main/WORKFLOW_GUIDE.md"

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_frontend_app,node_frontend_routes,node_frontend_auth_ctx,node_frontend_theme_ctx,node_frontend_auth,node_frontend_dashboard,node_frontend_user toneBlue
class node_backend_entry,node_backend_main_routes,node_backend_repo_routes,node_backend_user_routes,node_backend_issue_routes,node_backend_auth,node_backend_repo_ctrl,node_backend_user_ctrl,node_backend_issue_ctrl,node_integration_aws toneAmber
class node_storage_models,node_storage_codevault toneMint
class node_tooling_workflow toneRose
```

## Components

### Frontend SPA

React/Vite presentation layer and route/state orchestration.

- [App shell](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/App.jsx): react shell · Top-level SPA bootstrap, routing, and context wiring. · `frontend-main/src/App.jsx`
- [Routes](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/Routes.jsx): route map · Client-side route definitions for the main user journeys. · `frontend-main/src/Routes.jsx`
- [Auth state](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/authContext.jsx): context · Lifts authentication state for route gating and UI access. · `frontend-main/src/authContext.jsx`
- [Theme state](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/themeContext.jsx): context · Shared UI theme state across the SPA. · `frontend-main/src/themeContext.jsx`
- [Auth screens](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/components/auth/Login.jsx): ui flow · Login and signup journey. · `frontend-main/src/components/auth/Login.jsx`
- [Dashboard](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/components/dashboard/Dashboard.jsx): workspace view · Primary landing workspace after sign-in. · `frontend-main/src/components/dashboard/Dashboard.jsx`
- [Repo screens](https://github.com/ananya-hegde2001/codevault/blob/main/frontend-main/src/components/user/RepositoryDetails.jsx): user journey · Repository creation, details, profile, and heatmap views. · `frontend-main/src/components/user/RepositoryDetails.jsx`

### Backend API

Express/Node API, controllers, middleware, and data access.

- [API entry](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/index.js): express app · Server bootstrap and request entrypoint. · `backend-main/index.js`
- [Main routes](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/main.router.js): router · Top-level request routing for the API. · `backend-main/routes/main.router.js`
- [Repo routes](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/repo.router.js): router · Repository workflow endpoints. · `backend-main/routes/repo.router.js`
- [User routes](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/user.router.js): router · User and account endpoints. · `backend-main/routes/user.router.js`
- [Issue routes](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/routes/issue.router.js): router · Issue management endpoints. · `backend-main/routes/issue.router.js`
- [Auth guard](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/middleware/authMiddleware.js): middleware · Authentication and authorization checks for protected access. · `backend-main/middleware/authMiddleware.js`
- [Repo ops](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/controllers/commit.js): controller · Init, add, commit, push, pull, and revert workflow handling. · `backend-main/controllers/commit.js`
- [User ctrl](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/controllers/userController.js): controller · User account and profile actions. · `backend-main/controllers/userController.js`
- [Issue ctrl](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/controllers/issueController.js): controller · Repository-linked issue handling. · `backend-main/controllers/issueController.js`
- [AWS config](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/config/aws-config.js): integration · External cloud integration seam. · `backend-main/config/aws-config.js`

### Persistence

Structured models and repository-history artifacts.

- [App models](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/models/repoModel.js): data models · User, repository, and issue persistence models. · `backend-main/models/repoModel.js`
- [.codeVault](https://github.com/ananya-hegde2001/codevault/blob/main/backend-main/.codeVault): repo store · Filesystem-backed repository history, commits, and local workflow state. · `backend-main/.codeVault`

### Operational Tools

Supporting workflow and sync artifacts outside the main runtime.

- [Workflow docs](https://github.com/ananya-hegde2001/codevault/blob/main/WORKFLOW_GUIDE.md): ops guide · Supporting development and sync workflow guidance. · `WORKFLOW_GUIDE.md`

## Connections

- App shell → Routes: uses · App shell wires client routes.
- App shell → Auth state: shares · Global auth state is provided across the app.
- App shell → Theme state: shares · Global theme state is provided across the app.
- Routes → Auth screens: routes · Routes expose login and signup screens.
- Routes → Dashboard: routes · Routes expose the main workspace.
- Routes → Repo screens: routes · Routes expose repository-centric user screens.
- Auth screens → Auth state: updates · Auth screens feed sign-in state into context.
- Dashboard → API entry: api calls · Workspace actions call the backend API.
- Repo screens → API entry: api calls · Repository and profile screens call the backend API.
- API entry → Main routes: mounts · Server bootstraps the main router.
- Main routes → Repo routes: delegates · Main routing delegates repository endpoints.
- Main routes → User routes: delegates · Main routing delegates user endpoints.
- Main routes → Issue routes: delegates · Main routing delegates issue endpoints.
- Repo routes → Auth guard: protected by · Repository actions require authentication and authorization.
- User routes → Auth guard: protected by · User actions require auth checks.
- Issue routes → Auth guard: protected by · Issue actions require auth checks.
- Repo routes → Repo ops: handled by · Repository routes execute workflow controllers.
- User routes → User ctrl: handled by · User routes execute user controller logic.
- Issue routes → Issue ctrl: handled by · Issue routes execute issue controller logic.
- Repo ops → App models: reads/writes · Controllers persist structured repository data.
- User ctrl → App models: reads/writes · Controllers persist user data.
- Issue ctrl → App models: reads/writes · Controllers persist issue data.
- Repo ops → .codeVault: manages · Repository operations create and update commit artifacts.
- Repo ops → AWS config: optional · Backend can integrate with configured AWS services.
- Workflow docs → .codeVault: describes · Workflow docs explain the custom repository store.
