# mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts architecture

> Architecture diagram of the GitHub repository mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts
- Repository: https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts

## Overview

#### Purpose and Entry Points
A local personal reminder/memory assistant: a React SPA submits natural-language reminders and chat commands to an Express API, which persists reminders in MySQL, invokes Gemini or local parsing, and runs background alerts. Backend startup is `backend/server.js`; frontend bootstraps at `frontend/src/main.jsx` and renders `frontend/src/App.jsx`.

#### Client Application
The Vite/React single-page client provides the dashboard, reminder input, category filtering, chat companion, and browser-side audio alerts. It communicates with the backend REST endpoints and holds presentation/state logic primarily in:
- `frontend/src/App.jsx`
- `frontend/src/App.css`
- `frontend/src/main.jsx`

#### HTTP API and Application Boundary
Express routes separate transport concerns from application logic. Reminder CRUD and chat are exposed through reminder routes/controllers; memory analytics and filtered retrieval are exposed separately. This is the main client/server boundary:
- `backend/server.js`
- `backend/routes/reminderRoutes.js`
- `backend/routes/memoryRoutes.js`
- `backend/controllers/reminderController.js`
- `backend/controllers/memoryController.js`

#### Reminder Creation and Conversational Actions
Natural-language submission is handled by the reminder controller. It converts text into structured reminder attributes, creates database records, and supports chat-driven `CREATE`, `UPDATE`, and `DELETE` actions. Chat first reads active records to provide current context to the AI, then executes returned structured actions.
- `backend/controllers/reminderController.js`
- `backend/services/geminiService.js`
- `backend/utils/parser.js`

#### AI Parsing Resilience
`geminiService` is the Gemini-first integration for date/time, intent, priority, category, recurrence, and chat action extraction. The local parser is a degradation boundary: it preserves basic reminder creation when Gemini is unavailable, misconfigured, or fails.
- `backend/services/geminiService.js`
- `backend/utils/parser.js`

#### Persistence and Schema Evolution
MySQL is the system of record for reminders and their lifecycle states (`PENDING`, `TRIGGERED`, `MISSED`), schedules, recurrence, priority, and category. Database access is centralized through a connection pool; startup migration updates existing schemas without destructive reset.
- `backend/config/db.js`
- `backend/config/schema.sql`
- `backend/config/migrate.js`

#### Scheduler and Alert Delivery
A server-resident cron worker runs every minute, finds pending due reminders, marks severely overdue records missed, triggers reminders, and creates next instances for recurring schedules. Alert delivery crosses external/system boundaries: desktop notifications via the host OS and high-priority email via Gmail SMTP.
- `backend/utils/cron.js`
- `backend/utils/email.js`
- `backend/server.js`

#### Runtime and External Dependencies
The system uses Node.js/Express (Node 18+), React/Vite, and a locally reachable MySQL server. External integrations require Google Gemini API credentials and optional Gmail app-password SMTP credentials; desktop notifications depend on the runtime host’s notification support.

Main entry points: [`backend/server.js`](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/server.js) (Express server), [`backend/utils/cron.js`](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/utils/cron.js) (Reminder scheduler), [`backend/config/db.js`](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/config/db.js) (Database pool), [`backend/controllers/reminderController.js`](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/controllers/reminderController.js) (Reminder controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_react_app["React dashboard<br/>React SPA<br/>[App.jsx]"]
  node_client_bootstrap["Vite bootstrap<br/>React entry<br/>[main.jsx]"]
end

subgraph group_backend["Backend"]
  node_express_server["Express server<br/>Node entry point<br/>[server.js]"]
  node_reminder_routes["Reminder routes<br/>Express routes<br/>[reminderRoutes.js]"]
  node_memory_routes["Memory routes<br/>Express routes<br/>[memoryRoutes.js]"]
  node_reminder_controller["Reminder controller<br/>Application controller"]
  node_memory_controller["Memory controller<br/>Application controller"]
  node_gemini_service{{"Gemini integration<br/>AI service<br/>[geminiService.js]"}}
  node_local_parser["Local parser<br/>Fallback parser<br/>[parser.js]"]
  node_db_pool["Database pool<br/>MySQL access<br/>[db.js]"]
  node_schema_migration["Schema migration<br/>Startup migration<br/>[migrate.js]"]
  node_scheduler["Reminder scheduler<br/>Cron worker<br/>[cron.js]"]
  node_email_delivery["Email delivery<br/>SMTP adapter<br/>[email.js]"]
end

subgraph group_external["External systems"]
  node_mysql[("MySQL reminders<br/>System of record")]
  node_gemini_api{{"Google Gemini<br/>External AI API"}}
  node_desktop_notifications["Host notifications<br/>OS notification service"]
  node_gmail_smtp["Gmail SMTP<br/>External mail service"]
end

node_client_bootstrap -->|"renders"| node_react_app
node_react_app -->|"REST requests"| node_express_server
node_express_server -->|"mounts"| node_reminder_routes
node_express_server -->|"mounts"| node_memory_routes
node_express_server -->|"runs at startup"| node_schema_migration
node_express_server -->|"starts"| node_scheduler
node_reminder_routes -->|"dispatches"| node_reminder_controller
node_memory_routes -->|"dispatches"| node_memory_controller
node_reminder_controller -->|"parses text and chat"| node_gemini_service
node_gemini_service -.->|"falls back on failure"| node_local_parser
node_gemini_service -->|"AI requests"| node_gemini_api
node_reminder_controller -->|"reads and writes reminders"| node_db_pool
node_memory_controller -->|"queries memories"| node_db_pool
node_scheduler -->|"finds and updates due records"| node_db_pool
node_schema_migration -->|"evolves schema"| node_mysql
node_db_pool -->|"connection pool"| node_mysql
node_scheduler -->|"desktop alerts"| node_desktop_notifications
node_scheduler -->|"high-priority alerts"| node_email_delivery
node_email_delivery -->|"sends via SMTP"| node_gmail_smtp

click node_react_app "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/frontend/src/App.jsx"
click node_client_bootstrap "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/frontend/src/main.jsx"
click node_express_server "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/server.js"
click node_reminder_routes "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/routes/reminderRoutes.js"
click node_memory_routes "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/routes/memoryRoutes.js"
click node_reminder_controller "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/controllers/reminderController.js"
click node_memory_controller "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/controllers/memoryController.js"
click node_gemini_service "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/services/geminiService.js"
click node_local_parser "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/utils/parser.js"
click node_db_pool "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/config/db.js"
click node_schema_migration "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/config/migrate.js"
click node_scheduler "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/utils/cron.js"
click node_email_delivery "https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/utils/email.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_react_app,node_client_bootstrap toneBlue
class node_express_server,node_reminder_routes,node_memory_routes,node_reminder_controller,node_memory_controller,node_gemini_service,node_local_parser,node_db_pool,node_schema_migration,node_scheduler,node_email_delivery toneAmber
class node_mysql,node_gemini_api,node_desktop_notifications,node_gmail_smtp toneMint
```

## Components

### Client

- [React dashboard](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/frontend/src/App.jsx): React SPA · Dashboard, reminder input, filters, chat, and browser audio alerts. · `frontend/src/App.jsx`
- [Vite bootstrap](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/frontend/src/main.jsx): React entry · `frontend/src/main.jsx`

### Backend

- [Express server](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/server.js): Node entry point · Starts HTTP API, migrations, and scheduler. · `backend/server.js`
- [Reminder routes](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/routes/reminderRoutes.js): Express routes · Reminder CRUD and chat transport boundary. · `backend/routes/reminderRoutes.js`
- [Memory routes](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/routes/memoryRoutes.js): Express routes · Analytics and filtered-memory retrieval endpoints. · `backend/routes/memoryRoutes.js`
- [Reminder controller](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/controllers/reminderController.js): Application controller · Creates reminders and executes AI-derived chat actions. · `backend/controllers/reminderController.js`
- [Memory controller](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/controllers/memoryController.js): Application controller · `backend/controllers/memoryController.js`
- [Gemini integration](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/services/geminiService.js): AI service · Extracts reminder fields, intent, and structured chat actions. · `backend/services/geminiService.js`
- [Local parser](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/utils/parser.js): Fallback parser · Preserves basic reminder creation when AI parsing fails. · `backend/utils/parser.js`
- [Database pool](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/config/db.js): MySQL access · Centralized database connection access. · `backend/config/db.js`
- [Schema migration](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/config/migrate.js): Startup migration · Evolves existing schema without destructive reset. · `backend/config/migrate.js`
- [Reminder scheduler](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/utils/cron.js): Cron worker · Runs each minute to trigger, miss, and recur due reminders. · `backend/utils/cron.js`
- [Email delivery](https://github.com/mugilanm23/nlp-driven-personal-memory-assistant-with-real-time-alerts/blob/main/backend/utils/email.js): SMTP adapter · Sends high-priority reminder emails. · `backend/utils/email.js`

### External systems

- **MySQL reminders**: System of record · Stores reminder schedules, lifecycle, recurrence, priority, and category.
- **Google Gemini**: External AI API
- **Host notifications**: OS notification service
- **Gmail SMTP**: External mail service

## Connections

- Vite bootstrap → React dashboard: renders
- React dashboard → Express server: REST requests
- Express server → Reminder routes: mounts
- Express server → Memory routes: mounts
- Express server → Schema migration: runs at startup
- Express server → Reminder scheduler: starts
- Reminder routes → Reminder controller: dispatches
- Memory routes → Memory controller: dispatches
- Reminder controller → Gemini integration: parses text and chat
- Gemini integration → Local parser: falls back on failure
- Gemini integration → Google Gemini: AI requests
- Reminder controller → Database pool: reads and writes reminders
- Memory controller → Database pool: queries memories
- Reminder scheduler → Database pool: finds and updates due records
- Schema migration → MySQL reminders: evolves schema
- Database pool → MySQL reminders: connection pool
- Reminder scheduler → Host notifications: desktop alerts
- Reminder scheduler → Email delivery: high-priority alerts
- Email delivery → Gmail SMTP: sends via SMTP
