# ghostoninternet/lumiroo architecture

> Architecture diagram of the GitHub repository ghostoninternet/lumiroo, 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/ghostoninternet/lumiroo
- Repository: https://github.com/ghostoninternet/lumiroo

## Overview

- Frontend Client: Represent the "client" folder. Indicate that this section contains the user interface built with React and uses various components (pages, layouts, UI components, routing, etc.).
- Key submodules include:
- Auth components (SignIn, SignUp, ProtectedRoute, RoleRoute)
- Pages like Home, Landing, Map, Playground detail and listing, Favorites, and various Admin pages.
- Shared utilities and assets (styles, images, animations, constants, contexts).
- Backend Server: Represent the "server" folder – the NodeJS backend that provides the APIs and business logic.
- Key components include:
- Controllers (for authentication, playgrounds, reviews, profile, upload, admin functions)
- Routes (organized by feature)
- Data Access Objects (DAOs) managing database operations
- Models (database schema representations for users, playgrounds, reviews, sessions, etc.)
- Services that encapsulate business logic and external interactions (email service, upload service)
- Middlewares (authentication, error handling, validation, file uploads, etc.)
- Configuration files (for CORS, databases, etc.)
- Seeding scripts (for populating the database with data)

##### Relationships and data flows
- The React frontend sending HTTP requests (fetch/axios calls) to backend API endpoints defined in the server’s routes.
- Internal interactions within the backend:
- Routes call Controllers
- Controllers use Services, which in turn rely on DAOs and Models to interact with the database.
- Middlewares intercept requests to handle authentication, validation, and error handling.
- That the frontend components (such as those in the “pages” and “components” directories) consume the APIs provided by the backend (for authentication, playground information, reviews, etc.).

##### Architectural patterns and design principles
- Frontend: A component-based design using React, potentially making use of context for state management (noted in the “contexts” folder) and clearly separated layouts and pages.
- Backend: A layered architecture adhering to separation of concerns with controllers (HTTP interface), services (business logic), and DAOs/models (data persistence). The existence of specific middleware also suggests adherence to robust error handling and validation practices.
- How the project separates concerns between presentation (UI components), business logic, and database interactions.

##### Relevant technologies/frameworks
- Frontend: React (with JSX components), Vite as the build tool, Tailwind CSS (as indicated by the tailwind.config.js), ESLint for linting, and potential routing components for navigating between pages.
- Backend: NodeJS (with Express.js or similar framework analysis through file structure), usage of environment variables (.env), database configurations (likely using an ORM or direct DB configs in database.config.js), and other common libraries for email handling, file upload, etc.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Section
    subgraph "Frontend Client"
        F1["React UI Components"]:::frontend
        F2["React Pages"]:::frontend
        F3["Auth Components"]:::frontend
        F4["Shared Utilities & Assets"]:::frontend
    end

    %% API Gateway
    GW["API Gateway"]:::gateway

    %% Backend Section
    subgraph "Backend Server"
        B1["Controllers"]:::backend
        B2["Routes"]:::backend
        B3["Middlewares"]:::middleware
        B4["Services"]:::backend
        B5["DAOs"]:::data
        B6["Models"]:::data
        B7["Configuration Files"]:::backend
        B8["Seeding Scripts"]:::backend
    end

    %% High-level Frontend Node representing the entire client bundle
    FC["React Frontend"]:::frontend

    %% High-level Backend Node representing the entire server bundle
    BS["NodeJS Backend"]:::backend

    %% Frontend internal grouping to high-level node
    FC --> F1
    FC --> F2
    FC --> F3
    FC --> F4

    %% Backend internal grouping to high-level node
    BS --> B1
    BS --> B2
    BS --> B3
    BS --> B4
    BS --> B5
    BS --> B6
    BS --> B7
    BS --> B8

    %% Interaction between Frontend and Backend via API Gateway
    FC -->|"HTTP_Request"| GW
    GW -->|"RoutesCall"| B2

    %% Backend flow
    B2 -->|"Intercept"| B3
    B3 -->|"Authorize"| B1
    B1 -->|"Invoke"| B4
    B4 -->|"Query"| B5
    B4 -->|"Validate"| B6
    B4 -->|"LoadConfig"| B7

    %% Click Events for Frontend components
    click FC "https://github.com/ghostoninternet/lumiroo/tree/master/client"
    click F1 "https://github.com/ghostoninternet/lumiroo/tree/master/client/src/components"
    click F2 "https://github.com/ghostoninternet/lumiroo/tree/master/client/src/pages"
    click F3 "https://github.com/ghostoninternet/lumiroo/tree/master/client/src/components/Auth/"
    click F4 "https://github.com/ghostoninternet/lumiroo/tree/master/client/src/assets"

    %% Click Events for Backend components
    click BS "https://github.com/ghostoninternet/lumiroo/tree/master/server"
    click B1 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/controllers"
    click B2 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/routes"
    click B3 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/middlewares"
    click B4 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/services"
    click B5 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/daos"
    click B6 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/models"
    click B7 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/configs"
    click B8 "https://github.com/ghostoninternet/lumiroo/tree/master/server/src/seed"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef middleware fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef data fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef gateway fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
