# moontomoon119/samoo-city-2025 architecture

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

- Interactive diagram: https://gitdiagram.com/moontomoon119/samoo-city-2025
- Repository: https://github.com/moontomoon119/samoo-city-2025

## Overview

##### Project Type and Purpose
- This is a full-stack web application named “Excel Relation Explorer.”

##### File-Structure Analysis
- Top-level directories/services orchestrated by Docker Compose:
- db/ (Postgres or similar, initialized via db/init_part_*.sql)
- openroute/ors-docker/ (OpenRouteService for isochrone endpoints)
- excel-relations-api/ (Node.js Express API container)
- excel-relations-front/ (Node.js/React front-end container)
- Configuration files at root: docker-compose.yml (with .dev/.prod variants), env.example, dump_database.sh.
- Pattern in API: MVC (controllers, services, models), CLI utilities, SQL functions, file-upload handling via Multer.
- Pattern in Frontend: React component structure (filter, grid, map), service layer for HTTP calls, webpack bundling, static data in public/data.

##### README Insights
- Launch stack with `docker-compose up` → brings up DB, ORS, API, front-end.
- Health check of ORS on port 8082; front-end served on 3000.
- Exposed network links between containers via Docker Compose.

##### Diagramming Conventions
- Use clear labels: component name, port, purpose.
- Notes on initialization (DB SQL scripts) and volume mounts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    subgraph "User's Browser"
        direction TB
        Browser["React SPA (Browser)"]:::frontend
    end

    %% Front-end Container
    subgraph "Front-end Container (excel-relations-front)" 
        direction TB
        FE_Docker["Dockerfile"]:::infra
        FE_Server["server.js"]:::infra
        FE_Pkg["package.json"]:::infra
        FE_Wep["webpack.config.js"]:::infra

        subgraph "React Application"
            direction TB
            FE_Main["src/main.js"]:::frontend
            FE_Config["src/core/config.js"]:::frontend
            FE_Layout["src/layouts/MainLayout.js"]:::frontend

            subgraph "Filter Suite"
                direction TB
                FilterCore["FilterCore.js"]:::frontend
            end

            subgraph "Grid Components"
                direction TB
                GridContainer["GridContainer.js"]:::frontend
            end

            subgraph "Map Components"
                direction TB
                MapContainer["MapContainer.js"]:::frontend
            end

            subgraph "Service Layer"
                direction TB
                IsoService["IsochroneApiService.js"]:::frontend
            end

            subgraph "Utilities"
                direction TB
                EventBus["eventBus.js"]:::frontend
            end
        end
    end

    %% API Container
    subgraph "API Container (excel-relations-api)"
        direction TB
        API_Docker["Dockerfile"]:::infra
        API_Server["server.js"]:::infra
        API_Pkg["package.json"]:::infra

        subgraph "MVC Pattern"
            direction TB
            subgraph "Controllers"
                direction TB
                GridFileCtrl["gridFileController.js"]:::api
                IsoCtrl["isochroneController.js"]:::api
                PnuCtrl["pnuFileController.js"]:::api
            end
            subgraph "Services"
                direction TB
                GridSvc["gridService.js"]:::api
                IsoSvc["isochroneService.js"]:::api
            end
            subgraph "Models"
                direction TB
                TableModel["tableModel.js"]:::api
            end
            subgraph "Routes"
                direction TB
                FileRoutes["fileRoutes.js"]:::api
            end
        end

        subgraph "Config & Utils"
            direction TB
            DBConfig["src/config/db.js"]:::api
            MulterCfg["src/config/multer.js"]:::api
            SqlFuncs["src/db/functions.sql"]:::api
            subgraph "CLI Utilities"
                direction TB
                DateCLI["dateFilterCli.js"]:::api
            end
            subgraph "Scripts"
                direction TB
                NumCheck["runNumericColumnsCheck.js"]:::api
            end
            subgraph "Helpers"
                direction TB
                Checker["excelChecker.js"]:::api
            end
        end
    end

    %% Database Container
    subgraph "Database Container (Postgres)"
        direction TB
        DB["Postgres on 5432"]:::db
        subgraph "Initialization Scripts"
            direction TB
            InitAA["init_part_aa.sql"]:::db
            InitAB["init_part_ab.sql"]:::db
            InitAC["init_part_ac.sql"]:::db
            InitAD["init_part_ad.sql"]:::db
        end
    end

    %% OpenRouteService Container
    subgraph "OpenRouteService Container"
        direction TB
        ORS["ORS on 8082"]:::external
    end

    %% Docker Compose & Configs
    subgraph "Docker Compose & Env"
        direction TB
        Compose["docker-compose.yml"]:::infra
        CompDev["docker-compose.dev.yml"]:::infra
        CompProd["docker-compose.prod.yml"]:::infra
        EnvExample["env.example"]:::infra
    end

    %% Data Flows
    Browser -->|"HTTP GET/POST"| FE_Server
    Browser -->|"SPA Assets"| FE_Main
    FE_Main -->|"REST API Calls"| API_Server
    API_Server -->|"CRUD"| DB
    API_Server -->|"ISOCHRONE API"| ORS
    API_Server -->|"JSON Responses"| FE_Main

    %% Click Events
    click FE_Docker "https://github.com/moontomoon119/samoo-city-2025/tree/main/excel-relations-front/Dockerfile"
    click FE_Server "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/server.js"
    click FE_Pkg "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/package.json"
    click FE_Wep "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/webpack.config.js"
    click FE_Main "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/src/main.js"
    click FE_Config "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/src/core/config.js"
    click FE_Layout "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/src/layouts/MainLayout.js"
    click FilterCore "https://github.com/moontomoon119/samoo-city-2025/tree/main/excel-relations-front/src/components/filter/"
    click GridContainer "https://github.com/moontomoon119/samoo-city-2025/tree/main/excel-relations-front/src/components/grid/"
    click MapContainer "https://github.com/moontomoon119/samoo-city-2025/tree/main/excel-relations-front/src/components/map/"
    click IsoService "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/src/services/IsochroneApiService.js"
    click EventBus "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-front/src/utils/eventBus.js"

    click API_Docker "https://github.com/moontomoon119/samoo-city-2025/tree/main/excel-relations-api/Dockerfile"
    click API_Server "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/server.js"
    click API_Pkg "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/package.json"
    click GridFileCtrl "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/controllers/gridFileController.js"
    click IsoCtrl "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/controllers/isochroneController.js"
    click PnuCtrl "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/controllers/pnuFileController.js"
    click GridSvc "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/services/gridService.js"
    click IsoSvc "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/services/isochroneService.js"
    click TableModel "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/models/tableModel.js"
    click FileRoutes "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/routes/fileRoutes.js"
    click DBConfig "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/config/db.js"
    click MulterCfg "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/config/multer.js"
    click SqlFuncs "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/db/functions.sql"
    click DateCLI "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/cli/dateFilterCli.js"
    click NumCheck "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/scripts/runNumericColumnsCheck.js"
    click Checker "https://github.com/moontomoon119/samoo-city-2025/blob/main/excel-relations-api/src/utils/excelChecker.js"

    click DB "https://github.com/moontomoon119/samoo-city-2025/tree/main/db/"
    click InitAA "https://github.com/moontomoon119/samoo-city-2025/tree/main/db/init_part_aa"
    click InitAB "https://github.com/moontomoon119/samoo-city-2025/tree/main/db/init_part_ab"
    click InitAC "https://github.com/moontomoon119/samoo-city-2025/tree/main/db/init_part_ac"
    click InitAD "https://github.com/moontomoon119/samoo-city-2025/tree/main/db/init_part_ad"

    click ORS "https://github.com/moontomoon119/samoo-city-2025/tree/main/openroute/ors-docker/"

    click Compose "https://github.com/moontomoon119/samoo-city-2025/blob/main/docker-compose.yml"
    click CompDev "https://github.com/moontomoon119/samoo-city-2025/blob/main/docker-compose.dev.yml"
    click CompProd "https://github.com/moontomoon119/samoo-city-2025/blob/main/docker-compose.prod.yml"
    click EnvExample "https://github.com/moontomoon119/samoo-city-2025/blob/main/env.example"

    %% Styles
    classDef frontend fill:#D6EAFE,stroke:#333,stroke-width:1px
    classDef api fill:#E2F7E1,stroke:#333,stroke-width:1px
    classDef db fill:#FFE5B4,stroke:#333,stroke-width:1px
    classDef external fill:#E4D0F5,stroke:#333,stroke-width:1px
    classDef infra fill:#F0F0F0,stroke:#333,stroke-width:1px
```
