A simple map visualization app built with Astro, Preact, and MapLibre GL JS. Upon visiting the site, location data is extracted from the Cloudflare request headers and stored in a SQLite database.
- Create a new Cloudflare D1 database.
- Update the variables in
wrangler.tomlto match your database under[[d1_databases]]. - Create a
.dev.varsand.envfiles based on.dev.vars.exampleand.env.exampleand setCLOUDFLARE_ACCOUNT_ID,CLOUDFLARE_DATABASE_ID,CLOUDFLARE_D1_TOKEN(you can refer this doc on how to create D1 specific token) andCLOUDFLARE_D1_BINDINGenvironment variables. - Ensure you're on Node.js 20.17.0 and pnpm 9.9.0.
- Run
pnpm installto install the dependencies. - Run
pnpm db:generateto generate the database migrations. - Run
pnpm db:migrateto apply the migrations. - Run
pnpm dev:allto start the development server and the database studio. - To actually log the coordinates, you'll have to use Cloudflare Tunnel to proxy the development server, else 0, 0 would be logged.
- Just install
cloudflaredand runcloudflared tunnel --url http://localhost:4321(or the port your dev server is running on) to get a URL to visit.


