How miguelloaizadev/gestion-restaurante works
A. Project Type and Purpose
This is a full-stack, single-page web application (SPA) for restaurant management.
• Frontend: React 18 + Vite + Bootstrap, deployed via Firebase Hosting.
• Backend: Node.js (Express) serving a RESTful API, with JSON files as the data store.
B. File-Structure Analysis
Architectural Patterns & Conventions
• SPA routing → React Router Dom in src/pages/ → each page handles a domain: Inventory, Orders, Reports.
• Reusable UI → src/components/ (modals, panels, tables).
• Data-flow: components → pages → API clients → backend endpoints.
• Backend: minimal MVC—Express “controllers” in index.js reading/writing JSON.
Main Components
1. User & Browser (Client)
2. React/Vite Dev Server (during development)
3. Firebase Hosting (production static‐asset hosting)
4. REST API Server (Node.js + Express)
5. JSON Files (Data Store)
6. (Optional) CI/CD Pipeline (npm scripts, firebase deploy)
Relationships & Data Flows
• User→Browser: clicks UI.
• Browser→Frontend App: React Router navigates between pages.
• Frontend→API Server: HTTP REST calls (GET /products, POST /pedidos, GET /reportes, etc.).
• API Server→File Store: read/write JSON files (ingredientes.json, pedidos.json, movimientos_inventario.json, etc.).
• Build & Deploy: Vite build → Firebase CLI → Firebase Hosting.
Architectural Patterns
• SPA with Client-side Routing (React Router).
• RESTful API layer (Express endpoints) separate from UI.
• File-based persistence (JSON) as a simple NoSQL store (no external DB).
• Modular UI (components/pages), separation of concerns.
• Monorepo with clearly separated frontend/backend.
Call Out Key Technologies & Frameworks
Backend: Node.js, Express (in index.js), file-system module (fs) for JSON manipulation, npm scripts.
Hosting/Deployment: Firebase Hosting, firebase.json/.firebaserc.
Use two main horizontal tiers
Tier 1 (Client): Browser & Static Hosting
Tier 2 (Server): API Server & Data Store
E. Diagramming Guidelines
Components & Labels
• Rectangles for Frontend and Backend services.
Sketch the top-level view
[User/Browser] → [React SPA (Firebase Hosting)] → [Express API Server] → [JSON Data Store]
• src/pages (InventoryPanel, BillingModal, Reports)
• src/components (TableCard, NavigationBar)
A side-note on deployment
Vite (build) → firebase.json → Firebase Hosting