How mehdi-devops-cv/cloud-devops-project works
1. This is a monorepo for an “AppBTP” construction/project-management system with three product surfaces: a Node/Express backend API, a React web frontend, and an Expo/React Native mobile app. The backend is the shared system-of-record; both clients consume it over HTTP.
2. The backend lives in backend/src. app.js assembles the Express app, db.js handles MongoDB connectivity, and middlewares/ centralizes auth, admin checks, and error handling. The API is organized by domain routes rather than by UI concerns, which makes it the main architectural boundary.
3. Authentication and user control are a distinct subsystem: routes/auth.js, models/User.js, middlewares/auth.js, and middlewares/isAdmin.js. The README confirms JWT-based login/register/logout/user endpoints, with bcrypt-based password hashing. This is the security boundary for all protected business routes.
4. The core business domain is split across several MongoDB models and routes: Effectif for workforce tracking, Note and Remarque for annotations, Constatation for inspections/findings, Building and City for reference/master data, and Folder/FolderPhoto for document/photo grouping. Routes mirror those domains: effectifs, notes, remarques, constatations, reference, folders, and upload.
5. There is an admin/reference-data layer separate from end-user operations. routes/admin.js and the seed scripts in backend/scripts/ (create_admin.js, create_user.js, add_cities.js, add_buildings.js, list_users.js) indicate the app expects controlled provisioning of users and reference entities, likely used during environment setup and operational maintenance.
6. Media handling is its own concern. The presence of upload.js, FolderPhoto.js, and the utils/avatar.js helper suggests the backend manages user avatars and project photos/documents as first-class records, not just text data. This is likely one of the main integration points between mobile/web capture flows and persistence.
7. The web frontend in frontend/ is a Vite + React application. src/config/api.js centralizes backend endpoint configuration, context/AuthContext.jsx manages session state, and utils/storage.js likely abstracts token/local storage. The main pages are Home, Login, Dashboard, and RapportPhoto, indicating a relatively focused UI on authentication, overview, and photo/report workflows.
8. The mobile app in mobile/ is a separate Expo React Native client with a richer native packaging footprint (android/, ios/, EAS scripts). Its structure is split into controller-like coordination code under Controleur/ and view/screen code under Vue/, with reusable components in component/ and shared utilities in utils/. It appears to implement the same business flows as the web app, but optimized for on-site use.
9. The mobile app also includes role/session/navigation infrastructure: UserRoleContext, TabContext, custom navigation helpers, splash/transition UI, and locale assets (locales/fr.json). That suggests the mobile client is not just a thin shell; it has its own presentation state and role-aware navigation while still relying on the backend API for data.
10. Persistence is MongoDB Atlas, per the README, with Mongoose-style models in the backend. The architecture is therefore API-centric: both clients call the backend, the backend validates/authenticates, then reads/writes domain documents in MongoDB. There is no evidence of a separate frontend-owned state store beyond local auth/session storage.
11. Infrastructure is handled in layers. infra/ contains Terraform modules for network, compute, storage, and iam, implying cloud resources are provisioned as code. Separately, docker/ and the root docker-compose*.yml provide containerized local/runtime environments, including backend, frontend, nginx, and Jenkins images.
12. CI/CD is explicitly split by surface with Jenkinsfile.backend, Jenkinsfile.frontend, and Jenkinsfile.mobile. That means each client/backend can be built and deployed independently, while still sharing a common repository and infrastructure conventions. For an architecture diagram, this repo should be drawn as one platform with three deployable applications plus shared infrastructure and automation around them.
Main entry points: app.js Express app · main.jsx React entry · index.js Domain models · auth.js Auth API
Components 30
Platform
Shared backend, clients, infrastructure, and delivery automation
- Terraform · Cloud infrastructure as code
infra/main.tf - Compose stack · Local containerized backend, frontend, and nginx services
docker-compose.yml - Backend CI · Jenkins pipeline for backend build and deploy
Jenkinsfile.backend - Frontend CI · Jenkins pipeline for web client build and deploy
Jenkinsfile.frontend - Mobile CI · Jenkins pipeline for mobile build and submission
Jenkinsfile.mobile
Backend API
Express application and MongoDB domain layer
- Express app · Assembles middleware and domain routes
backend/src/app.js - MongoDB · Initializes database connectivity
backend/src/db.js - Auth API · Login, register, logout, and user session endpoints
backend/src/routes/auth.js - Auth guard · Protects authenticated business routes
backend/src/middlewares/auth.js - User model · User identity and roles
backend/src/models/User.js - Domain models · Shared persistence for core business entities
backend/src/models/index.js - Effectifs · Workforce tracking endpoints
backend/src/routes/effectifs.js - Reference data · Master data for buildings and cities
backend/src/routes/reference.js - Folders · Document and photo grouping endpoints
backend/src/routes/folders.js - Media upload · Handles avatar and project file uploads
backend/src/routes/upload.js - Admin API · Controlled provisioning and maintenance endpoints
backend/src/routes/admin.js - Error handler · Central API error handling
backend/src/middlewares/errorHandler.js - Avatar util · Avatar and profile media helper
backend/src/utils/avatar.js - Seed admin · Provisioning script for initial admin setup
backend/scripts/create_admin.js
Web App
React/Vite client for browser workflows
- React entry · Vite/React application entry point
frontend/src/main.jsx - Session state · Manages browser auth state
frontend/src/context/AuthContext.jsx - API config · Central backend endpoint configuration
frontend/src/config/api.js - Dashboard · Main authenticated overview
frontend/src/pages/Dashboard.jsx - Photo report · Photo/report workflow screen
frontend/src/pages/RapportPhoto.jsx
Mobile App
Expo/React Native client for field workflows
- Expo app · React Native application entry point
mobile/App.tsx - App wrapper · Top-level mobile composition and layout
mobile/Controleur/AppWrapper.js - Role context · Role-aware session state
mobile/Controleur/UserRoleContext.js - Tab context · Navigation and tab coordination
mobile/Controleur/TabContext.js - Home screen · Primary mobile landing page
mobile/Vue/HomePage.js - Photo report · Mobile capture and reporting flow
mobile/Vue/RapportPhoto.js
Connections 35
- Express app → MongoDB: connects · Initializes MongoDB access during app startup
- Express app → Auth API: mounts · Registers authentication endpoints
- Express app → Effectifs: mounts · Registers workforce routes
- Express app → Reference data: mounts · Registers reference-data routes
- Express app → Folders: mounts · Registers folder routes
- Express app → Media upload: mounts · Registers upload routes
- Express app → Admin API: mounts · Registers admin routes
- Express app → Error handler: uses · Routes errors through central handler
- Auth API → Auth guard: protects · Uses auth middleware for protected operations
- Auth API → User model: reads/writes · Authenticates and persists users
- Auth API → Domain models: depends on · Shares domain persistence layer
- Effectifs → Domain models: reads/writes · Persists workforce records
- Reference data → Domain models: reads/writes · Accesses master/reference entities
- Folders → Domain models: reads/writes · Persists folder and media records
- Media upload → Avatar util: uses · Supports avatar handling
- Media upload → Domain models: reads/writes · Stores uploaded media metadata
- Admin API → Auth guard: guards · Restricts admin operations
- Admin API → Seed admin: influences · Matches provisioning and maintenance scripts
- React entry → Session state: wraps · Provides auth/session context to the app
- React entry → API config: configures · Injects backend endpoint configuration
- React entry → Dashboard: routes to · Opens authenticated dashboard flow
- Dashboard → Photo report: navigates to · Links into photo/report workflow
- Session state → API config: uses · Calls backend for login/session actions
- Expo app → App wrapper: boots · Initial mobile shell and layout
- App wrapper → Role context: provides · Makes role state available to screens
- App wrapper → Tab context: provides · Coordinates navigation state
- App wrapper → Home screen: shows · Starts on the main home screen
- Home screen → Photo report: navigates to · Opens photo/report workflow
- Terraform → MongoDB: provisions · Defines supporting cloud resources for persistence and runtime
- Terraform → Compose stack: complements · Infrastructure pairs with local container orchestration
- Compose stack → Express app: runs · Starts backend containerized service
- Compose stack → React entry: runs · Starts frontend containerized service
- Backend CI → Express app: builds · Backend pipeline packages and deploys the API
- Frontend CI → React entry: builds · Frontend pipeline packages and deploys the web app
- Mobile CI → Expo app: builds · Mobile pipeline builds and submits the app