How cokke93/proyecto-dam-appglucosa works
Project Type and Purpose
• This is a full-stack desktop application built with Electron (for the desktop shell and UI), Express.js (HTTP API backend), and MongoDB (data storage).
• Purpose: allow multi-user tracking of diabetic patient glucose measurements, generate interactive charts, export PDF reports, and provide nutritional guidance.
Core Components
a. Electron Desktop Client
• Renderer (frontend/pages + frontend/scripts + frontend/styles + Chart.js)
• Main process (frontend/main.js)
b. Express API Server (backend/app.js + backend/routes + backend/models)
c. MongoDB Database (with Mongoose ODM)
d. External Libraries & Services
• bcrypt (password hashing)
• JSON Web Tokens (authentication)
• PDF generator (export reports)
Relationships & Data Flows
• User interacts with Electron UI → UI makes HTTP(S) calls to Express routes (auth, measurements, food, report).
• Express controllers invoke Mongoose models (User, Measurement, FoodItem) → MongoDB.
• Responses (JSON data, PDF blobs) flow back to the renderer, which updates views or triggers downloads.
• Authentication flow: login/register endpoints generate JWTs → stored client-side → included in subsequent requests.
• Passwords hashed via bcrypt before persisting to MongoDB.
Architectural Patterns & Design Principles
• Layered architecture: Presentation (Electron renderer) → Application/API (Express) → Data (MongoDB).
• Separation of concerns:
• Routes handle HTTP;
• Models handle data schema and persistence;
• Frontend scripts handle DOM/UI logic.
• Stateless API calls secured via JWT tokens.
• MVC-like structure on backend: Routes as controllers, Mongoose schemas as models, views managed by Electron.
Execution Steps
2. Below it: Electron Main → spawns Renderer & manages window
6. Data flows: authentication flow, CRUD operations, PDF export