How codemanojhv/project works
Project Type and Purpose
• The system offers a user-facing interactive map (built in React) and a backend API (Node.js by default, with a Python alternative) that persists data in SQLite.
File Structure
• Top-level split:
• src/ – Frontend React + TypeScript code
• server/ – Primary Node.js backend (index.js + SQLite files)
• backend/ – Alternative Python backend (FastAPI or Flask style)
• public/static files: index.html, netlify.toml, etc.
• Frontend: components/, services/api.ts, constants, types.
• Node backend: single entry (server/index.js) connecting to server/database.sqlite.
• Python backend: routes/, services/, models/, database.py – follows an MVC-like pattern.
• Configuration: Vite, Tailwind, ESLint/Prettier, environment (.env.development/.production).
README
• Confirms that the frontend runs on Vite (http://localhost:5173) and the Node API on port 8000.
• Tech stack: React + Leaflet for maps, Node.js + SQLite, and an alternative Python implementation.
• Data flow: hospitals post real-time data → backend stores in SQLite → frontend consumes API to render heatmaps.
Main Components & Relationships
a. Frontend (React/Vite/Tailwind/Leaflet)
b. API Layer (Node.js Express)
c. Database (SQLite file)
d. Alternative Backend (Python)
e. External Data Sources (Hospitals, Map tile servers)
f. Dev tooling (Vite dev server, ESLint, Prettier)
Interactions:
• User’s browser ↔ Frontend (HTTP/WS for live updates)
• Frontend → API Layer (REST calls, e.g., /cases, /alerts, /cities)
• API Layer → SQLite (CRUD via ORM or direct queries)
• Optional: Hospitals → API Layer (data ingestion)
• Frontend → Leaflet tile servers (for map base layers)
Architectural Patterns & Principles
• Separation of concerns: UI layer vs. API layer vs. data layer
• MVC/MV* style in Python backend (models/services/routes)
• Controller-service pattern in both backends (routes/controllers delegate to services)
• Single-page app (SPA) in the frontend
• Monolithic backend (no microservices) but two interchangeable implementations
Must-Include Elements
• Component labels
Detail Level
• That the Node.js server uses routes (alerts, cases, cities) which call service classes, which in turn manipulate models and interact with the database.