Development
How to run Hoopoe locally, how to run the tests, and how to submit a change. This page assumes you have Docker and (optionally, for a nicer dev loop) Node 20 installed.
Local setup
Clone and generate secrets:
git clone https://github.com/Gekkotron/Hoopoe.git
cd Hoopoe
./install.sh
install.sh writes a .env file with strong random secrets. Edit it
if you want to change ports or DB credentials; the defaults are fine
for local dev.
Bring the stack up:
docker compose up --build
The first build is slow (Node install + Postgres extensions). Later starts are fast. Open http://127.0.0.1:8000.
Running the app in dev mode
docker compose up uses the production build of the frontend. For
active frontend work with HMR, you'll want to run the Vite dev server
directly:
cd frontend
npm install
npm run dev
The backend still runs in Docker; the Vite dev server proxies /api
to http://127.0.0.1:8001 per frontend/vite.config.ts.
Running the tests
Backend tests are split into two tiers.
Unit and route tests (no database)
Most backend tests run without a database:
cd backend
npm install
npm test
The DB-gated tests are marked describe.skipIf(!RUN_DB_TESTS) and
will show as skipped in this run — that's expected.
DB-gated integration tests
The route/integration tests need a real Postgres. They are gated
behind the RUN_DB_TESTS=1 environment variable.
⚠️ You cannot point them at your real database. These tests reset state with unconditional whole-table deletes (
db.delete(transactions),db.delete(accounts),db.delete(users), …) against whateverDATABASE_URLis set to. Pointing them at your real database would wipe it. They also assume a fresh, empty, migrated database (onboarding only succeeds when no user exists).
The safe way to run them is the wrapper script, which spins up a
throwaway postgres:16-alpine on tmpfs, applies migrations, runs the
suite with RUN_DB_TESTS=1, and tears everything down:
bash backend/scripts/test-db.sh
Pass args straight through:
bash backend/scripts/test-db.sh tests/transactions-route.test.ts # one file
bash backend/scripts/test-db.sh -t "running balance" # by test name
Set KEEP_TEST_DB=1 to leave the stack up for debugging (the script
prints how to tear it down).
Without the wrapper, the same thing is:
docker compose -f docker-compose.test.yml run --rm --build backend-test
docker compose -f docker-compose.test.yml down -v
On a dev machine with npm, cd backend && npm run test:db calls the
same script.
How it works
docker-compose.test.ymldefines two throwaway services:test-db(ephemeral Postgres) andbackend-test.backend-testbuilds theteststage ofbackend/Dockerfile(build stage + test files). Its entrypoint (backend/scripts/docker-test-entrypoint.sh) applies migrations, then runsvitest run.- Everything is isolated in its own compose project with test-only credentials, so it cannot collide with the real stack.
Relation to CI
.github/workflows/ci.yml does the same thing (disposable Postgres →
migrate → RUN_DB_TESTS=1 test run), so this is the local equivalent
of a CI database run.
Type checking and linting
cd backend
npm run typecheck
cd frontend
npm run typecheck
npm run lint
Both must pass before you commit.
Commit and PR conventions
- One logical change per commit. If your change touches multiple concerns, split them.
- Commit messages use
type(scope): summarywheretypeisfeat,fix,refactor,docs,test, orchore. - Pull requests should describe why, not just what. The diff covers the what.
- CI must be green before merge.
Where to go next
- Architecture — how the pieces fit together.
- Code map — where things live.
- Database — schema and migrations.