# lkhorasandzhian/restaurant-order-processing-system architecture

> Architecture diagram of the GitHub repository lkhorasandzhian/restaurant-order-processing-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lkhorasandzhian/restaurant-order-processing-system
- Repository: https://github.com/lkhorasandzhian/restaurant-order-processing-system

## Overview

##### Main Components
- Microservice for Order Processing (rops2): This service manages restaurant order functions; its API includes endpoints for managing the restaurant menu (MenuController, TestController). Its structure is similar to “rops”, including models (Dish, User, ERole), payloads, repositories, and similar security and utility classes.
- Demo Microservice (demo): A testing tool for database verification used by developers. It confirms that the database connection (using H2) is working properly.
- Database: The project uses H2 (see the “database” folder), which holds tables such as USERS, SESSION, and DISH.
- Supporting Documentation: The generated JavaDoc directories (“generated-java-doc” and “generated-java-doc2”) provide detailed technical information about the internal API, endpoints, and methods.

##### Architectural Relationships and Data Flow
- Both “rops” and “rops2” are independent microservices but share a common domain context (users and restaurant orders). They might be separately deployed and could use inter-service communication if needed (for example, the order processing microservice could rely on authentication data from the authorization microservice).
- There is a clear separation of concerns: one service handles authentication and session management; the other handles order and menu processing.

##### Architectural Patterns and Design Principles
- Microservices Architecture: Emphasize that services are decoupled, each handling a distinct functionality.
- RESTful API Design: Note the HTTP endpoints (signup, login, user info, role change, menu view) and that each microservice exposes its own API.
- Security and Authentication: Indicate the presence of JWT-based authentication, as shown in the rops and rops2 directories’ security packages.
- Use of Java Spring Framework: Both microservices rely on Spring Boot which handles dependency injection and configuration (e.g., application.properties).

##### Relevant Technologies, Frameworks, and Libraries
- Java Spring Framework (Spring Boot) for rapid development and REST API creation.
- H2 Database for data persistence.
- JWT (JSON Web Tokens) for secure authentication.
- Maven for build and dependency management (as indicated by the pom.xml files).

##### Key Elements to be Included
- Clearly labeled components: “Authorization Microservice (rops)”, “Order Processing Microservice (rops2)”, “Demo Microservice (demo)”, and “H2 Database”.
- Optionally denote how external clients (such as Postman or a Frontend client) interact with these services via their exposed REST API endpoints.

## Diagram (Mermaid)

```mermaid
graph TD
    %% External Client
    Client["Client (Postman/Frontend)"]:::client

    %% Authorization Microservice (rops)
    subgraph "Authorization Microservice (rops)"
        AuthController["Controllers: Auth, Info, Role, Test"]:::service
        UserModels["Models & Payloads"]:::service
        AuthSecurity["Security (JWT, UserDetails)"]:::service
    end
    click AuthController "https://github.com/lkhorasandzhian/restaurant-order-processing-system/tree/main/rops/"
    
    %% Order Processing Microservice (rops2)
    subgraph "Order Processing Microservice (rops2)"
        MenuController["Controllers: Menu, Test"]:::service
        OrderModels["Models: Dish, User, ERole"]:::service
        OrderSecurity["Security & Utilities"]:::service
    end
    click MenuController "https://github.com/lkhorasandzhian/restaurant-order-processing-system/tree/main/rops2/"
    
    %% Demo Microservice (demo)
    subgraph "Demo Microservice (demo)"
        DemoTool["DB Testing Tool (H2)"]:::demo
    end
    click DemoTool "https://github.com/lkhorasandzhian/restaurant-order-processing-system/tree/main/demo/"
    
    %% H2 Database
    Database["H2 Database (Tables: USERS, SESSION, DISH)"]:::database
    click Database "https://github.com/lkhorasandzhian/restaurant-order-processing-system/tree/main/database/"

    %% Documentation
    subgraph "Documentation"
        JavaDoc1["Generated JavaDoc for rops"]:::doc
        JavaDoc2["Generated JavaDoc for rops2"]:::doc
    end
    click JavaDoc1 "https://github.com/lkhorasandzhian/restaurant-order-processing-system/tree/main/generated-java-doc/"
    click JavaDoc2 "https://github.com/lkhorasandzhian/restaurant-order-processing-system/tree/main/generated-java-doc2/"

    %% External Client interactions with Microservices
    Client -->|"calls/api/auth"| AuthController
    Client -->|"calls/api/info"| AuthController
    Client -->|"calls/api/order"| MenuController

    %% Internal Layers within Authorization Microservice
    AuthController -->|"handles"| UserModels
    AuthController -->|"secured by"| AuthSecurity

    %% Internal Layers within Order Processing Microservice
    MenuController -->|"handles"| OrderModels
    MenuController -->|"secured by"| OrderSecurity

    %% Microservices interaction with Database
    AuthController -->|"reads/writes"| Database
    MenuController -->|"reads/writes"| Database
    DemoTool -->|"verifies connection"| Database

    %% Inter-service communication (if needed)
    AuthController ---|"shares data"| MenuController

    %% Styles and Classes
    classDef service fill:#DDEEFF,stroke:#2E6DA4,stroke-width:2px;
    classDef database fill:#FFF2CC,stroke:#B8860B,stroke-width:2px;
    classDef demo fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef doc fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;
    classDef client fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
```
