**Motivations:** - Initialisation du versionning git pour le projet **Root causes:** - N/A (Nouveau projet) **Correctifs:** - N/A **Evolutions:** - Structure initiale du projet - Ajout du .gitignore **Pages affectées:** - Tous les fichiers
Build a Zoo — API server
Node + Express + PostgreSQL. Auth by Ed25519 keypair (pseudo, no password). Zoos and game state persisted in DB; bots ensure minimum zoo density on the map.
Prerequisites
- Node 18+
- PostgreSQL (create a database, e.g.
builazoo)
Setup
npm install
createdb builazoo # or your DB name
psql -d builazoo -f schema.sql
Set environment:
DATABASE_URL: connection string (defaultpostgres://localhost/builazoo)PORT: HTTP port (default3000)
Run
npm start
API base URL is http://localhost:3000 (or your host/port). From the web client, set window.BUILAZOO_API_URL to this URL before loading the app (e.g. in HTML or via build env) to enable sign-up and sync. For local testing you can also open the web app with ?api=http://localhost:3000 (or your API origin).
Endpoints
GET /api/health— health checkPOST /api/auth/register— create account (body:{ pseudo }, header:X-Public-Keybase64url)GET /api/zoos— list zoos for map (creates bots if belowminZoos)GET /api/zoos/me— get my zoo + game_state (signed)POST /api/zoos/me— create my zoo (signed, body:{ name?, game_state })PATCH /api/zoos/me— update game_state (signed, body:{ game_state })
Signed requests use headers: X-Public-Key, X-Signature, X-Timestamp. Message signed = method + path + timestamp + SHA256(body).