# arishem51/rm-app architecture

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

- Interactive diagram: https://gitdiagram.com/arishem51/rm-app
- Repository: https://github.com/arishem51/rm-app

## Overview

1. A backend built with Spring Boot (Java and Maven based) – which serves as a RESTful API server with controllers, services, data transfer objects (DTOs), entities, repositories, and configuration for security, JWT handling, exception management, and more.
2. A frontend built with Next.js (React framework) – featuring a full-fledged web application that includes various pages (authentication, dashboard, profiles, and detailed modules for categories, orders, shops, warehouses, etc.), components, hooks, and service utilities to call backend endpoints.

##### Main components
a. Frontend:
- Next.js application that runs on port 3000.
- Pages for authentication (sign-up, sign-in, forgot/reset password), the dashboard, and differentiated modules (categories, orders, products, etc.).
b. Backend:
- This is the Spring Boot application running on port 8080.
- The backend is organized into packages such as config, controllers, services, repositories, DTOs, entities, and security.
- Components for authentication, business logic for orders, inventory, categories, partners, and more.
c. Database:
- Although not directly visible as a folder, the README indicates migrations and database seeds (using Flyway). This suggests a relational database (SQL Server, based on the migration configuration).
- That the backend interacts with the database for persistence and retrieval.
d. Migration & Configuration:
- That database migrations (Flyway) are part of the system, triggered by Maven commands.
- Configuration files (application.properties, .env.example) that manage environment settings.

##### Relationships and interactions
- Optionally, delineate the migration tool (Flyway) as part of the backend component that ensures the database schema is up-to-date.

##### Design principles and patterns
- The backend adheres to a layered architecture (Controller → Service → Repository) and utilizes standard Spring Boot practices such as dependency injection and security configurations.
- The frontend is built with a modular, component-based pattern, leveraging Next.js’s file structure for routing and React’s component system.
- The separation of concerns is clear, with the monorepo structure keeping both projects in sync but structurally independent.

##### Technologies and frameworks
- Backend: Spring Boot, Maven, Flyway for migrations, JWT for authentication, and typical Java libraries for validation and exception handling.
- Frontend: Next.js, React, Tailwind CSS, and testing tools like Jest and Cypress.
- Other: A SQL Server database is used as per the migration command details.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Subgraph
    subgraph "Frontend"
        FEApp("Next.js Frontend Application"):::frontend
        subgraph "Pages"
            FEAuth("Authentication Pages"):::frontend
            FEDash("Dashboard & Module Pages"):::frontend
        end
        subgraph "UI Components"
            FEComponents("Components & UI Libraries"):::frontend
            FEUIConfig("Global Styles & Tailwind Config"):::frontend
        end
    end

    %% Backend Subgraph
    subgraph "Backend"
        BEApp("Spring Boot Backend Application"):::backend
        subgraph "Core Backend"
            BEConfig("Main Application & Configuration"):::backend
            BEControllers("Controllers (REST API)"):::backend
            BEServices("Services (Business Logic)"):::backend
            BEDTO("Data Transfer Objects (DTOs)"):::backend
            BEEntities("Entities"):::backend
            BERepositories("Repositories (Data Access)"):::backend
            BESecurity("Security & Configurations"):::backend
            BEFlyway("Flyway Migrations & Seeds"):::backend
        end
    end

    %% Database Node
    DB["SQL Server Database"]:::database

    %% Connections Between Layers
    FEApp -->|"REST_API"| BEApp
    BEApp -->|"delegates_to"| BEControllers
    BEControllers -->|"calls"| BEServices
    BEServices -->|"accesses"| BERepositories
    BERepositories -->|"queries"| DB
    BEFlyway -->|"migrates"| DB

    %% Class Definitions for Colors
    classDef frontend fill:#ccf,stroke:#00f,stroke-width:2px;
    classDef backend fill:#cfc,stroke:#090,stroke-width:2px;
    classDef database fill:#fc9,stroke:#f60,stroke-width:2px;

    %% Click Events for Frontend
    click FEApp "https://github.com/arishem51/rm-app/tree/main/frontend/app"
    click FEAuth "https://github.com/arishem51/rm-app/tree/main/frontend/app/auth"
    click FEDash "https://github.com/arishem51/rm-app/tree/main/frontend/app/dashboard"
    click FEComponents "https://github.com/arishem51/rm-app/tree/main/frontend/components"
    click FEUIConfig "https://github.com/arishem51/rm-app/blob/main/frontend/app/globals.css"

    %% Click Events for Backend
    click BEApp "https://github.com/arishem51/rm-app/tree/main/backend"
    click BEConfig "https://github.com/arishem51/rm-app/blob/main/backend/src/main/java/com/example/backend/RmAppApplication.java"
    click BEControllers "https://github.com/arishem51/rm-app/tree/main/backend/src/main/java/com/example/backend/controllers"
    click BEServices "https://github.com/arishem51/rm-app/tree/main/backend/src/main/java/com/example/backend/services"
    click BEDTO "https://github.com/arishem51/rm-app/tree/main/backend/src/main/java/com/example/backend/dto"
    click BEEntities "https://github.com/arishem51/rm-app/tree/main/backend/src/main/java/com/example/backend/entities"
    click BERepositories "https://github.com/arishem51/rm-app/tree/main/backend/src/main/java/com/example/backend/repositories"
    click BESecurity "https://github.com/arishem51/rm-app/tree/main/backend/src/main/java/com/example/backend/config"
    click BEFlyway "https://github.com/arishem51/rm-app/tree/main/backend/src/main/resources/db/migration"
```
