How molk95/campconnect_backend works
1. Overall shape
- CampConnect Backend is a single Spring Boot 3 monolith written in Java 17, organized into many domain packages under com.esprit.campconnect.
- It follows a consistent layered pattern: controller → service → repository → entity/DTO, with MySQL persistence via Spring Data JPA.
2. Request/data flow
- Incoming HTTP requests enter domain-specific controllers.
- Controllers map request/response DTOs and delegate to service implementations.
- Services contain business rules, orchestrate repositories, and sometimes call external services.
- Repositories persist JPA entities into MySQL 8.
- Several domains also emit derived outputs such as PDFs, emails, notifications, exports, or real-time updates.
3. Core platform and shared infrastructure
- The common and config packages provide cross-cutting concerns: global exception handling, email and Cloudinary helpers, CORS/Web config, WebSocket config, Stripe and Google Maps properties, and calendar export settings.
- Swagger/OpenAPI is exposed for API exploration.
- The backend runs on port 8082 behind the /api context path as described in the README.
4. Identity and access control
- The Auth and User modules form the identity boundary.
- Auth contains JWT security (JwtAuthenticationFilter, JwtService, SecurityConfig), login/register, password reset, Google login, and two-factor authentication.
- User owns profiles, users, and role-related data.
- This module is the main authentication gate for the rest of the application.
5. Reservations and camping sites
- siteCamping, Reservation, InscriptionSite, and siteCampingAvis are the main camping-booking context.
- siteCamping manages campsite inventory and recommendations.
- Reservation manages booking lifecycle, promotion offers, payments, cancellation policies, notifications, calendar/export features, and maintenance/backfill jobs.
- InscriptionSite handles campsite registration flows and Stripe checkout/ticket generation.
- siteCampingAvis stores reviews and ratings for campsites.
6. Events and event insurance
- Event manages event creation, lifecycle scheduling, image storage, favorites, and file uploads.
- Reservation and Event are connected by booking/payment workflows, especially through Stripe/webhook-style flows.
- Assurance is a separate insurance bounded context for events, with underwriting/subscription, claims (Sinistre), reimbursements, guarantees, document management, weather checks, and AI-assisted analysis.
- This module includes schedulers and AI/weather integration, making it more than simple CRUD.
7. Marketplace and fulfillment
- MarketPlace is split into product catalog, cart, order, order details, payments, checkout verification codes, and marketplace statistics.
- Restauration covers meal ordering, line items, notifications, and image hosting for meals.
- Livraison handles delivery dispatch, courier location tracking, tips, wallet/withdrawals, and delivery pricing.
- Livraison/demo suggests a self-contained demo flow with geocoding and weather-based pricing surcharges.
8. Content, social, and communication modules
- Publication, forum, commentaire, and Reclamation provide social/content and support workflows.
- Notification and multiple notification submodules capture user-facing alerts across domains.
- Mail centralizes email delivery, likely reused by reservation, delivery, and support flows.
- These modules act as secondary outputs from the core business actions rather than standalone systems.
9. Training and AI-assisted learning
- Formation is a rich subsystem for training content, media, quizzes, progress tracking, rewards, statistics, and schema/DB alignment utilities.
- It includes dedicated AI generation services and interactive guide flows.
- This module has its own repositories, stats projections, and system-level services, indicating a sizable internal product area.
10. External services and integrations
- Payment flows integrate with Stripe in multiple domains.
- Media and image storage uses Cloudinary.
- Location and mapping features integrate with Google Maps and OpenStreetMap.
- Weather-aware logic appears in both insurance and delivery/demo contexts.
- Notification and security features rely on email, SMS, and JWT-based auth.
11. Background jobs and automated maintenance
- Several services are scheduled or maintenance-oriented: event lifecycle, reservation maintenance, insurance expiration, schema backfills, promotion seeding, and data cleanup.
- These jobs mutate domain state without direct user requests, so they are important architecture boundaries when drawing data flow.
12. Deployment, ops, and observability
- Local and containerized deployment is supported through Docker and Docker Compose; MySQL and phpMyAdmin are included in the dev stack.
- CI/CD is built around Jenkins, with SonarQube analysis configured.
- Production-style infrastructure includes Kubernetes manifests, Ansible playbooks, and monitoring with Prometheus and Grafana.
- The repository therefore contains both application code and operational assets, not just backend logic.
Main entry points: ReservationController.java Reservation · LivraisonController.java Livraison · AuthController.java Auth · NotificationUserController.java Notification
Components 24
Core platform
Application bootstrap, identity, shared config, and cross-cutting services.
- Backend App · Main Java 17 application entrypoint.
src/main/java/com/esprit/campconnect/CampConnectApplication.java - Auth · Login, register, reset password, Google login, and two-factor auth.
src/main/java/com/esprit/campconnect/Auth/Controller/AuthController.java - Security · Authentication filter, JWT service, user details, and security configuration.
src/main/java/com/esprit/campconnect/Auth/Security/SecurityConfig.java - User · Users, profiles, roles, and profile DTO mapping.
src/main/java/com/esprit/campconnect/User/Controller/UtilisateurController.java - Common · Global exceptions, email, Cloudinary, and shared templates.
src/main/java/com/esprit/campconnect/common/GlobalExceptionHandler.java - Config · CORS, web, websocket, Google Maps, Stripe, and calendar properties.
src/main/java/com/esprit/campconnect/config/WebConfig.java
Camping booking
Site inventory, campsite registration, reservations, and reviews.
- Site Camping · Camping site CRUD, availability, and recommendation logic.
src/main/java/com/esprit/campconnect/siteCamping/controller/SiteCampingController.java - Reservation · Reservations, promotions, payment sync, exports, notifications, and maintenance jobs.
src/main/java/com/esprit/campconnect/Reservation/Controller/ReservationController.java - Inscription Site · Camping registration flow with Stripe checkout and ticket PDF generation.
src/main/java/com/esprit/campconnect/InscriptionSite/controller/InscriptionSiteController.java - Avis · Camping reviews, ratings, and admin review views.
src/main/java/com/esprit/campconnect/SiteCampingAvis/controller/SiteCampingAvisController.java
Events & insurance
Event lifecycle, booking linkage, and event insurance workflows.
- Event · Event creation, favorites, lifecycle scheduling, and image storage.
src/main/java/com/esprit/campconnect/Event/Controller/EventController.java - Assurance · Insurance subscriptions, claims, reimbursements, guarantees, documents, weather, and AI.
src/main/java/com/esprit/campconnect/Assurance/Controller/AssuranceController.java
Marketplace & delivery
Commerce, payment, kitchen, and fulfillment flows.
- Marketplace · Products, carts, orders, order details, payments, checkout verification, and stats.
src/main/java/com/esprit/campconnect/MarketPlace/Produit/Controller/ProduitController.java - Restauration · Meals, meal orders, line items, notifications, and image hosting.
src/main/java/com/esprit/campconnect/Restauration/Controller/RepasController.java - Livraison · Delivery assignment, location tracking, tips, wallet, withdrawals, and pricing.
src/main/java/com/esprit/campconnect/Livraison/controller/LivraisonController.java - Demo Flow · Self-contained delivery demo with geocoding, weather surcharge, and demo checkout.
src/main/java/com/esprit/campconnect/Livraison/demo/controller/DemoController.java
Community & support
Social, forum, comments, reclamations, and notifications.
- Publication · Publications and admin moderation.
src/main/java/com/esprit/campconnect/Publication/controller/PublicationController.java - Forum · Forum threads and admin forum moderation.
src/main/java/com/esprit/campconnect/forum/controller/ForumController.java - Commentaire · Comment creation and admin moderation for content workflows.
src/main/java/com/esprit/campconnect/commentaire/controller/CommentaireController.java - Reclamation · Support requests, complaint notifications, and unread counts.
src/main/java/com/esprit/campconnect/Reclamation/Controller/ReclamationController.java - Notification · User-facing notification persistence and delivery surface.
src/main/java/com/esprit/campconnect/Notification/Controller/NotificationUserController.java - Mail · Centralized email service reused by booking and fulfillment flows.
src/main/java/com/esprit/campconnect/Mail/Service/MailServiceImp.java
Training platform
Formation content, guides, AI generation, stats, and system alignment.
- Formation · Training content, media, quizzes, stats, AI generation, and guide flows.
src/main/java/com/esprit/campconnect/Formation/controller/FormationController.java
Ops & delivery
Database scripts, CI/CD, containerization, monitoring, and deployment assets.
- DevOps · Docker, Compose, Kubernetes, Jenkins, Ansible, Prometheus, Grafana, and database assets.
devops/k8s/backend.yaml
Connections 27
- Backend App → Auth: bootstraps · Application starts security and auth endpoints.
- Backend App → Config: loads · Startup wiring for web, maps, Stripe, and sockets.
- Auth → Security: uses · Authentication flows rely on JWT filter and security config.
- Auth → User: identifies · Auth resolves user and profile identity data.
- Auth → Common: shares · Auth reuses global error handling and email helpers.
- Site Camping → Reservation: feeds · Reservations consume campsite availability and site data.
- Site Camping → Avis: informs · Reviews and ratings attach to camping sites.
- Reservation → Notification: emits · Booking lifecycle produces user alerts.
- Reservation → Mail: sends · Reservation confirmations and updates use email templates.
- Reservation → Config: integrates · Uses calendar export and Stripe settings.
- Inscription Site → Reservation: aligns · Site onboarding connects to booking/payment logic.
- Event → Assurance: pairs · Events can be protected by event insurance flows.
- Event → Reservation: books · Event booking and payment sync cross the reservation boundary.
- Marketplace → Restauration: supplies · Marketplace-style ordering overlaps with meal ordering flows.
- Marketplace → Livraison: fulfills · Orders are dispatched through delivery workflows.
- Restauration → Livraison: dispatches · Meal orders can move into delivery tracking.
- Livraison → Notification: alerts · Delivery status and courier updates generate notifications.
- Livraison → Config: maps · Geocoding and location features depend on maps config.
- Demo Flow → Livraison: prototypes · Demo flow models delivery pricing and checkout behavior.
- Publication → Forum: publishes · Content and discussion are adjacent community surfaces.
- Forum → Commentaire: hosts · Forums and comments form the discussion layer.
- Reclamation → Notification: raises · Support workflows create complaint notifications.
- Formation → Common: uses · Learning flows reuse shared utilities and storage support.
- Formation → Notification: rewards · Guide progress and rewards can notify users.
- DevOps → Backend App: deploys · Infrastructure assets package and run the backend.
- DevOps → Reservation: maintains · Database scripts and jobs support reservation data evolution.
- DevOps → Formation: observes · Monitoring and schema alignment support the learning subsystem.