# systemed/tilemaker architecture

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

## Overview

- OSM PBF/GeoJSON/Shapefile → Input Processors → Core Processing

- Core Processing ↔ Storage Layer
- Core Processing → Geometry Processing → Tile Generation

- Tile Generation → Output Formats (MBTiles/PMTiles)
- Output Formats → Server Component

- JSON Config File
- Lua Processing Scripts
- Runtime Options

- Pooled String Storage
- Mmap Allocator
- Sharded Stores

- Boost
- Lua/LuaJIT
- SQLite3
- RapidJSON
- Shapelib

##### Implementation Notes

- Version/format labels
- Critical path components
- Scalability points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Title
    title[tilemaker System Architecture]:::title
    
    %% Input Processing Layer
    subgraph InputLayer["Input Processing Layer"]
        PBF["PBF Processor"]
        GEOJSON["GeoJSON Processor"]
        SHP["Shapefile Processor"]
    end
    
    %% Core Processing Layer
    subgraph CoreLayer["Core Processing Layer"]
        LUA["OSM Lua Processing Engine"]
        STORES["Node/Way Stores"]
        ATTR["Attribute Store"]
        GEOM["Geometry Processing"]
    end
    
    %% Storage Layer
    subgraph StorageLayer["Storage Layer"]
        MEMTILES["Memory Tiles"]
        TMPSTORE["Temporary Storage (SSD)"]
        STOREMANAGE["Node/Way Storage Management"]
    end
    
    %% Output Layer
    subgraph OutputLayer["Output Layer"]
        MBTILES["MBTiles Writer"]
        PMTILES["PMTiles Writer"]
        VTILE["Vector Tile Builder"]
    end
    
    %% Server Component
    subgraph ServerLayer["Server Component"]
        WEB["Web Server"]
        API["Tile Serving API"]
        STATIC["Static File Server"]
    end
    
    %% Configuration Components
    subgraph ConfigLayer["Configuration Components"]
        JSON["JSON Config File"]
        LUASCRIPTS["Lua Processing Scripts"]
        OPTIONS["Runtime Options"]
    end
    
    %% Memory Management
    subgraph MemoryLayer["Memory Management"]
        POOL["Pooled String Storage"]
        MMAP["Mmap Allocator"]
        SHARD["Sharded Stores"]
    end
    
    %% External Dependencies
    subgraph DependencyLayer["External Dependencies"]
        BOOST["Boost"]
        LUAJIT["Lua/LuaJIT"]
        SQLITE["SQLite3"]
        RAPIDJSON["RapidJSON"]
        SHAPELIB["Shapelib"]
    end
    
    %% Connections
    InputLayer --> CoreLayer
    CoreLayer <--> StorageLayer
    CoreLayer --> OutputLayer
    OutputLayer --> ServerLayer
    ConfigLayer --> CoreLayer
    MemoryLayer --> StorageLayer
    DependencyLayer --> CoreLayer
    
    %% Click Events
    click PBF "https://github.com/systemed/tilemaker/blob/master/include/pbf_processor.h"
    click GEOJSON "https://github.com/systemed/tilemaker/blob/master/include/geojson_processor.h"
    click SHP "https://github.com/systemed/tilemaker/blob/master/include/shp_processor.h"
    click LUA "https://github.com/systemed/tilemaker/blob/master/include/osm_lua_processing.h"
    click STORES "https://github.com/systemed/tilemaker/blob/master/include/node_stores.h"
    click ATTR "https://github.com/systemed/tilemaker/blob/master/include/attribute_store.h"
    click GEOM "https://github.com/systemed/tilemaker/blob/master/include/geom.h"
    click MEMTILES "https://github.com/systemed/tilemaker/blob/master/include/osm_mem_tiles.h"
    click STOREMANAGE "https://github.com/systemed/tilemaker/blob/master/include/sharded_node_store.h"
    click MBTILES "https://github.com/systemed/tilemaker/blob/master/include/mbtiles.h"
    click PMTILES "https://github.com/systemed/tilemaker/blob/master/include/pmtiles.h"
    click VTILE "https://github.com/systemed/tilemaker/blob/master/include/vtzero/builder.hpp"
    click WEB "https://github.com/systemed/tilemaker/blob/master/server/server.cpp"
    click API "https://github.com/systemed/tilemaker/blob/master/server/Simple-Web-Server/server_http.hpp"
    click STATIC "https://github.com/systemed/tilemaker/tree/master/server/static/"
    click POOL "https://github.com/systemed/tilemaker/blob/master/include/pooled_string.h"
    click MMAP "https://github.com/systemed/tilemaker/blob/master/include/mmap_allocator.h"
    
    %% Styling
    classDef default fill:#fff,stroke:#333,stroke-width:2px;
    classDef title fill:#f9f,stroke:#333,stroke-width:4px;
    classDef input fill:#cfe,stroke:#333;
    classDef core fill:#ecf,stroke:#333;
    classDef storage fill:#fec,stroke:#333;
    classDef output fill:#cef,stroke:#333;
    classDef server fill:#fce,stroke:#333;
    classDef config fill:#eee,stroke:#333;
    classDef memory fill:#fee,stroke:#333;
    classDef dependency fill:#efe,stroke:#333;
    
    class title title;
    class PBF,GEOJSON,SHP input;
    class LUA,STORES,ATTR,GEOM core;
    class MEMTILES,TMPSTORE,STOREMANAGE storage;
    class MBTILES,PMTILES,VTILE output;
    class WEB,API,STATIC server;
    class JSON,LUASCRIPTS,OPTIONS config;
    class POOL,MMAP,SHARD memory;
    class BOOST,LUAJIT,SQLITE,RAPIDJSON,SHAPELIB dependency;
```
