npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mbtileserver

v5.6.7

Published

Vector maps with GL styles. Map tile server for JSON GL styles - serving vector tiles

Readme

MBTileServer

Vector maps with GL styles. Lightweight map tile server for MapLibre GL JS, Leaflet, OpenLayers, GIS via WMTS, etc.

Note: This is a light-weight fork of TileServer GL, focused on serving vector tiles (MBTiles/PMTiles) without server-side raster rendering.

Features

  • MBTiles support — Serve vector tiles from local SQLite databases
  • PMTiles support — Cloud-optimized tile archives with HTTP range requests
  • Zero native dependencies — Pure JavaScript, runs on Windows, macOS, and Linux
  • Built-in preview — Interactive map viewer powered by MapLibre GL JS 5.x
  • Rich viewer UI — Layer list, search, drag-and-drop reorder, visibility toggle, inline rename, duplicate, style editor with color picker
  • Style editor — Edit layer paint/layout properties via JSON, with cascading preset dropdowns (fill/line/circle/symbol)
  • Color picker — Double-click color swatches to modify colors with native color input
  • Map pick & popup — Click on map to query rendered features and navigate to layers
  • Style upload/download — Import/export MapLibre style.json on the fly
  • TileJSON / WMTS — Standard OGC-compatible service endpoints
  • Static files — Serve custom fonts, sprites, images via /files/
  • Lightweight — No Canvas, no MapLibre GL Native, no heavy raster rendering pipeline

Requirements

  • Node.js v20+ (v22 LTS recommended)
  • npm
node --version  # v22.x.x
npm --version   # 10.x.x

Install

From source (local)

git clone https://gitee.com/mapbox-gl/mbtileserver.git
cd mbtileserver
npm install -g .

Verify installation

mbtileserver --version
# 5.6.3

Quick Start

Serve a single MBTiles file

mbtileserver zurich_switzerland.mbtiles -p 8080

Then open http://localhost:8080 in your browser.

Serve with a config file

Create config.json:

{
  "options": {
    "port": 8080,
    "cors": true,
    "serveStatic": true,
    "serveStyles": true,
    "servePreview": true,
    "paths": {
      "root": "",
      "fonts": "fonts",
      "styles": "styles",
      "files": "public/files"
    }
  },
  "data": {
    "zurich": {
      "mbtiles": "zurich_switzerland.mbtiles"
    }
  },
  "styles": {}
}

Start the server:

mbtileserver -c config.json -p 8080

Development

Run in development mode with hot-reload (via nodemon):

npm run dev

This watches src/ and public/ for changes and auto-restarts the server.

CLI Options

| Option | Description | Default | |--------|-------------|---------| | --file <file> | MBTiles or PMTiles file | — | | -c, --config <file> | Configuration file | config.json | | -p, --port <port> | Server port | 8080 | | -b, --bind <address> | Bind address | 0.0.0.0 | | -u, --public_url <url> | Public URL (for reverse proxy) | — | | -C, --no-cors | Disable CORS headers | — | | --ignore-missing-files | Skip missing data sources on startup | — | | -V, --verbose [level] | Verbose logging (1-3) | — | | -s, --silent | Less output | — | | -v, --version | Show version | — | | -h, --help | Show help | — |

API Endpoints

| Endpoint | Description | |----------|-------------| | / | Home page with map preview | | /data | List all data sources | | /data/{id}.json | TileJSON metadata | | /data/{id}/{z}/{x}/{y}.pbf | Vector tiles | | /files/{path} | Static files (fonts, sprites, images) | | /styles/{id}.json | GL style JSON |

Viewer Features

The built-in MapLibre viewer (/data/{id}) provides a rich layer management UI:

  • Layer list — Right-side panel showing all layers with type icons (fill/line/circle/symbol)
  • Search & filter — Quick filter layers by name
  • Visibility toggle — Checkbox to show/hide individual layers
  • Drag & drop reorder — Drag layers to change draw order
  • Inline rename — Double-click layer name to edit its ID
  • Duplicate — Click + to clone a layer with identical style
  • Style editor — Click layer color box to open modal with:
    • Live JSON editor with syntax highlighting
    • Cascading preset dropdowns (type + category) for quick style defaults
    • Color swatch extraction — double-click to pick colors
    • Native color picker integration
  • Layer order modal — Top-left button to reorder source-layers via textarea
  • Style upload/download — Import/export full MapLibre style.json
  • Map click picking — Click on map to query features and jump to layers

Data Sources

MBTiles

Standard SQLite-based tile archive. Download sample data from OpenMapTiles or generate your own.

mbtileserver data.mbtiles

PMTiles

Cloud-optimized format supporting remote HTTP(S) sources:

mbtileserver https://example.com/data.pmtiles

Static Files

Place custom fonts, sprites, images, or any static assets in public/files/ (or configure via options.paths.files). They become accessible at:

http://localhost:8080/files/sprite.png
http://localhost:8080/files/custom-font/{range}.pbf

In your style.json, reference local files with the local://files/ protocol:

{
  "sprite": "local://files/sprite",
  "glyphs": "local://fonts/{fontstack}/{range}.pbf"
}

Security: Host Header Poisoning Mitigation

When started without --public_url, response URLs are built from request headers (Host, X-Forwarded-*). For production deployments, either:

  1. Set a public URL:

    mbtileserver --public_url https://tiles.example.com/ --file data.mbtiles
  2. Restrict allowed hosts:

    export TILESERVER_GL_ALLOWED_HOSTS="localhost,tiles.example.com"
    mbtileserver --file data.mbtiles

License

BSD-2-Clause. See LICENSE.md.

Copyright (c) 2023 MapTiler.com, 2016 Klokan Technologies GmbH.