# rekcah97/notex architecture

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

- Interactive diagram: https://gitdiagram.com/rekcah97/notex
- Repository: https://github.com/rekcah97/notex

## Overview

NoteX is a full-stack note-taking application. Users register or log in, verify their email with an OTP, then access and manage notes; the backend authenticates requests and persists user, OTP, and note data in MongoDB. The README also documents periodic expired-OTP cleanup and a health endpoint monitored by UptimeRobot. Frontend auth screens and some integrations are represented from the tree and README, but their implementation details were not sampled; those relationships are left unverified where appropriate.

Main entry points: [`backend/routes/index.Routes.js`](https://github.com/rekcah97/notex/blob/major/backend/routes/index.Routes.js) (API routing), [`frontend/src/components/Notes.js`](https://github.com/rekcah97/notex/blob/major/frontend/src/components/Notes.js) (Notes interface), [`backend/controllers/auth.Controller.js`](https://github.com/rekcah97/notex/blob/major/backend/controllers/auth.Controller.js) (Auth handlers), [`backend/routes/auth.Routes.js`](https://github.com/rekcah97/notex/blob/major/backend/routes/auth.Routes.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App and routes<br/>[App.js]"]
  node_authscreens["Auth screens"]
  node_notesui["Notes interface<br/>[Notes.js]"]
  node_noteitems["Note item<br/>[Noteitem.js]"]
  node_notecontext["Note state<br/>[NoteState.js]"]
end

subgraph group_api["Express API"]
  node_apiroot["API routing<br/>[index.Routes.js]"]
  node_authroutes["Auth routes<br/>[auth.Routes.js]"]
  node_noteroutes["Note routes<br/>[notes.Rouets.js]"]
end

subgraph group_identity["Identity and OTP"]
  node_authcontroller["Auth handlers<br/>[auth.Controller.js]"]
  node_tokencheck["Token middleware"]
  node_userrecord[("User records<br/>[User.js]")]
  node_otpcontroller["OTP email helper"]
  node_otprecord[("OTP records")]
end

subgraph group_notes["Notes"]
  node_notescontroller["Note handlers"]
  node_noterecord[("Note records<br/>[Note.js]")]
end

subgraph group_operations["Operations"]
  node_server["Backend server<br/>[server.js]"]
  node_database[("MongoDB")]
  node_resend["Resend email"]
  node_cleanup["OTP cleanup job"]
  node_uptimerobot["UptimeRobot"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_authscreens
node_app -.->|"routes via home"| node_notesui
node_user -.->|"authenticates through"| node_authroutes
node_notesui -->|"renders"| node_noteitems
node_notesui -->|"uses"| node_notecontext
node_notesui -->|"requests user status"| node_apiroot
node_server -->|"mounts"| node_apiroot
node_apiroot -->|"dispatches"| node_authroutes
node_apiroot -->|"dispatches"| node_noteroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"authenticates"| node_tokencheck
node_noteroutes -->|"dispatches"| node_notescontroller
node_noteroutes -->|"authenticates"| node_tokencheck
node_authcontroller -->|"reads and updates"| node_userrecord
node_authcontroller -->|"checks and deletes"| node_otprecord
node_authcontroller -->|"sends verification"| node_otpcontroller
node_otpcontroller -->|"creates OTP"| node_otprecord
node_otpcontroller -->|"sends email"| node_resend
node_notescontroller -->|"reads and writes"| node_noterecord
node_server -->|"connects"| node_database
node_userrecord -->|"persists in"| node_database
node_otprecord -->|"persists in"| node_database
node_noterecord -->|"persists in"| node_database
node_server -->|"schedules"| node_cleanup
node_cleanup -->|"deletes expired"| node_otprecord
node_uptimerobot -->|"pings health"| node_apiroot

click node_app "https://github.com/rekcah97/notex/blob/major/frontend/src/App.js"
click node_authscreens "https://github.com/rekcah97/notex/tree/major/frontend/src/components"
click node_notesui "https://github.com/rekcah97/notex/blob/major/frontend/src/components/Notes.js"
click node_noteitems "https://github.com/rekcah97/notex/blob/major/frontend/src/components/Noteitem.js"
click node_notecontext "https://github.com/rekcah97/notex/blob/major/frontend/src/context/notes/NoteState.js"
click node_apiroot "https://github.com/rekcah97/notex/blob/major/backend/routes/index.Routes.js"
click node_authroutes "https://github.com/rekcah97/notex/blob/major/backend/routes/auth.Routes.js"
click node_noteroutes "https://github.com/rekcah97/notex/blob/major/backend/routes/notes.Rouets.js"
click node_authcontroller "https://github.com/rekcah97/notex/blob/major/backend/controllers/auth.Controller.js"
click node_tokencheck "https://github.com/rekcah97/notex/blob/major/backend/middleware/fetchuser.Middleware.js"
click node_userrecord "https://github.com/rekcah97/notex/blob/major/backend/models/User.js"
click node_otpcontroller "https://github.com/rekcah97/notex/blob/major/backend/helpers/sendOtpVerificationEmail.Helper.js"
click node_otprecord "https://github.com/rekcah97/notex/blob/major/backend/models/UserOTPVerification.js"
click node_notescontroller "https://github.com/rekcah97/notex/blob/major/backend/controllers/notes.Controller.js"
click node_noterecord "https://github.com/rekcah97/notex/blob/major/backend/models/Note.js"
click node_server "https://github.com/rekcah97/notex/blob/major/backend/server.js"
click node_cleanup "https://github.com/rekcah97/notex/blob/major/backend/jobs/cleanupExpiredOTP.jobs.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_authscreens,node_notesui,node_noteitems,node_notecontext,node_user toneBlue
class node_apiroot,node_authroutes,node_noteroutes toneAmber
class node_authcontroller,node_tokencheck,node_userrecord,node_otpcontroller,node_otprecord toneMint
class node_notescontroller,node_noterecord toneRose
class node_server,node_database,node_resend,node_cleanup,node_uptimerobot toneIndigo
```

## Components

### React client

- [App and routes](https://github.com/rekcah97/notex/blob/major/frontend/src/App.js): `frontend/src/App.js`
- [Auth screens](https://github.com/rekcah97/notex/tree/major/frontend/src/components): `frontend/src/components`
- [Notes interface](https://github.com/rekcah97/notex/blob/major/frontend/src/components/Notes.js): `frontend/src/components/Notes.js`
- [Note item](https://github.com/rekcah97/notex/blob/major/frontend/src/components/Noteitem.js): `frontend/src/components/Noteitem.js`
- [Note state](https://github.com/rekcah97/notex/blob/major/frontend/src/context/notes/NoteState.js): `frontend/src/context/notes/NoteState.js`

### Express API

- [API routing](https://github.com/rekcah97/notex/blob/major/backend/routes/index.Routes.js): `backend/routes/index.Routes.js`
- [Auth routes](https://github.com/rekcah97/notex/blob/major/backend/routes/auth.Routes.js): `backend/routes/auth.Routes.js`
- [Note routes](https://github.com/rekcah97/notex/blob/major/backend/routes/notes.Rouets.js): `backend/routes/notes.Rouets.js`

### Identity and OTP

- [Auth handlers](https://github.com/rekcah97/notex/blob/major/backend/controllers/auth.Controller.js): `backend/controllers/auth.Controller.js`
- [Token middleware](https://github.com/rekcah97/notex/blob/major/backend/middleware/fetchuser.Middleware.js): `backend/middleware/fetchuser.Middleware.js`
- [User records](https://github.com/rekcah97/notex/blob/major/backend/models/User.js): `backend/models/User.js`
- [OTP email helper](https://github.com/rekcah97/notex/blob/major/backend/helpers/sendOtpVerificationEmail.Helper.js): `backend/helpers/sendOtpVerificationEmail.Helper.js`
- [OTP records](https://github.com/rekcah97/notex/blob/major/backend/models/UserOTPVerification.js): `backend/models/UserOTPVerification.js`

### Notes

- [Note handlers](https://github.com/rekcah97/notex/blob/major/backend/controllers/notes.Controller.js): `backend/controllers/notes.Controller.js`
- [Note records](https://github.com/rekcah97/notex/blob/major/backend/models/Note.js): `backend/models/Note.js`

### Operations

- [Backend server](https://github.com/rekcah97/notex/blob/major/backend/server.js): `backend/server.js`
- **MongoDB**
- **Resend email**
- [OTP cleanup job](https://github.com/rekcah97/notex/blob/major/backend/jobs/cleanupExpiredOTP.jobs.js): `backend/jobs/cleanupExpiredOTP.jobs.js`
- **UptimeRobot**

### Other components

- **User**

## Connections

- User → App and routes: uses (evidence: `frontend/src/App.js`)
- App and routes → Auth screens: routes to (evidence: `frontend/src/App.js`)
- App and routes → Notes interface: routes via home
- User → Auth routes: authenticates through
- Notes interface → Note item: renders (evidence: `frontend/src/components/Notes.js`)
- Notes interface → Note state: uses (evidence: `frontend/src/components/Notes.js`)
- Notes interface → API routing: requests user status (evidence: `frontend/src/components/Notes.js`)
- Backend server → API routing: mounts (evidence: `backend/server.js`)
- API routing → Auth routes: dispatches (evidence: `backend/routes/index.Routes.js`)
- API routing → Note routes: dispatches (evidence: `backend/routes/index.Routes.js`)
- Auth routes → Auth handlers: dispatches (evidence: `backend/routes/auth.Routes.js`)
- Auth routes → Token middleware: authenticates (evidence: `backend/routes/auth.Routes.js`)
- Note routes → Note handlers: dispatches (evidence: `backend/routes/notes.Rouets.js`)
- Note routes → Token middleware: authenticates (evidence: `backend/routes/notes.Rouets.js`)
- Auth handlers → User records: reads and updates (evidence: `backend/controllers/auth.Controller.js`)
- Auth handlers → OTP records: checks and deletes (evidence: `backend/controllers/auth.Controller.js`)
- Auth handlers → OTP email helper: sends verification (evidence: `backend/controllers/auth.Controller.js`)
- OTP email helper → OTP records: creates OTP (evidence: `backend/helpers/sendOtpVerificationEmail.Helper.js`)
- OTP email helper → Resend email: sends email (evidence: `backend/helpers/sendOtpVerificationEmail.Helper.js`)
- Note handlers → Note records: reads and writes (evidence: `backend/controllers/notes.Controller.js`)
- Backend server → MongoDB: connects (evidence: `README.md`)
- User records → MongoDB: persists in (evidence: `README.md`)
- OTP records → MongoDB: persists in (evidence: `README.md`)
- Note records → MongoDB: persists in (evidence: `README.md`)
- Backend server → OTP cleanup job: schedules (evidence: `backend/server.js`)
- OTP cleanup job → OTP records: deletes expired (evidence: `backend/jobs/cleanupExpiredOTP.jobs.js`)
- UptimeRobot → API routing: pings health (evidence: `README.md`)
