# anvaka/city-roads architecture

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

- Interactive diagram: https://gitdiagram.com/anvaka/city-roads
- Repository: https://github.com/anvaka/city-roads

## Overview

##### Main Components Identification

a) Frontend Application (Vue.js)
- Main application interface
- Road rendering engine
- Search functionality

b) External Services
- OpenStreetMap Overpass API
- Nominatim Service (for name resolution)
- GitHub-hosted city cache

**┌─ Frontend Application ─────────────────┐**
- ┌─────────────┐  ┌──────────────────┐ │
- Vue.js    │  │  WebGL Renderer  │ │
- Components │  │                  │ │
- ┘  └──────────────────┘ │
- ┌─────────────┐  ┌──────────────────┐ │
- Scene     │  │  State Manager   │ │
- Manager    │  │                  │ │
- ┘  └──────────────────┘ │
- ┘

##### Technical Details

Annotations for:
- Protobuf format for city data (src/proto)
- WebGL rendering pipeline
- Vue.js component hierarchy
- State management flow

##### Important Implementation Details

Specific architectural features:
- Scene management system (src/lib/createScene.js)
- Grid system for road rendering (src/lib/Grid.js)
- Protobuf encoding/decoding (src/proto/)

##### The external service integration points

This will give other engineers a clear understanding of how the system works and how the different parts interact to create the final visualization.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend["Frontend Application"]
        App["Main App Interface"]
        SearchComp["Search Component"]
        ColorComp["Color Customization"]
        ColorSystem["Color System"]
        
        subgraph Core["Core Components"]
            SceneManager["Scene Manager"]
            Grid["Grid System"]
            GridLayer["Grid Layer"]
            WebGLRenderer["WebGL Renderer"]
            StateManager["State Manager"]
        end
        
        subgraph DataProcessing["Data Processing"]
            Proto["Protobuf System"]
            QuerySystem["Query System"]
            BoundaryFinder["Boundary Finder"]
        end
        
        subgraph Export["Export System"]
            SVGExport["SVG Export"]
            ProtobufExport["Protobuf Export"]
            ZazzleExport["Zazzle Export"]
        end
        
        subgraph UI["UI Components"]
            Loading["Loading Indicator"]
            EditLabel["Editable Label"]
            NoWebGL["No WebGL Warning"]
            Progress["Progress Tracker"]
        end
    end
    
    subgraph External["External Services"]
        Overpass["Overpass API"]
        Nominatim["Nominatim Service"]
        GitHubCache["GitHub Cache"]
    end
    
    %% Core relationships
    App --> SearchComp
    App --> ColorComp
    ColorComp --> ColorSystem
    App --> Core
    
    %% Core internal relationships
    SceneManager --> Grid
    Grid --> GridLayer
    SceneManager --> WebGLRenderer
    StateManager --> SceneManager
    
    %% Data processing flows
    SearchComp --> QuerySystem
    QuerySystem --> BoundaryFinder
    QuerySystem --> Proto
    
    %% External service interactions
    QuerySystem --> Overpass
    SearchComp --> Nominatim
    QuerySystem --> GitHubCache
    
    %% Export flows
    App --> Export
    
    %% UI interactions
    App --> UI
    
    %% Styling
    classDef default fill:#ddd,stroke:#000,stroke-width:1px
    classDef external fill:#90EE90,stroke:#000
    classDef core fill:#ADD8E6,stroke:#000
    classDef ui fill:#FFB6C1,stroke:#000
    
    class External external
    class Core core
    class UI ui
    
    %% Click events
    click App "https://github.com/anvaka/city-roads/blob/main/src/App.vue"
    click SearchComp "https://github.com/anvaka/city-roads/blob/main/src/components/FindPlace.vue"
    click ColorComp "https://github.com/anvaka/city-roads/blob/main/src/components/ColorPicker.vue"
    click ColorSystem "https://github.com/anvaka/city-roads/tree/main/src/components/vue3-color"
    click SceneManager "https://github.com/anvaka/city-roads/blob/main/src/lib/createScene.js"
    click Grid "https://github.com/anvaka/city-roads/blob/main/src/lib/Grid.js"
    click GridLayer "https://github.com/anvaka/city-roads/blob/main/src/lib/GridLayer.js"
    click StateManager "https://github.com/anvaka/city-roads/blob/main/src/lib/appState.js"
    click Proto "https://github.com/anvaka/city-roads/tree/main/src/proto"
    click QuerySystem "https://github.com/anvaka/city-roads/blob/main/src/lib/Query.js"
    click BoundaryFinder "https://github.com/anvaka/city-roads/blob/main/src/lib/findBoundaryByName.js"
    click SVGExport "https://github.com/anvaka/city-roads/blob/main/src/lib/svgExport.js"
    click ProtobufExport "https://github.com/anvaka/city-roads/blob/main/src/lib/protobufExport.js"
    click ZazzleExport "https://github.com/anvaka/city-roads/blob/main/src/lib/getZazzleLink.js"
    click Progress "https://github.com/anvaka/city-roads/blob/main/src/lib/Progress.js"
    click Loading "https://github.com/anvaka/city-roads/blob/main/src/components/LoadingIcon.vue"
    click EditLabel "https://github.com/anvaka/city-roads/blob/main/src/components/EditableLabel.vue"
    click NoWebGL "https://github.com/anvaka/city-roads/blob/main/src/NoWebGL.vue"
```
