diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..60f6e4b --- /dev/null +++ b/.env.example @@ -0,0 +1,15 @@ +# Hostname or IP your users will reach this box on (no scheme, no port) +PUBLIC_HOST=localhost + +# Where the Regress UI/API is reachable from browsers +PUBLIC_URL=http://${PUBLIC_HOST}:8096 + +# How close (meters) a player must physically be to a place to claim it or +# link from it. Mirrors Ingress's "you must be at the portal" rule. +CLAIM_RADIUS_METERS=40 + +# BTC Map sync area — defaults to Madeira, Portugal (Funchal-centered). +# See DESIGN.md for why this scope was chosen first. +BTCMAP_CENTER_LAT=32.7607 +BTCMAP_CENTER_LON=-16.9595 +BTCMAP_RADIUS_KM=45 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2cdda0d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +node_modules/ +dist/ +*.log +.env +server/data/ +frontend/dist/ +.DS_Store diff --git a/README.md b/README.md index 732429b..ab9e3e5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,56 @@ -# regress +# Regress -Nostr-based location game on Archipelago — recreates BTC Maps unclaimed businesses as capturable portals, starting with Madeira \ No newline at end of file +A location-based capture game in the spirit of *Ingress*, built as a nostr-native +web app. Real Bitcoin-accepting businesses from [BTC Map](https://btcmap.org) +stand in for Ingress's portals — players physically visit them to claim them +for their team (orange or green), then link claimed places into triangular +control fields. First scope: **Madeira, Portugal**. + +See [`DESIGN.md`](./DESIGN.md) for the full research/design writeup. + +## Stack + +- `server/` — Fastify + better-sqlite3 + nostr-tools (TypeScript), same pattern + as [podsteadr](http://146.59.87.168:3000/ssmithx/podsteadr). +- `frontend/` — Vue 3 + Vite + Pinia + Tailwind + Leaflet. +- Auth is NIP-98 (signed-event login → session cookie), same as podsteadr. + `frontend/public/nostr-provider.js` is vendored so the app can also be + launched identity-aware from inside an Archipelago dashboard, the same way + as podsteadr — see that repo's README for how the registration side works. + +## Running locally + +```bash +# server +cd server +npm install +npm run dev # http://localhost:8096 + +# frontend (separate terminal) +cd frontend +npm install +npm run dev # http://localhost:5173, proxies /api to :8096 +``` + +On first run, the `places` table is empty — call `POST /api/sync` (or click +"Sync from BTC Map" in the UI) to pull the current Madeira dataset from BTC +Map's public API. + +## Game rules (v0) + +- Claiming or linking from a place requires being within `CLAIM_RADIUS_METERS` + (default 40m) of it, via browser geolocation — no claiming from the couch. +- Claiming an enemy-held place captures it for your team and tears down any + links running through it. +- A link can be created between any two places your team currently holds, + as long as you're standing at the origin place — no maximum link distance. +- Three mutually-linked, same-team places form a field (computed live, not + stored) — see `server/src/services/fields.ts`. +- Team choice is one-way once made. + +## Tests + +```bash +cd server +npm test +``` diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..2f443c4 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,17 @@ + + +
+ + ++ Claim real Bitcoin-accepting businesses for your team. Log in with Nostr to start. +
+ ++ No NIP-07 extension detected — install Alby or nos2x, or open this app from the Archipelago dashboard. +
+{{ error }}
+{{ selectedPlace.address }}
++ Status: + unclaimed + + claimed by {{ selectedPlace.claim_team }} + +
+ +{{ actionError }}
+No places loaded yet — pull the current Madeira dataset from BTC Map.
+ ++ This choice is permanent — you can't switch teams later, so pick the side you're actually playing for. +
+{{ error }}
+