Backend-of-record for the Solana devnet faucet. The solana-devnet-faucet frontend is the only consumer; this service gatekeeps airdrops (validates GitHub eligibility, enforces per-IP / per-wallet / per-GitHub caps plus a 30-day rolling window, records each successful airdrop) and tracks faucet wallet health (periodic on-chain balance snapshots of the three source wallets for the frontend's balance-over-time view).
faucet.transactions— one row per successful airdrop (signature,ip_address,wallet_address,github_id,timestamp). Read byPOST /validateandGET /transactions/lastto enforce rate limits; written byPOST /transactions.faucet.solana_balances— on-chain balance snapshots of the faucet's source wallets. Written by a cron-style monitor job (POST /solana-balances) and read by the balances UI (GET /solana-balances/recent).
See docs/API.md for the full endpoint reference.
Spin up the API plus an ephemeral Postgres in one command:
docker compose up --build- API listens on
http://localhost:3000/api. Google-token auth is bypassed because compose setsAUTH_DISABLED=true(seesrc/routes/middleware/authorization.js); the app refuses to start with this set whenNODE_ENV=production. - Postgres is exposed on host port
5433— user/password/database are allfaucet. Connect withpsql postgres://faucet:faucet@localhost:5433/faucetto inspect. - Schema from
docker/init.sqlis applied on first boot. src/andserver.jsare bind-mounted read-only and the container runs undernode --watch, so file edits reload without a rebuild.GH_TOKENSis passed through from your host env if set; without it,/validateand the GitHub check will error at request time (the app still boots fine).
Teardown:
docker compose down # stop containers, keep the Postgres volume
docker compose down -v # also wipe the Postgres volume for a clean slateUse this path if you want to run the API directly against your own Postgres (or the Cloud SQL Auth Proxy).
-
Clone the repository
git clone <repository-url>
-
Install dependencies
npm install
-
Copy
.env.exampleto.envand fill in values.NOTE to send requests directly to Analytics DB, use the Cloud SQL Auth Proxy:
./cloud-sql-proxy --address 0.0.0.0 --port 5434 <SQL DB Connection String> -
Start the server
npm start
-
Access the API at
http://localhost:3000/api.
npm test # unit tests — fast, no external dependencies
npm run test:e2e # end-to-end tests — spin up an ephemeral Postgres via testcontainers (requires Docker)