How rebecca-roussel/ecoride works
1. Overall shape
EcoRide is a Symfony 7 application built as a classic server-rendered stack: HTTP requests enter through Nginx, are handled by PHP-FPM, routed to Symfony controllers, and rendered mainly with Twig templates.
2. Request flow
The main runtime path is: browser → Nginx → public/index.php → controller → service layer → PostgreSQL/MongoDB/email/geocoding as needed → Twig view → HTML response. The architecture is centered on synchronous server-side rendering rather than an API-first front end.
3. Presentation layer
The UI lives in templates/ and public/. Twig handles page composition, fragments, and email templates; public/css and public/js contain page-specific assets for features like login, geocoding suggestions, results, profiles, roles, and dashboards. Static files are served directly by Nginx.
4. Controller layer
src/Controller/ is organized by business journey: public pages (Accueil, Contact, MentionsLegales, Credits), identity flows (Connexion, Inscription, MotDePasseOublie, ReinitialiserMotDePasse), ride flows (Recherche, Resultats, Details, PublierCovoiturage, ParticiperCovoiturage), account/vehicle management (Profil, TableauDeBord, GererVehicules, Historique), and back-office areas (EspaceEmploye, EspaceAdmin, GererRoles). ApiGeocodageController is the main HTTP endpoint for autocomplete/geocoding behavior.
5. Service layer
src/Service/ contains the actual business and persistence logic. The code deliberately avoids an ORM: services use PDO-based PostgreSQL access and keep SQL explicit. The service set is split by concern: connection handling, user session state, emailing, address geocoding, event logging, and per-domain persistence services.
6. Primary data store: PostgreSQL
PostgreSQL holds the structured business data: users, vehicles, rides, participations, credits, history, password reset state, and admin/employe-related records. The README indicates that important invariants are enforced in the database itself with constraints, functions, and triggers, so some business rules live below the application layer.
7. Secondary data store: MongoDB
MongoDB is used as an operational event journal rather than the main business database. It records chronological events such as logins, participations, incidents, moderation actions, and suspensions. This makes the architecture split between transactional business data in PostgreSQL and trace/audit data in MongoDB.
8. Mail and external integrations
EnvoiCourriels supports email-based workflows such as password reset and ride validation/cancellation. In local development the app uses MailHog, so email delivery is observable without sending real mail. GeocodageAdresse powers address lookup/suggestions for ride publication and search.
9. Security and session boundary
Authentication/session state is handled explicitly through SessionUtilisateur. The app uses password hashing, CSRF protection in forms, reset tokens with limited lifetime, and a set of HTTP security headers configured at the web server level. Environment secrets are kept in .env variants rather than in code.
10. Runtime and deployment
The repo is container-first. Docker Compose orchestrates Nginx, PHP-FPM, PostgreSQL, MongoDB, and MailHog in development; a production compose file and Nginx production config provide the deployment boundary. Code is mounted read-only into Nginx in production, and DBs are kept off the public network.
11. Build, test, and release support
GitHub Actions workflows support continuous integration and deployment. Tests live under tests/ and include application-level checks plus database connectivity tests. The docs/sql/ scripts initialize the schema and demo data, and the docker/sauvegardes/ scripts handle backup/restore of PostgreSQL and MongoDB.
12. Documentation as part of the architecture
The repository is unusually documentation-heavy: generated code docs, UML, data-model diagrams, UI mockups, deployment notes, and user manuals all exist alongside the code. For architecture diagramming, this indicates the project was designed with explicit separation between business workflows, data model, and operational deployment.
Main entry points: templates Twig views · routes.yaml Routing · ConnexionController.php Identity · RechercheController.php Ride flows
Components 23
Presentation
Twig pages and browser assets rendered by Symfony.
- Twig views · Server-rendered pages, fragments, and email templates.
templates - Stylesheets · Page-specific CSS for public and authenticated screens.
public/css - Client scripts · Browser behavior for forms, suggestions, dashboards, and navigation.
public/js - Photos · User-uploaded vehicle or profile imagery served statically.
public/photos
HTTP & App
Front controller, routing, and business-facing controllers.
- Front controller · HTTP requests enter here before Symfony routing and controller dispatch.
public/index.php - Kernel · Application bootstrap and bundle/runtime wiring.
src/Kernel.php - Routing · Maps incoming paths to controllers and framework endpoints.
config/routes.yaml - Public pages · Landing and legal pages for anonymous visitors.
src/Controller/AccueilController.php - Identity · Login, registration, and password reset flows.
src/Controller/ConnexionController.php - Ride flows · Search, results, details, publishing, and participation journeys.
src/Controller/RechercheController.php - Account area · Profile, dashboard, vehicle, and history management.
src/Controller/ProfilController.php - Back office · Employee and admin moderation, roles, and operational review.
src/Controller/EspaceAdminController.php - Geocoding API · Autocomplete and address lookup endpoint used by ride forms.
src/Controller/ApiGeocodageController.php
Services
Business logic, persistence adapters, and external integrations.
- Session state · Explicit user session and authentication state handling.
src/Service/SessionUtilisateur.php - PostgreSQL access · PDO connection and explicit SQL execution against the main database.
src/Service/ConnexionPostgresql.php - Persistence layer · Per-domain PostgreSQL persistence for users, rides, vehicles, credits, history, and resets.
src/Service/PersistanceUtilisateurPostgresql.php - Mail service · Sends password reset and ride validation/cancellation emails.
src/Service/EnvoiCourriels.php - Geocoding · Address lookup and suggestion logic for search and ride publication.
src/Service/GeocodageAdresse.php - Event journal · Chronological operational logging for logins, participations, incidents, and moderation.
src/Service/JournalEvenements.php
Data & Ops
Datastores, deployment, and release support.
- SQL schema · Database structure, constraints, functions, triggers, and demo data source.
docs/sql/01_schema.sql - Compose stack · Container orchestration for Nginx, PHP-FPM, PostgreSQL, MongoDB, and MailHog.
docker-compose.yaml - Prod stack · Production compose boundary and Nginx production configuration.
docker-compose.production.yaml - CI/CD · GitHub Actions workflows for integration and deployment.
.github/workflows/deploiement_continu.yml
Connections 30
- Front controller → Kernel: boots · Symfony runtime is initialized from the front controller.
- Front controller → Routing: dispatches via · Incoming requests are matched to routes before controller execution.
- Routing → Public pages: maps to · Public pages are routed to their controllers.
- Routing → Identity: maps to · Authentication and reset flows are routed here.
- Routing → Ride flows: maps to · Ride search and participation journeys are routed here.
- Routing → Account area: maps to · Account and dashboard screens are routed here.
- Routing → Back office: maps to · Employee and admin paths are routed here.
- Routing → Geocoding API: maps to · Autocomplete and geocoding requests are routed here.
- Public pages → Twig views: renders · Controllers return Twig views for server-side HTML.
- Identity → Twig views: renders · Identity screens and email-related templates are rendered here.
- Ride flows → Twig views: renders · Ride journeys are rendered as Twig pages and fragments.
- Account area → Twig views: renders · Account and dashboard screens use Twig templates.
- Back office → Twig views: renders · Back-office screens are server-rendered.
- Identity → Session state: uses · Authentication and reset flows rely on explicit session state.
- Ride flows → Geocoding: uses · Ride forms and search use address lookup suggestions.
- Identity → Mail service: uses · Password reset and validation emails are sent through mail services.
- Ride flows → Persistence layer: uses · Ride creation, results, and participation are backed by persistence adapters.
- Account area → Persistence layer: uses · Profile, vehicles, and history are loaded and updated through persistence.
- Back office → Event journal: reads events · Moderation and employee views inspect operational event history.
- Persistence layer → PostgreSQL access: executes SQL · Domain adapters share the explicit PostgreSQL connection layer.
- Persistence layer → SQL schema: relies on · Business invariants are enforced by SQL constraints, functions, and triggers.
- Event journal → SQL schema: separates from · Operational event history is modeled alongside the relational schema boundary.
- Twig views → Stylesheets: pairs with · Rendered pages are styled by page-specific CSS assets.
- Twig views → Client scripts: enhanced by · Interactive screens use browser-side scripts for form behavior and suggestions.
- Twig views → Photos: references · Views can display user-uploaded images.
- Compose stack → Front controller: serves · Nginx and PHP-FPM expose the server-rendered application.
- Compose stack → PostgreSQL access: provides · The compose stack includes PostgreSQL and related services used by the app.
- Compose stack → Event journal: provides · Operational event storage is backed by the container stack.
- Prod stack → Compose stack: specializes · Production deployment refines the development container boundary.
- CI/CD → Prod stack: deploys · Workflow automation targets the production deployment stack.