# matmyfta/geografitest architecture

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

- Interactive diagram: https://gitdiagram.com/matmyfta/geografitest
- Repository: https://github.com/matmyfta/geografitest

## Overview

##### Project type and purpose
- This is a SvelteKit–based single‐page web application (no custom backend).
- From src/routes/game and utils/GameController.js, it implements an interactive geography game: it loads GeoJSON region data, renders maps, and handles game rules in the browser.

##### File structure
- Top‐level config files (svelte.config.js, vite.config.js/ts, tsconfig.json, jsconfig.json, package.json) – define build and dev tools.
- src/ – your application source:
– app.html, app.css – global template and styles
– routes/ – SvelteKit page components (+layout.svelte, +page.svelte). “/game/+page.svelte” is the main game view.
– utils/ – client‐side services and controllers:
- GameController.js – orchestrates game state and user interactions
- MapService.js – loads and renders GeoJSON map layers
- RegionService.js – manages game logic per region
- geojson/adapters/ – adapter classes to transform raw .geojson files into a consistent internal format
- static/assets/private/ – raw .geojson files, served as static assets
- static/styles.css – global CSS

##### README for additional insights
- Default SvelteKit scaffolding – no extra server processes or microservices.
- All dynamic behavior lives client‐side under SvelteKit’s dev/prod server.

##### Essential detail checklist
- SvelteKit server role (dev vs. prod).
- Static GeoJSON asset store.
- MapService’s fetch calls and adapter transformations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Swimlanes
    subgraph "Client: Browser" 
        BROWSER["Browser Client<br/>(SvelteKit SPA)"]:::framework
    end

    subgraph "Server: SvelteKit/Vite" 
        SERVER_DEV["Vite Dev Server"]:::framework
        SERVER_PROD["SvelteKit Static Host"]:::framework
    end

    subgraph "Static Asset Store" 
        ASSETS["GeoJSON Files"]:::datastore
    end

    subgraph "Client Modules" 
        subgraph "Presentation Layer"
            APP_HTML["app.html"]:::presentation
            APP_CSS["app.css"]:::presentation
            LAYOUT["+layout.svelte"]:::presentation
            PAGE_ROOT["+page.svelte"]:::presentation
            PAGE_GAME["/game/+page.svelte"]:::presentation
        end
        subgraph "Coordination Layer"
            GC["GameController"]:::logic
        end
        subgraph "Data Access & Transformation"
            MS["MapService"]:::logic
            ADAPTER_BASE["GeojsonAdapter"]:::logic
            BUILDER["GeojsonBuilder"]:::logic
            ADP_ALB["AlbanianRegionsGeojsonAdapter"]:::logic
            ADP_AUT["AustrianGeojsonAdapter"]:::logic
            ADP_EUR["EuropeanStatesGeojsonAdapter"]:::logic
            ADP_DEU["GermanGeojsonAdapter"]:::logic
            ADP_ITA_PROV["ItalianProvincesGeojsonAdapter"]:::logic
            ADP_ITA_REG["ItalianRegionsGeojsonAdapter"]:::logic
            ADP_ROM["RomanEmpireGeojsonAdapter"]:::logic
            ADP_US["UnitedStatesGeojsonAdapter"]:::logic
        end
        subgraph "Domain Model"
            RS["RegionService"]:::logic
        end
    end

    %% HTTP Requests
    BROWSER -->|HTTP GET app shell| SERVER_DEV
    BROWSER -->|HTTP GET app shell| SERVER_PROD
    BROWSER -->|HTTP GET GeoJSON| ASSETS

    %% In-browser data flows
    PAGE_GAME -->|binds UI events| GC
    GC -->|calls| RS
    PAGE_GAME -->|renders via Svelte reactivity| PAGE_GAME
    GC -->|requests map data| MS
    MS -->|fetch & parse| ASSETS
    MS -->|use adapter| ADAPTER_BASE
    ADAPTER_BASE -->|build| BUILDER
    BUILDER --> ADP_ALB
    BUILDER --> ADP_AUT
    BUILDER --> ADP_EUR
    BUILDER --> ADP_DEU
    BUILDER --> ADP_ITA_PROV
    BUILDER --> ADP_ITA_REG
    BUILDER --> ADP_ROM
    BUILDER --> ADP_US
    ADP_ALB -->|normalized data| RS
    ADP_AUT -->|normalized data| RS
    ADP_EUR -->|normalized data| RS
    ADP_DEU -->|normalized data| RS
    ADP_ITA_PROV -->|normalized data| RS
    ADP_ITA_REG -->|normalized data| RS
    ADP_ROM -->|normalized data| RS
    ADP_US -->|normalized data| RS

    %% Legend
    subgraph Legend
        F["Frameworks"]:::framework
        P["Presentation"]:::presentation
        D["Data Store"]:::datastore
        L["Business Logic"]:::logic
    end

    %% Click Events
    click BROWSER "https://github.com/matmyfta/geografitest/blob/main/svelte.config.js"
    click BROWSER "https://github.com/matmyfta/geografitest/blob/main/vite.config.js"
    click BROWSER "https://github.com/matmyfta/geografitest/blob/main/vite.config.ts"
    click BROWSER "https://github.com/matmyfta/geografitest/blob/main/tsconfig.json"
    click BROWSER "https://github.com/matmyfta/geografitest/blob/main/jsconfig.json"
    click APP_HTML "https://github.com/matmyfta/geografitest/blob/main/src/app.html"
    click APP_CSS "https://github.com/matmyfta/geografitest/blob/main/src/app.css"
    click LAYOUT "https://github.com/matmyfta/geografitest/blob/main/src/routes/+layout.svelte"
    click PAGE_ROOT "https://github.com/matmyfta/geografitest/blob/main/src/routes/+page.svelte"
    click PAGE_GAME "https://github.com/matmyfta/geografitest/blob/main/src/routes/game/+page.svelte"
    click GC "https://github.com/matmyfta/geografitest/blob/main/src/utils/GameController.js"
    click MS "https://github.com/matmyfta/geografitest/blob/main/src/utils/MapService.js"
    click ADAPTER_BASE "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/GeojsonAdapter.js"
    click BUILDER "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/GeojsonBuilder.js"
    click ADP_ALB "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/AlbanianRegionsGeojsonAdapter.js"
    click ADP_AUT "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/AustrianGeojsonAdapter.js"
    click ADP_EUR "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/EuropeanStatesGeojsonAdapter.js"
    click ADP_DEU "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/GermanGeojsonAdapter.js"
    click ADP_ITA_PROV "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/ItalianProvincesGeojsonAdapter.js"
    click ADP_ITA_REG "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/ItalianRegionsGeojsonAdapter.js"
    click ADP_ROM "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/RomanEmpireGeojsonAdapter.js"
    click ADP_US "https://github.com/matmyfta/geografitest/blob/main/src/utils/geojson/adapters/UnitedStatesGeojsonAdapter.js"
    click RS "https://github.com/matmyfta/geografitest/blob/main/src/utils/RegionService.js"
    click ASSETS "https://github.com/matmyfta/geografitest/tree/main/static/assets/private"

    %% Styles
    classDef framework fill:#D6EAF8,stroke:#3498DB,stroke-width:2px;
    classDef presentation fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px;
    classDef datastore fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef logic fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
    classDef Legend fill:#FFFFFF,stroke:#000000,stroke-width:1px;
    class F,P,D,L framework,presentation,datastore,logic
```
