For non-commercial projects that experience sudden growth, commercial map APIs like Mapbox can become prohibitively expensive, sometimes charging $5 per 1,000 map loads once free tiers are exhausted. The Protomaps ecosystem addresses this by utilizing PMTiles, a tile format that ships as a single file, allowing developers to self-host map data on standard storage buckets and CDNs.
The PMTiles Mechanism
PMTiles functions by enabling a web browser or application to request specific chunks of a large map file via HTTP Range requests. This approach eliminates the need for complex backend infrastructure to manage thousands of individual tile files.
For CDNs that natively support caching Range requests, deployment is as simple as uploading the single PMTiles file to a storage bucket. On platforms like Cloudflare that do not support it natively, developers can use edge functions to translate standard x/y/z URL paths into the required Range requests.
“PMTiles, part of the Protomaps ecosystem, is a tile format that ships in a single file, accessible via Range requests, and is thus extremely portable and easy to deploy.”
— Protomaps: Self-hosting map tiles has gotten cheap and easy — Bruce Röttgers
Cost and Deployment Logistics
By deploying the 139GB world map to a CDN like Bunny.net with high replication, storage fees can be kept around $5 per month. In a practical scenario, loading a map of Europe on a laptop might transmit only 5MB of data, costing a fraction of a cent.
Chart drawn by HN Digest from figures reported by bruceroettgers.eu; values are shown as written in the source.
To manage the upload of these large files, the author recommends using `rclone` to stream the data to an S3-compatible storage zone. This avoids the 15-minute timeout issues often encountered when uploading via standard HTTP APIs.

The image illustrates the specific command-line method recommended for handling large file uploads to avoid timeout issues.
Implementation and Security
Integration into web applications is achieved using the `pmtiles` npm package alongside libraries like MapLibre GL. This setup allows the map to be embedded while maintaining the benefits of self-hosted infrastructure.
To protect against 'bill shock' or unauthorized scraping, the author suggests configuring network limits to throttle download speeds to 10kB/s after the first 10MB of a request. This ensures that regular users experience no lag while preventing users from downloading the entire map file at once.
What Hacker News readers are saying
- Experience: One commenter shared their experience using the system with cloud storage, noting that unpredictable latency and poor caching of HTTP range requests made it less performant than using a dedicated tile server. comment ↗
- Alternative: A commenter who manages a similar infrastructure for privacy and access control suggested using the ntmaps library as a way to interact with different tile providers. comment ↗
Summarized opinions from the Hacker News thread, not verified facts. Read the full discussion ↗