You have a PostGIS table with a few hundred thousand geometries and you want it on a web map. Sending the whole table to the browser as GeoJSON does not scale: the file is huge, and the browser has to parse and draw everything even when the user is looking at one street. Vector tiles solve this. The map asks only for the small squares it is showing, at the zoom level it is showing, and each square carries only the features inside it.
There are good servers that do this from PostGIS, pg_tileserv and Martin among them. I wanted to understand what they do, so I wrote a small one. pg-tileserver is a vector tile server in Go that turns PostGIS tables into Mapbox Vector Tiles with ST_AsMVT and ST_TileEnvelope . It discovers layers on its own, serves TileJSON, keeps an in-memory LRU cache and ships a MapLibre preview page.
It is a learning project in the spirit of those two servers, not a replacement for them.
What it does
Layer discovery. At startup the server reads PostGIS's geometry_columns view.…