How chaimaalachhab/marketplace-artisanat-marocain works
Project Type and Purpose
• This is a full-stack web application called “Marketplace-Artisanat-Marocain,” providing an online marketplace for Moroccan artisan products.
• The backend is a monolithic Spring Boot service exposing REST endpoints, handling business logic, persistence (with Flyway database migrations), security (JWT, Spring Security), image uploads (via Cloudinary), and email notifications.
• The frontend is a single-page Angular application structured into core services/DTOs, feature modules (auth, cart, loyalty, media, orders, reviews, sub-orders), and shared UI components/pages.
Key Components
a. Frontend Layer (Angular SPA)
• Core Services & Interceptors (authentication, JWT interceptor).
• Feature Modules (Auth, Cart, Orders, Products, Reviews, Loyalty, Media, Sub-Orders).
• Shared UI Components/Pages (Header/Footer, Home, Product Listing/Details, Dashboard, User Profile, etc.).
b. Backend Layer (Spring Boot Monolith)
• Configuration & Security (ApplicationConfiguration, WebConfig, JwtAuthenticationFilter, SecurityConfiguration).
• Controllers (REST endpoints grouped by domain: Authentication, Product, Cart, Order, Review, etc.).
• Service Layer (business logic, including EmailService, CloudinaryService, JwtService, NotificationService).
• Data Access Layer (Spring Data JPA repositories).
• DTOs/Models and Mappers (entity↔DTO mapping).
• Persistence (Flyway migrations under db/migration, application.yml/properties).
c. Database
• Relational database (e.g., PostgreSQL/MySQL) initialized via Flyway SQL scripts.
d. External Services
• Cloudinary (for media storage).
• SMTP/email provider (for verification & notification emails).
• (Optionally) Third-party analytics or payment gateways if used.
e. DevOps & Deployment
• Dockerfiles for frontend and backend, docker-compose.yml orchestrating services.
• Jenkinsfile for CI/CD pipeline.
Relationships and Data Flows
• Frontend sends HTTP(S) requests to the Backend’s REST API.
• Backend authenticates users via JWT (tokens issued by AuthenticationController/JwtService).
• Business flows: e.g., “Add to Cart” calls CartController → CartService → CartRepository → DB.
• Media upload flows: Frontend uploads file → Backend CloudinaryService → Cloudinary API → return URL.
• Email flows: Backend EmailService → SMTP provider → User inbox.
• Database migrations execute at startup via Flyway before the application serves requests.
Architectural Patterns & Design Principles
• Layered architecture: Presentation (Controllers), Business (Services), Persistence (Repositories), Mapping (DTO/Mappers).
• Dependency Injection (Spring and Angular DI).
• RESTful API design for frontend–backend communication.
• JWT stateless authentication.
• Module-based separation on the frontend (feature modules, shared modules).
Detail Level
• Be explicit about the major endpoints (AuthController, ProductController, CartController, etc.).
• Security flow (authentication → JWT → secured endpoints).