# mrvdh/mapping-north-korea architecture

> Architecture diagram of the GitHub repository mrvdh/mapping-north-korea, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrvdh/mapping-north-korea
- Repository: https://github.com/mrvdh/mapping-north-korea

## Overview

##### Main System Components

A. Client-Side (Frontend)
- Vue.js Application Layer
- Main components: Map, About, Statistics pages
- MapPage component as the core feature
- Vuex store for state management
- I18n internationalization system
- Service layer for API communications

B. Server-Side (Backend)
- Node.js Application Layer
- Express.js middleware layer
- MongoDB database
- External Services Integration (OSM API)

##### Component Relationships

- Client → Server: REST API calls through services
- Server → MongoDB: Data persistence layer
- Server → OSM API: External service integration
- Client → OSM API: Direct map interactions

##### Detailed Component Breakdown

Frontend (Vue.js):
**┌─ Vue.js Frontend**
- Core Components
- MapPage (Primary)
- AboutPage
- StatisticsPage
- Services Layer
- MapApiService
- OAuthService
- JOSMService
- State Management
- Vuex Store
- Event Bus

Backend (Node.js):
**┌─ Node.js Backend**
- Controllers
- Event
- Iteration
- PointOfInterest
- Sector
- Middleware
- Database
- Routes
- Authentication
- Services Layer

##### Data Flow Indicators

Critical flows:
- User authentication flow (OAuth with OSM)
- Data retrieval and updates
- Point of Interest management
- Sector and region handling
- Event logging and tracking

##### Technical Stack Indicators

Technologies:
- Vue.js + Vuetify
- Node.js + Express
- MongoDB
- OpenStreetMap API
- JOSM Integration

For this specific mapping application, emphasize the real-time nature of map interactions and how the system handles concurrent users making changes to the same geographical areas.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        VueApp["Vue.js Application"]:::frontend
        click VueApp "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/main.js"
        
        subgraph Components
            MapPage["MapPage Component"]:::frontend
            click MapPage "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/components/MapPage/MapPage.vue"
            AboutPage["AboutPage Component"]:::frontend
            click AboutPage "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/components/AboutPage/AboutPage.vue"
            StatsPage["Statistics Component"]:::frontend
            click StatsPage "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/components/StatisticsPage/StatisticsPage.vue"
        end
        
        subgraph State
            Store["Vuex Store"]:::state
            click Store "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/store/index.js"
            EventBus["Event Bus"]:::state
            click EventBus "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/events/EventBus.js"
        end
        
        subgraph Services
            MapService["Map API Service"]:::service
            click MapService "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/services/MapApiService.js"
            OAuthService["OAuth Service"]:::service
            click OAuthService "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/services/OAuthService.js"
            JOSMService["JOSM Service"]:::service
            click JOSMService "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/services/JOSMService.js"
        end
        
        i18n["i18n System"]:::frontend
        click i18n "https://github.com/MRVDH/mapping-north-korea/blob/master/client/src/i18n.js"
    end
    
    subgraph Backend
        NodeApp["Node.js Application"]:::backend
        click NodeApp "https://github.com/MRVDH/mapping-north-korea/blob/master/app.js"
        
        subgraph Controllers
            EventCtrl["Event Controller"]:::controller
            click EventCtrl "https://github.com/MRVDH/mapping-north-korea/blob/master/controllers/eventController.js"
            POICtrl["POI Controller"]:::controller
            click POICtrl "https://github.com/MRVDH/mapping-north-korea/blob/master/controllers/pointOfInterestController.js"
            SectorCtrl["Sector Controller"]:::controller
            click SectorCtrl "https://github.com/MRVDH/mapping-north-korea/blob/master/controllers/sectorController.js"
            OSMCtrl["OSM Controller"]:::controller
            click OSMCtrl "https://github.com/MRVDH/mapping-north-korea/blob/master/controllers/osmController.js"
        end
        
        subgraph Middleware
            DBMiddleware["Database Middleware"]:::middleware
            click DBMiddleware "https://github.com/MRVDH/mapping-north-korea/blob/master/middleware/database.js"
            RouteMiddleware["Route Middleware"]:::middleware
            click RouteMiddleware "https://github.com/MRVDH/mapping-north-korea/blob/master/middleware/routes.js"
            EnvMiddleware["Environment Middleware"]:::middleware
            click EnvMiddleware "https://github.com/MRVDH/mapping-north-korea/blob/master/middleware/environment.js"
        end
        
        subgraph Models
            EventModel["Event Model"]:::model
            click EventModel "https://github.com/MRVDH/mapping-north-korea/blob/master/models/Event.js"
            POIModel["POI Model"]:::model
            click POIModel "https://github.com/MRVDH/mapping-north-korea/blob/master/models/PointOfInterest.js"
            SectorModel["Sector Model"]:::model
            click SectorModel "https://github.com/MRVDH/mapping-north-korea/blob/master/models/Sector.js"
            StateModel["State Model"]:::model
            click StateModel "https://github.com/MRVDH/mapping-north-korea/blob/master/models/State.js"
        end
    end
    
    MongoDB[(MongoDB)]:::database
    OSM["OpenStreetMap API"]:::external
    
    %% Connections
    VueApp --> Components
    VueApp --> State
    VueApp --> Services
    VueApp --> i18n
    
    Services --> NodeApp
    NodeApp --> Controllers
    Controllers --> Middleware
    Middleware --> Models
    Models --> MongoDB
    
    MapService --> OSM
    OAuthService --> OSM
    OSMCtrl --> OSM
    
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#e74c3c,stroke:#c0392b,color:white
    classDef state fill:#9b59b6,stroke:#8e44ad,color:white
    classDef controller fill:#f1c40f,stroke:#f39c12,color:black
    classDef middleware fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef model fill:#1abc9c,stroke:#16a085,color:white
    classDef database fill:#34495e,stroke:#2c3e50,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white
```
