# achintxv/code-diary architecture

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

- Interactive diagram: https://gitdiagram.com/achintxv/code-diary
- Repository: https://github.com/achintxv/code-diary

## Overview

Code Diary is a project and issue-tracking dashboard. Users authenticate, create or select projects, then manage issues and view status metrics through the dashboard; protected API routes validate sessions and project ownership before accessing MongoDB. The graph preserves the documented auth, project, issue, and status-normalization stages. Some route and UI wiring is represented only by the README or source index, so edges without direct excerpt evidence are limited to documented relationships.

Main entry points: [`src/lib/auth.js`](https://github.com/achintxv/code-diary/blob/master/src/lib/auth.js) (Session and tokens), [`src/lib/db.js`](https://github.com/achintxv/code-diary/blob/master/src/lib/db.js) (Database connection), [`src/components/dashboard/ProjectView.jsx`](https://github.com/achintxv/code-diary/blob/master/src/components/dashboard/ProjectView.jsx) (Project view), [`src/app/api/issue/route.js`](https://github.com/achintxv/code-diary/blob/master/src/app/api/issue/route.js) (Issue endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Dashboard UI"]
  node_login["Login page<br/>[page.jsx]"]
  node_register["Registration page<br/>[page.jsx]"]
  node_dashboard_entry["Dashboard entry<br/>[page.jsx]"]
  node_workspace["Project workspace<br/>[DashboardShell.jsx]"]
  node_project_view["Project view<br/>[ProjectView.jsx]"]
  node_issue_modal["Issue editor<br/>[IssueModal.jsx]"]
  node_issue_list["Issue list<br/>[IssueList.jsx]"]
  node_status_badge["Status badge<br/>[StatusBadge.jsx]"]
  node_status_normalizer["Status normalization<br/>[status.js]"]
end

subgraph group_api["API Routes"]
  node_auth_login["Login endpoint<br/>[route.js]"]
  node_auth_register["Registration endpoint<br/>[route.js]"]
  node_auth_me["Session endpoint<br/>[route.js]"]
  node_auth_logout["Logout endpoint<br/>[route.js]"]
  node_project_routes["Project endpoints<br/>[route.js]"]
  node_project_item_routes["Project detail endpoints<br/>[route.js]"]
  node_issue_routes["Issue endpoints<br/>[route.js]"]
  node_issue_item_routes["Issue detail endpoints<br/>[route.js]"]
end

subgraph group_identity["Identity"]
  node_auth["Session and tokens<br/>[auth.js]"]
end

subgraph group_data["Persistence"]
  node_db_connector["Database connection<br/>[db.js]"]
  node_user_model[("User records<br/>[user.js]")]
  node_project_model[("Project records<br/>[project.js]")]
  node_issue_model[("Issue records<br/>[issue.js]")]
end

node_user(("User"))
node_mongodb[("MongoDB")]

node_user -->|"signs in"| node_login
node_user -->|"registers"| node_register
node_user -->|"manages work"| node_dashboard_entry
node_login -.->|"submits credentials"| node_auth_login
node_register -.->|"creates account"| node_auth_register
node_dashboard_entry -->|"renders"| node_workspace
node_workspace -->|"renders selection"| node_project_view
node_project_view -->|"renders editor"| node_issue_modal
node_project_view -->|"renders issues"| node_issue_list
node_issue_list -->|"renders status"| node_status_badge
node_status_badge -->|"normalizes status"| node_status_normalizer
node_workspace -.->|"requests projects"| node_project_routes
node_project_view -.->|"requests issues"| node_issue_routes
node_project_view -.->|"updates issues"| node_issue_item_routes
node_auth_login -->|"creates token"| node_auth
node_auth_login -->|"connects"| node_db_connector
node_auth_login -->|"looks up user"| node_user_model
node_auth_register -->|"connects"| node_db_connector
node_auth_register -->|"creates user"| node_user_model
node_auth_me -->|"checks session"| node_auth
node_dashboard_entry -->|"checks session"| node_auth
node_auth -->|"connects"| node_db_connector
node_auth -->|"loads user"| node_user_model
node_project_routes -->|"validates session"| node_auth
node_project_routes -->|"connects"| node_db_connector
node_project_routes -->|"reads and writes"| node_project_model
node_project_item_routes -->|"validates session"| node_auth
node_project_item_routes -->|"connects"| node_db_connector
node_project_item_routes -->|"reads and writes"| node_project_model
node_project_item_routes -->|"deletes project issues"| node_issue_model
node_issue_routes -->|"validates session"| node_auth
node_issue_routes -->|"connects"| node_db_connector
node_issue_routes -->|"checks ownership"| node_project_model
node_issue_routes -->|"reads and creates"| node_issue_model
node_issue_item_routes -->|"validates session"| node_auth
node_issue_item_routes -->|"connects"| node_db_connector
node_issue_item_routes -->|"checks ownership"| node_project_model
node_issue_item_routes -->|"reads and mutates"| node_issue_model
node_db_connector -->|"connects"| node_mongodb

click node_login "https://github.com/achintxv/code-diary/blob/master/src/app/login/page.jsx"
click node_register "https://github.com/achintxv/code-diary/blob/master/src/app/register/page.jsx"
click node_dashboard_entry "https://github.com/achintxv/code-diary/blob/master/src/app/dashboard/page.jsx"
click node_workspace "https://github.com/achintxv/code-diary/blob/master/src/components/dashboard/DashboardShell.jsx"
click node_project_view "https://github.com/achintxv/code-diary/blob/master/src/components/dashboard/ProjectView.jsx"
click node_issue_modal "https://github.com/achintxv/code-diary/blob/master/src/components/IssueModal.jsx"
click node_issue_list "https://github.com/achintxv/code-diary/blob/master/src/components/IssueList.jsx"
click node_status_badge "https://github.com/achintxv/code-diary/blob/master/src/components/StatusBadge.jsx"
click node_status_normalizer "https://github.com/achintxv/code-diary/blob/master/src/utils/status.js"
click node_auth_login "https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/login/route.js"
click node_auth_register "https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/register/route.js"
click node_auth_me "https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/me/route.js"
click node_auth_logout "https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/logout/route.js"
click node_project_routes "https://github.com/achintxv/code-diary/blob/master/src/app/api/project/route.js"
click node_project_item_routes "https://github.com/achintxv/code-diary/blob/master/src/app/api/project/%5Bid%5D/route.js"
click node_issue_routes "https://github.com/achintxv/code-diary/blob/master/src/app/api/issue/route.js"
click node_issue_item_routes "https://github.com/achintxv/code-diary/blob/master/src/app/api/issue/%5Bid%5D/route.js"
click node_auth "https://github.com/achintxv/code-diary/blob/master/src/lib/auth.js"
click node_db_connector "https://github.com/achintxv/code-diary/blob/master/src/lib/db.js"
click node_user_model "https://github.com/achintxv/code-diary/blob/master/src/models/user.js"
click node_project_model "https://github.com/achintxv/code-diary/blob/master/src/models/project.js"
click node_issue_model "https://github.com/achintxv/code-diary/blob/master/src/models/issue.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_login,node_register,node_dashboard_entry,node_workspace,node_project_view,node_issue_modal,node_issue_list,node_status_badge,node_status_normalizer,node_user toneBlue
class node_auth_login,node_auth_register,node_auth_me,node_auth_logout,node_project_routes,node_project_item_routes,node_issue_routes,node_issue_item_routes,node_mongodb toneAmber
class node_auth toneMint
class node_db_connector,node_user_model,node_project_model,node_issue_model toneRose
```

## Components

### Dashboard UI

- [Login page](https://github.com/achintxv/code-diary/blob/master/src/app/login/page.jsx): `src/app/login/page.jsx`
- [Registration page](https://github.com/achintxv/code-diary/blob/master/src/app/register/page.jsx): `src/app/register/page.jsx`
- [Dashboard entry](https://github.com/achintxv/code-diary/blob/master/src/app/dashboard/page.jsx): `src/app/dashboard/page.jsx`
- [Project workspace](https://github.com/achintxv/code-diary/blob/master/src/components/dashboard/DashboardShell.jsx): `src/components/dashboard/DashboardShell.jsx`
- [Project view](https://github.com/achintxv/code-diary/blob/master/src/components/dashboard/ProjectView.jsx): `src/components/dashboard/ProjectView.jsx`
- [Issue editor](https://github.com/achintxv/code-diary/blob/master/src/components/IssueModal.jsx): `src/components/IssueModal.jsx`
- [Issue list](https://github.com/achintxv/code-diary/blob/master/src/components/IssueList.jsx): `src/components/IssueList.jsx`
- [Status badge](https://github.com/achintxv/code-diary/blob/master/src/components/StatusBadge.jsx): `src/components/StatusBadge.jsx`
- [Status normalization](https://github.com/achintxv/code-diary/blob/master/src/utils/status.js): `src/utils/status.js`

### API Routes

- [Login endpoint](https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/login/route.js): `src/app/api/auth/login/route.js`
- [Registration endpoint](https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/register/route.js): `src/app/api/auth/register/route.js`
- [Session endpoint](https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/me/route.js): `src/app/api/auth/me/route.js`
- [Logout endpoint](https://github.com/achintxv/code-diary/blob/master/src/app/api/auth/logout/route.js): `src/app/api/auth/logout/route.js`
- [Project endpoints](https://github.com/achintxv/code-diary/blob/master/src/app/api/project/route.js): `src/app/api/project/route.js`
- [Project detail endpoints](https://github.com/achintxv/code-diary/blob/master/src/app/api/project/%5Bid%5D/route.js): `src/app/api/project/[id]/route.js`
- [Issue endpoints](https://github.com/achintxv/code-diary/blob/master/src/app/api/issue/route.js): `src/app/api/issue/route.js`
- [Issue detail endpoints](https://github.com/achintxv/code-diary/blob/master/src/app/api/issue/%5Bid%5D/route.js): `src/app/api/issue/[id]/route.js`

### Identity

- [Session and tokens](https://github.com/achintxv/code-diary/blob/master/src/lib/auth.js): `src/lib/auth.js`

### Persistence

- [Database connection](https://github.com/achintxv/code-diary/blob/master/src/lib/db.js): `src/lib/db.js`
- [User records](https://github.com/achintxv/code-diary/blob/master/src/models/user.js): `src/models/user.js`
- [Project records](https://github.com/achintxv/code-diary/blob/master/src/models/project.js): `src/models/project.js`
- [Issue records](https://github.com/achintxv/code-diary/blob/master/src/models/issue.js): `src/models/issue.js`

### Other components

- **User**
- **MongoDB**

## Connections

- User → Login page: signs in (evidence: `README.md`)
- User → Registration page: registers (evidence: `README.md`)
- User → Dashboard entry: manages work (evidence: `README.md`)
- Login page → Login endpoint: submits credentials
- Registration page → Registration endpoint: creates account
- Dashboard entry → Project workspace: renders (evidence: `src/app/dashboard/page.jsx`)
- Project workspace → Project view: renders selection (evidence: `src/components/dashboard/DashboardShell.jsx`)
- Project view → Issue editor: renders editor (evidence: `src/components/dashboard/ProjectView.jsx`)
- Project view → Issue list: renders issues (evidence: `src/components/dashboard/ProjectView.jsx`)
- Issue list → Status badge: renders status (evidence: `src/components/IssueList.jsx`)
- Status badge → Status normalization: normalizes status (evidence: `src/components/StatusBadge.jsx`)
- Project workspace → Project endpoints: requests projects
- Project view → Issue endpoints: requests issues
- Project view → Issue detail endpoints: updates issues
- Login endpoint → Session and tokens: creates token (evidence: `src/app/api/auth/login/route.js`)
- Login endpoint → Database connection: connects (evidence: `src/app/api/auth/login/route.js`)
- Login endpoint → User records: looks up user (evidence: `src/app/api/auth/login/route.js`)
- Registration endpoint → Database connection: connects (evidence: `src/app/api/auth/register/route.js`)
- Registration endpoint → User records: creates user (evidence: `src/app/api/auth/register/route.js`)
- Session endpoint → Session and tokens: checks session (evidence: `src/app/api/auth/me/route.js`)
- Dashboard entry → Session and tokens: checks session (evidence: `src/app/dashboard/page.jsx`)
- Session and tokens → Database connection: connects (evidence: `src/lib/auth.js`)
- Session and tokens → User records: loads user (evidence: `src/lib/auth.js`)
- Project endpoints → Session and tokens: validates session (evidence: `src/app/api/project/route.js`)
- Project endpoints → Database connection: connects (evidence: `src/app/api/project/route.js`)
- Project endpoints → Project records: reads and writes (evidence: `src/app/api/project/route.js`)
- Project detail endpoints → Session and tokens: validates session (evidence: `src/app/api/project/[id]/route.js`)
- Project detail endpoints → Database connection: connects (evidence: `src/app/api/project/[id]/route.js`)
- Project detail endpoints → Project records: reads and writes (evidence: `src/app/api/project/[id]/route.js`)
- Project detail endpoints → Issue records: deletes project issues (evidence: `src/app/api/project/[id]/route.js`)
- Issue endpoints → Session and tokens: validates session (evidence: `src/app/api/issue/route.js`)
- Issue endpoints → Database connection: connects (evidence: `src/app/api/issue/route.js`)
- Issue endpoints → Project records: checks ownership (evidence: `src/app/api/issue/route.js`)
- Issue endpoints → Issue records: reads and creates (evidence: `src/app/api/issue/route.js`)
- Issue detail endpoints → Session and tokens: validates session (evidence: `src/app/api/issue/[id]/route.js`)
- Issue detail endpoints → Database connection: connects (evidence: `src/app/api/issue/[id]/route.js`)
- Issue detail endpoints → Project records: checks ownership (evidence: `src/app/api/issue/[id]/route.js`)
- Issue detail endpoints → Issue records: reads and mutates (evidence: `src/app/api/issue/[id]/route.js`)
- Database connection → MongoDB: connects (evidence: `src/lib/db.js`)
