How sebiche09/app-anti-gaspillage works
Main High-Level Components
• Frontend:
• Flutter-based client with separate sub-components for mobile (iOS and Android) and web.
• That the frontend code is organized under a "frontend" directory with separate configurations for Android and iOS.
• Backend:
• A Go-based API server containing distinct layers:
▪ API Handlers (in the “backend/api/handlers” folder) – this is where HTTP endpoints are implemented (for baskets, invitations, merchants, restaurants, and users).
▪ Request/Response structs (in “backend/api/requests” and “backend/api/responses”) – defining the data exchanged between client and server.
▪ Middlewares (authentication and others under “backend/middlewares”) – intercept requests for security and other cross-cutting concerns.
▪ Domain Models (in “backend/models”) – representing the core data entities such as basket, merchant, restaurant, user, etc.
▪ Repositories (in “backend/repositories”) – for data persistence operations with the PostgreSQL database.
▪ Business Services (in “backend/services”) – containing the core business logic (e.g., basket_service, email_service) that orchestrate the domain operations.
▪ Routing (set up in “backend/routes”) – where HTTP routing and endpoint linking take place.
• Database:
• PostgreSQL is mentioned explicitly in the README as the database used.
• It as a relational database connected to the backend, handling persistence for merchants, users, orders, etc.
• Containerization & Deployment:
• Dockerfiles exist for both the backend and frontend (and a separate one for the database in “db/Dockerfile”).
• A “docker-compose.yml” file orchestrates the multi-container setup.
• Devcontainer configuration for developer-specific environments.
Relationships and Data Flow between the Components
• Frontend to Backend:
• Backend Internal Layers:
• That error handling, authentication middleware, and model validation layers are also noted where relevant.
• Backend to Database:
• Docker Containerization:
• A container boundary for each major service (backend container, frontend container, and database container) to show deployment separation.
Architectural Patterns and Key Design Principles
• Layered Architecture:
• Separation of concerns in the backend through distinct packages (API, models, repositories, services, middlewares, tests).
• Microservices vs. Monolith:
• Although the code structure in the backend is modular, the project appears to be built as a single service rather than many independent microservices.
• API-first and RESTful Design:
• That API Handlers facilitate REST endpoints for client communications.
• Testability:
• Briefly note the presence of tests (unit, integration, repository tests) which support continuous quality assurance.
Important Technologies, Frameworks, and Libraries
• Backend: Go (version specified, e.g., 1.23.4), along with modules for JWT handling, documentation (Swagger in “backend/docs”), and likely a PostgreSQL driver.
• Frontend: Flutter (with the standard structure for mobile and web), along with Dart files for UI, models, providers, and services.
• Database: PostgreSQL, managed and orchestrated with Docker.
• Clear Labels: Identify each component clearly (e.g., “Flutter Mobile Client”, “Flutter Web App”, “Go API Server”, “PostgreSQL Database”).
▪ From frontend to backend,
▪ Within the backend: Handlers → Services → Repositories,
▪ From repositories to the database.
▪ Rectangles for application components (frontend and backend),
• Annotations: Optionally include configuration files and test modules as side components to indicate development and CI/CD integrations.