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 Turso account and create a new database.
- Create a
.dev.vars
file based on.dev.vars.example
and set theTURSO_CONNECTION_URL
andTURSO_AUTH_TOKEN
environment variables. - Ensure you're on Node.js 20.17.0 and PNPM 9.9.0.
- Run
pnpm install
to install the dependencies. - Run
pnpm db:generate
to generate the database migrations. - Run
pnpm db:migrate
to apply the migrations. - Run
pnpm dev:all
to 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
cloudflared
and runcloudflared tunnel --url http://localhost:4321
(or the port your dev server is running on) to get a URL to visit.
- Set the
TURSO_CONNECTION_URL
andTURSO_AUTH_TOKEN
environment variables in the Cloudflare dashboard. - Also set the
NODE_VERSION
to20.17.0
andPNPM_VERSION
to9.9.0
. It should look something like this: - Enable build cache
- Deploy to your branch, connect your domain and also enable location headers and you're good to go! 🎉