# mauzg19/proyecto-restaurante architecture

> Architecture diagram of the GitHub repository mauzg19/proyecto-restaurante, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mauzg19/proyecto-restaurante
- Repository: https://github.com/mauzg19/proyecto-restaurante

## Overview

##### Project type and purpose
- This is a full-stack online restaurant ordering system. The React-based frontend (frontend-react) provides customer, admin and super-admin UIs. The Spring Boot backend (backend-spring-boot) exposes REST APIs for authentication, menu management, ordering, payments (via Stripe), notifications (via email), reviews, etc. A MySQL database stores persistent data.

##### File structure
- Top-level modules:
- frontend-react – React app with Redux state slices for customers, admins and super-admins, Nginx config and Dockerfile.
- backend-spring-boot – Spring Boot app with controllers, services, repositories, models, DTOs, config (JWT, email, Stripe), Dockerfile, Maven wrapper.
- docker-compose.yml – orchestrates backend, frontend, and MySQL containers in Docker.
- Patterns & configs:
- MVC style in Spring Boot (controllers → services → repositories).
- Redux/Flux in React (ActionCreators → Reducers → Store).
- JWT-based authentication.
- External integrations: Stripe payment gateway, SMTP email.
- Docker & Docker Compose for containerized deployment.

##### README for additional insights
- Backend requires Java 17, MySQL setup, application.properties holds DB, Stripe and email credentials.
- Frontend runs via npm / npm start.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Containers orchestrated by Docker Compose
    subgraph "Docker Compose" 
        direction TB
        %% Frontend Container
        subgraph "frontend-react Container" 
            direction TB
            NGINX["Nginx (Reverse Proxy & Static)"]:::frontend
            REACT["React Frontend"]:::frontend
        end

        %% Backend Container
        subgraph "backend-spring-boot Container"
            direction TB
            SB_APP["Spring Boot API"]:::backend
        end

        %% Database Container
        MYSQL["MySQL Database"]:::database
    end

    %% External Services
    STRIPE["Stripe Payment Gateway"]:::external
    SMTP["SMTP Email Service"]:::external

    %% Client Interaction
    Browser["Customer/Admin/Super-admin Browser"]:::external
    Browser -->|"HTTP/HTTPS"| NGINX
    NGINX -->|serves static| REACT
    REACT -->|"API Calls via api.js"| SB_APP
    SB_APP -->|"JPA CRUD"| MYSQL
    SB_APP -->|"Payment Requests"| STRIPE
    SB_APP -->|"Email Notifications"| SMTP

    %% React Frontend Internal Structure
    subgraph "React Frontend" 
        direction TB
        ROUTERS["React Router Modules"]:::frontend
        API_CLIENT["API Client Helper (api.js)"]:::frontend
        subgraph "Redux Store" 
            direction TB
            STORE["Store Configuration"]:::frontend
            subgraph "Slices"
                CUSTOMERS["Customer Slices"]:::frontend
                ADMINS["Admin Slices"]:::frontend
                SUPERS["Super-Admin Slices"]:::frontend
            end
        end
        subgraph "UI Components"
            direction TB
            CUST_UI["Customer UI"]:::frontend
            ADMIN_UI["Admin UI"]:::frontend
            SUPER_UI["Super-Admin UI"]:::frontend
        end
    end

    REACT --> ROUTERS
    REACT --> API_CLIENT
    API_CLIENT --> STORE
    STORE --> CUSTOMERS
    STORE --> ADMINS
    STORE --> SUPERS
    ROUTERS --> CUST_UI
    ROUTERS --> ADMIN_UI
    ROUTERS --> SUPER_UI

    %% Spring Boot Internal Structure
    subgraph "Spring Boot API" 
        direction TB
        ENTRY["RestaurantApplication.java"]:::backend
        subgraph "Controllers"
            direction TB
            CONTROLLERS["Controller Layer"]:::backend
        end
        subgraph "Services"
            direction TB
            SERVICES["Service Layer"]:::backend
        end
        subgraph "Repositories"
            direction TB
            REPOS["Repository Layer"]:::backend
        end
        subgraph "Models & DTOs"
            direction TB
            MODELS["Domain Models"]:::backend
            DTOS["DTOs"]:::backend
        end
        CONFIG["Config (JWT, Email, Stripe)"]:::backend
        PROPS["application.properties"]:::backend
    end

    SB_APP --> ENTRY
    ENTRY --> CONTROLLERS
    CONTROLLERS --> SERVICES
    SERVICES --> REPOS
    REPOS --> MYSQL
    SERVICES --> CONFIG
    CONFIG --> PROPS

    %% Click Events
    click NGINX "https://github.com/mauzg19/proyecto-restaurante/blob/master/frontend-react/nginx.conf"
    click REACT "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/"
    click ROUTERS "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/src/Routers/"
    click API_CLIENT "https://github.com/mauzg19/proyecto-restaurante/blob/master/frontend-react/src/config/api.js"
    click STORE "https://github.com/mauzg19/proyecto-restaurante/blob/master/frontend-react/src/State/Store/store.js"
    click CUSTOMERS "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/src/State/Customers/"
    click ADMINS "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/src/State/Admin/"
    click SUPERS "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/src/State/SuperAdmin/"
    click CUST_UI "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/src/customers/"
    click ADMIN_UI "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/src/Admin/"
    click SUPER_UI "https://github.com/mauzg19/proyecto-restaurante/tree/master/frontend-react/src/SuperAdmin/"
    click SB_APP "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/"
    click ENTRY "https://github.com/mauzg19/proyecto-restaurante/blob/master/backend-spring-boot/src/main/java/com/Restaurant/RestaurantApplication.java"
    click CONTROLLERS "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/src/main/java/com/Restaurant/controller/"
    click SERVICES "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/src/main/java/com/Restaurant/service/"
    click REPOS "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/src/main/java/com/Restaurant/repository/"
    click MODELS "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/src/main/java/com/Restaurant/model/"
    click DTOS "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/src/main/java/com/Restaurant/dto/"
    click CONFIG "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/src/main/java/com/Restaurant/config/"
    click PROPS "https://github.com/mauzg19/proyecto-restaurante/blob/master/backend-spring-boot/src/main/resources/application.properties"
    click SB_APP "https://github.com/mauzg19/proyecto-restaurante/tree/master/backend-spring-boot/Dockerfile"
    click MYSQL "https://github.com/mauzg19/proyecto-restaurante/blob/master/docker-compose.yml"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#3B82F6,color:#1E40AF
    classDef backend fill:#D1FAE5,stroke:#10B981,color:#047857
    classDef database fill:#FFECD1,stroke:#F59E0B,color:#92400E
    classDef external fill:#FEE2E2,stroke:#EF4444,color:#991B1B
```
