GitHub - hyperknot/openfreemap: Free and open-source map hosting solution with custom styles for websites and apps, using OpenStreetMap data
Service

GitHub - hyperknot/openfreemap: Free and open-source map hosting solution with custom styles for websites and apps, using OpenStreetMap data

hyperknot
2026.05.03
·GitHub·by 임근석/부산/NLP
#Map Hosting#Open Source#OpenStreetMap#Self-Hosting#Vector Tiles

Key Points

  • 1OpenFreeMap provides free, production-quality vector-tile hosting using OpenStreetMap data, offering a public instance without limits, registration, or API keys, and designed for self-hosting.
  • 2Its unique architecture serves map tiles directly from 300 million hard-linked files on Btrfs partition images via an optimized Nginx setup, eschewing traditional tile servers for high performance.
  • 3The project offers weekly full planet downloads in Btrfs and MBTiles formats and is deployed via a specific script for Ubuntu servers, deliberately excluding features like geocoding or cloud services to maintain its free operation.

OpenFreeMap is an open-source project designed to provide free, production-quality vector-tile hosting. It distinguishes itself by avoiding traditional tile servers and cloud infrastructure, instead leveraging highly optimized direct file serving from dedicated servers. The project utilizes OpenStreetMap data processed through tools like OpenMapTiles and Planetiler to generate vector tiles.

The core methodology revolves around directly serving vector tiles as static files from highly optimized Btrfs partition images. Instead of a conventional tile server application, OpenFreeMap employs Nginx to serve over 300 million small, hard-linked files directly from these Btrfs filesystems. This approach capitalizes on the Linux kernel's high-performance file caching capabilities, which are among the most thoroughly tested and performant components of the operating system. The process involves:

  1. Tile Generation: A full OpenStreetMap planet extract is processed by Planetiler to generate an .mbtiles file.
  2. Data Optimization: Custom Python scripts, extract_mbtiles and shrink_btrfs, are used to convert the .mbtiles file into a Btrfs partition image. The extract_mbtiles script extracts the vector tile data (typically PBF files) from the MBTiles SQLite database and arranges them into a z/x/y.pbf directory structure within the Btrfs filesystem. It is implied that this process extensively utilizes hard links to minimize storage consumption for identical tile content, a common optimization for vector tiles. The shrink_btrfs script further optimizes the partition image.
  3. Serving Architecture: The resulting Btrfs partition images are downloaded and mounted on web servers (Ubuntu with Nginx). Nginx is configured to directly serve these individual PBF files. This "no tile server" approach means performance bottlenecks associated with application-level tile serving are bypassed, relying instead on the kernel's efficient filesystem operations and Nginx's static file serving prowess.

The project's architecture is segmented into several components:

  • Deploy Server: Managed by ssh_lib and init-server.py, this component handles the remote setup and configuration of clean Ubuntu servers via SSH, enabling one-command deployment for both tile hosting and generation.
  • HTTP Host: The modules/http_host component, specifically http_host.py, manages downloading Btrfs images and assets, mounting Btrfs images, fetching version files, and executing synchronization tasks.
  • Tile Generation: The modules/tile_gen script orchestrates the entire tile generation pipeline, from downloading OSM extracts to running Planetiler, then using extract_mbtiles and shrink_btrfs to create the optimized Btrfs image, and finally uploading it to a Cloudflare R2 bucket via rclone. This component is optional for self-hosters, as weekly full planet Btrfs images are publicly available.
  • Styles: An external repository manages the MapLibre-compatible vector tile styles.
  • Load Balancer: The modules/loadbalancer script implements a Round-Robin DNS-based load balancing system for health checking and updating DNS records, pushing status notifications to a Telegram bot.

The public instance runs with dedicated servers: one for tile generation and two for web hosting, configured in a Round-Robin DNS setup with Let's Encrypt certificates. The project deliberately avoids Docker, promoting direct system-level configuration via Fabric and SSH for optimal performance and control. It also eschews cloud providers for core tile hosting due to potential latency issues with range requests on large files (e.g., PMTiles on Cloudflare) and prohibitive data transfer costs (e.g., AWS S3), aiming to sustain a free service model through direct hardware utilization and community donations.

OpenFreeMap explicitly defines its limitations: it does not provide search, geocoding, routing, static image generation, raster tile hosting, satellite imagery, elevation lookup, or custom tile/dataset hosting. It is designed as a focused solution for vector tile hosting. Weekly full planet downloads are provided in both Btrfs and MBTiles formats through public Cloudflare R2 buckets. The project is licensed under MIT, with map data sourced from OpenStreetMap.