How ninobaw/aero-doc-flow-enfidha works
Project Type & Purpose
• This is a full-stack web application (monorepo) for document and process management (actions, correspondances, reports, QR code lifecycles, etc.).
• Frontend: a React + TypeScript SPA built with Vite, Tailwind CSS, and shadcn-ui.
• Backend: a Node.js/Express REST API; data is stored in a Supabase (PostgreSQL) database.
High-Level Components
A. Frontend Service
• Vite Dev Server / Static Host
• React App (src/main.tsx → App.tsx)
• Feature modules (src/pages, src/components, src/contexts, src/hooks, src/shared)
• UI library: shadcn-ui + Tailwind CSS (tailwind.config.ts)
B. Backend Service
• Node.js + Express (backend/src/server.js)
• Routes layer (backend/src/routes/*.js/.ts)
• Data models (backend/src/models/*.js)
• Database connection (backend/src/db.js)
• Seed script (backend/src/seed.js)
C. Database
• Supabase-hosted PostgreSQL (configured via supabase/config.toml)
• Tables mirror models: User, Document, Correspondance, Action, Report, etc.
D. External & Infra Tools
• Supabase CLI (migrations & config)
• Environment (.env)
• Deployment (Lovable platform, custom domain)
Component Relationships & Data Flow
1. Browser requests index.html → Vite serves the SPA
2. React components (pages/hooks) invoke HTTP calls (fetch/Axios) →
3. Node/Express API endpoints (auth, user, document, actionRoutes, etc.) →
4. db.js issues SQL queries to Supabase PostgreSQL →
5. Responses travel back up to React, updating UI via contexts/hooks.
Architectural Patterns & Design Principles
• Monorepo structure: /src (frontend) + /backend (API) in one repo.
• MVC-ish backend: Models (in /models), Controllers (in /routes), and a single server.js.
• Component-driven UI: atomic and feature components in /components + custom hooks in /hooks.
• Context for global state (AuthContext).
• Clear separation: UI vs. business logic vs. persistence.
• Use of TypeScript typings (src/types, tsconfig files).
Final Advice
• Every top-level directory as a sub-component (e.g., src/pages vs. src/components).
• Files end-to-end: App.tsx → authRoutes.js → User model → users table.
• Don’t over-optimize: more components and clear data flows trump minimalism here.