# upal02/note-taker architecture

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

- Interactive diagram: https://gitdiagram.com/upal02/note-taker
- Repository: https://github.com/upal02/note-taker

## Overview

Notes Management Dashboard supports registration and login, role-protected dashboards, note CRUD, user administration, and analytics. Users enter through the React app; Redux-backed pages call the versioned Express API, whose routes apply authentication, role checks, and validation before controllers and services access PostgreSQL. The graph includes the documented analytics and dashboard capabilities, but analytics implementation details and several frontend API calls were not sampled; those connections are omitted or marked unverified rather than inferred as confirmed calls.

Main entry points: [`frontend/src/App.jsx`](https://github.com/upal02/note-taker/blob/main/frontend/src/App.jsx) (Route application), [`backend/src/app.js`](https://github.com/upal02/note-taker/blob/main/backend/src/app.js) (Express API), [`backend/src/routes/noteRoutes.js`](https://github.com/upal02/note-taker/blob/main/backend/src/routes/noteRoutes.js) (Notes routes), [`frontend/src/redux/store.js`](https://github.com/upal02/note-taker/blob/main/frontend/src/redux/store.js) (Redux store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["Route application<br/>[App.jsx]"]
  node_auth_pages["Login and registration<br/>[LoginPage.jsx]"]
  node_dashboards["Role dashboards<br/>[UserDashboard.jsx]"]
  node_notes_page["Notes interface<br/>[NotesPage.jsx]"]
  node_navbar["Role navigation<br/>[Navbar.jsx]"]
  node_redux["Redux store<br/>[store.js]"]
  node_auth_state["Authentication state<br/>[authSlice.js]"]
  node_note_state["Notes state<br/>[noteSlice.js]"]
  node_analytics_state["Analytics state<br/>[analyticsSlice.js]"]
  node_api_client["API client<br/>[index.js]"]
end

subgraph group_api["API and access control"]
  node_express_app["Express API<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_note_routes["Notes routes<br/>[noteRoutes.js]"]
  node_user_routes["User routes<br/>[userRoutes.js]"]
  node_analytics_routes["Analytics routes<br/>[analyticsRoutes.js]"]
  node_auth_middleware["JWT authentication<br/>[authMiddleware.js]"]
  node_role_middleware["Role authorization<br/>[roleMiddleware.js]"]
  node_validation["Request validation"]
end

subgraph group_domain["Domain services"]
  node_auth_domain["Authentication service<br/>[authService.js]"]
  node_note_controller["Notes controller<br/>[noteController.js]"]
  node_note_service["Notes service<br/>[noteService.js]"]
  node_user_controller["User controller<br/>[userController.js]"]
  node_user_service["User service<br/>[userService.js]"]
  node_analytics_controller["Analytics controller"]
  node_analytics_service["Analytics service"]
end

subgraph group_data["Persistence"]
  node_models["User and note models<br/>[index.js]"]
  node_database[("PostgreSQL database<br/>[database.js]")]
end

node_user(("User"))
node_postgres[("PostgreSQL")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_auth_pages
node_app -->|"routes to"| node_dashboards
node_app -->|"routes to"| node_notes_page
node_app -.->|"reads auth state"| node_redux
node_navbar -->|"reads"| node_auth_state
node_redux -->|"registers reducer"| node_auth_state
node_redux -->|"registers reducer"| node_note_state
node_redux -->|"registers reducer"| node_analytics_state
node_auth_state -->|"calls"| node_api_client
node_notes_page -.->|"dispatches actions"| node_note_state
node_dashboards -.->|"dispatches actions"| node_analytics_state
node_dashboards -.->|"dispatches actions"| node_note_state
node_api_client -.->|"sends API requests"| node_express_app
node_express_app -->|"mounts"| node_auth_routes
node_express_app -->|"mounts"| node_note_routes
node_express_app -->|"mounts"| node_user_routes
node_express_app -->|"mounts"| node_analytics_routes
node_auth_routes -->|"applies"| node_auth_middleware
node_note_routes -->|"applies"| node_auth_middleware
node_note_routes -->|"applies"| node_role_middleware
node_note_routes -->|"validates with"| node_validation
node_user_routes -->|"applies"| node_auth_middleware
node_user_routes -->|"applies"| node_role_middleware
node_auth_routes -->|"dispatches to"| node_auth_domain
node_note_routes -->|"dispatches to"| node_note_controller
node_user_routes -->|"dispatches to"| node_user_controller
node_analytics_routes -->|"dispatches to"| node_analytics_controller
node_note_controller -->|"calls"| node_note_service
node_user_controller -->|"calls"| node_user_service
node_auth_domain -->|"reads and creates users"| node_models
node_note_service -->|"uses models"| node_models
node_user_service -->|"uses models"| node_models
node_analytics_controller -.->|"uses"| node_analytics_service
node_models -->|"configures ORM"| node_database
node_database -.->|"connects to"| node_postgres

click node_app "https://github.com/upal02/note-taker/blob/main/frontend/src/App.jsx"
click node_auth_pages "https://github.com/upal02/note-taker/blob/main/frontend/src/pages/LoginPage.jsx"
click node_dashboards "https://github.com/upal02/note-taker/blob/main/frontend/src/pages/UserDashboard.jsx"
click node_notes_page "https://github.com/upal02/note-taker/blob/main/frontend/src/pages/NotesPage.jsx"
click node_navbar "https://github.com/upal02/note-taker/blob/main/frontend/src/components/navbar/Navbar.jsx"
click node_redux "https://github.com/upal02/note-taker/blob/main/frontend/src/redux/store.js"
click node_auth_state "https://github.com/upal02/note-taker/blob/main/frontend/src/redux/slices/authSlice.js"
click node_note_state "https://github.com/upal02/note-taker/blob/main/frontend/src/redux/slices/noteSlice.js"
click node_analytics_state "https://github.com/upal02/note-taker/blob/main/frontend/src/redux/slices/analyticsSlice.js"
click node_api_client "https://github.com/upal02/note-taker/blob/main/frontend/src/api/index.js"
click node_express_app "https://github.com/upal02/note-taker/blob/main/backend/src/app.js"
click node_auth_routes "https://github.com/upal02/note-taker/blob/main/backend/src/routes/authRoutes.js"
click node_note_routes "https://github.com/upal02/note-taker/blob/main/backend/src/routes/noteRoutes.js"
click node_user_routes "https://github.com/upal02/note-taker/blob/main/backend/src/routes/userRoutes.js"
click node_analytics_routes "https://github.com/upal02/note-taker/blob/main/backend/src/routes/analyticsRoutes.js"
click node_auth_middleware "https://github.com/upal02/note-taker/blob/main/backend/src/middleware/authMiddleware.js"
click node_role_middleware "https://github.com/upal02/note-taker/blob/main/backend/src/middleware/roleMiddleware.js"
click node_validation "https://github.com/upal02/note-taker/blob/main/backend/src/middleware/validateMiddleware.js"
click node_auth_domain "https://github.com/upal02/note-taker/blob/main/backend/src/services/authService.js"
click node_note_controller "https://github.com/upal02/note-taker/blob/main/backend/src/controllers/noteController.js"
click node_note_service "https://github.com/upal02/note-taker/blob/main/backend/src/services/noteService.js"
click node_user_controller "https://github.com/upal02/note-taker/blob/main/backend/src/controllers/userController.js"
click node_user_service "https://github.com/upal02/note-taker/blob/main/backend/src/services/userService.js"
click node_analytics_controller "https://github.com/upal02/note-taker/blob/main/backend/src/controllers/analyticsController.js"
click node_analytics_service "https://github.com/upal02/note-taker/blob/main/backend/src/services/analyticsService.js"
click node_models "https://github.com/upal02/note-taker/blob/main/backend/src/models/index.js"
click node_database "https://github.com/upal02/note-taker/blob/main/backend/src/config/database.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_auth_pages,node_dashboards,node_notes_page,node_navbar,node_redux,node_auth_state,node_note_state,node_analytics_state,node_api_client,node_user toneBlue
class node_express_app,node_auth_routes,node_note_routes,node_user_routes,node_analytics_routes,node_auth_middleware,node_role_middleware,node_validation,node_postgres toneAmber
class node_auth_domain,node_note_controller,node_note_service,node_user_controller,node_user_service,node_analytics_controller,node_analytics_service toneMint
class node_models,node_database toneRose
```

## Components

### Frontend experience

- [Route application](https://github.com/upal02/note-taker/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and registration](https://github.com/upal02/note-taker/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Role dashboards](https://github.com/upal02/note-taker/blob/main/frontend/src/pages/UserDashboard.jsx): `frontend/src/pages/UserDashboard.jsx`
- [Notes interface](https://github.com/upal02/note-taker/blob/main/frontend/src/pages/NotesPage.jsx): `frontend/src/pages/NotesPage.jsx`
- [Role navigation](https://github.com/upal02/note-taker/blob/main/frontend/src/components/navbar/Navbar.jsx): `frontend/src/components/navbar/Navbar.jsx`
- [Redux store](https://github.com/upal02/note-taker/blob/main/frontend/src/redux/store.js): `frontend/src/redux/store.js`
- [Authentication state](https://github.com/upal02/note-taker/blob/main/frontend/src/redux/slices/authSlice.js): `frontend/src/redux/slices/authSlice.js`
- [Notes state](https://github.com/upal02/note-taker/blob/main/frontend/src/redux/slices/noteSlice.js): `frontend/src/redux/slices/noteSlice.js`
- [Analytics state](https://github.com/upal02/note-taker/blob/main/frontend/src/redux/slices/analyticsSlice.js): `frontend/src/redux/slices/analyticsSlice.js`
- [API client](https://github.com/upal02/note-taker/blob/main/frontend/src/api/index.js): `frontend/src/api/index.js`

### API and access control

- [Express API](https://github.com/upal02/note-taker/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication routes](https://github.com/upal02/note-taker/blob/main/backend/src/routes/authRoutes.js): `backend/src/routes/authRoutes.js`
- [Notes routes](https://github.com/upal02/note-taker/blob/main/backend/src/routes/noteRoutes.js): `backend/src/routes/noteRoutes.js`
- [User routes](https://github.com/upal02/note-taker/blob/main/backend/src/routes/userRoutes.js): `backend/src/routes/userRoutes.js`
- [Analytics routes](https://github.com/upal02/note-taker/blob/main/backend/src/routes/analyticsRoutes.js): `backend/src/routes/analyticsRoutes.js`
- [JWT authentication](https://github.com/upal02/note-taker/blob/main/backend/src/middleware/authMiddleware.js): `backend/src/middleware/authMiddleware.js`
- [Role authorization](https://github.com/upal02/note-taker/blob/main/backend/src/middleware/roleMiddleware.js): `backend/src/middleware/roleMiddleware.js`
- [Request validation](https://github.com/upal02/note-taker/blob/main/backend/src/middleware/validateMiddleware.js): `backend/src/middleware/validateMiddleware.js`

### Domain services

- [Authentication service](https://github.com/upal02/note-taker/blob/main/backend/src/services/authService.js): `backend/src/services/authService.js`
- [Notes controller](https://github.com/upal02/note-taker/blob/main/backend/src/controllers/noteController.js): `backend/src/controllers/noteController.js`
- [Notes service](https://github.com/upal02/note-taker/blob/main/backend/src/services/noteService.js): `backend/src/services/noteService.js`
- [User controller](https://github.com/upal02/note-taker/blob/main/backend/src/controllers/userController.js): `backend/src/controllers/userController.js`
- [User service](https://github.com/upal02/note-taker/blob/main/backend/src/services/userService.js): `backend/src/services/userService.js`
- [Analytics controller](https://github.com/upal02/note-taker/blob/main/backend/src/controllers/analyticsController.js): `backend/src/controllers/analyticsController.js`
- [Analytics service](https://github.com/upal02/note-taker/blob/main/backend/src/services/analyticsService.js): `backend/src/services/analyticsService.js`

### Persistence

- [User and note models](https://github.com/upal02/note-taker/blob/main/backend/src/models/index.js): `backend/src/models/index.js`
- [PostgreSQL database](https://github.com/upal02/note-taker/blob/main/backend/src/config/database.js): `backend/src/config/database.js`

### Other components

- **User**
- **PostgreSQL**

## Connections

- User → Route application: uses (evidence: `README.md`)
- Route application → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Role dashboards: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Notes interface: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Redux store: reads auth state
- Role navigation → Authentication state: reads (evidence: `frontend/src/components/navbar/Navbar.jsx`)
- Redux store → Authentication state: registers reducer (evidence: `frontend/src/redux/store.js`)
- Redux store → Notes state: registers reducer (evidence: `frontend/src/redux/store.js`)
- Redux store → Analytics state: registers reducer (evidence: `frontend/src/redux/store.js`)
- Authentication state → API client: calls (evidence: `frontend/src/redux/slices/authSlice.js`)
- Notes interface → Notes state: dispatches actions
- Role dashboards → Analytics state: dispatches actions
- Role dashboards → Notes state: dispatches actions
- API client → Express API: sends API requests
- Express API → Authentication routes: mounts (evidence: `backend/src/app.js`)
- Express API → Notes routes: mounts (evidence: `backend/src/app.js`)
- Express API → User routes: mounts (evidence: `backend/src/app.js`)
- Express API → Analytics routes: mounts (evidence: `backend/src/app.js`)
- Authentication routes → JWT authentication: applies (evidence: `backend/src/routes/authRoutes.js`)
- Notes routes → JWT authentication: applies (evidence: `backend/src/routes/noteRoutes.js`)
- Notes routes → Role authorization: applies (evidence: `backend/src/routes/noteRoutes.js`)
- Notes routes → Request validation: validates with (evidence: `backend/src/routes/noteRoutes.js`)
- User routes → JWT authentication: applies (evidence: `backend/src/routes/userRoutes.js`)
- User routes → Role authorization: applies (evidence: `backend/src/routes/userRoutes.js`)
- Authentication routes → Authentication service: dispatches to (evidence: `backend/src/routes/authRoutes.js`)
- Notes routes → Notes controller: dispatches to (evidence: `backend/src/routes/noteRoutes.js`)
- User routes → User controller: dispatches to (evidence: `backend/src/routes/userRoutes.js`)
- Analytics routes → Analytics controller: dispatches to (evidence: `backend/src/routes/analyticsRoutes.js`)
- Notes controller → Notes service: calls (evidence: `backend/src/controllers/noteController.js`)
- User controller → User service: calls (evidence: `backend/src/controllers/userController.js`)
- Authentication service → User and note models: reads and creates users (evidence: `backend/src/services/authService.js`)
- Notes service → User and note models: uses models (evidence: `backend/src/services/noteService.js`)
- User service → User and note models: uses models (evidence: `backend/src/services/userService.js`)
- Analytics controller → Analytics service: uses
- User and note models → PostgreSQL database: configures ORM (evidence: `backend/src/models/index.js`)
- PostgreSQL database → PostgreSQL: connects to
