Contributing
This guide is for contributors working on the fastify-admin source code. If you just want to use the package in your app, see Getting Started.
Requirements
| Tool | Version |
|---|---|
| Node.js | 20 or newer |
| pnpm | 10 or newer |
| Docker | any recent |
Setup
git clone https://github.com/your-org/fastify-admincd fastify-adminpnpm installStart the database:
docker compose up postgres -dStart both the API and frontend in parallel:
pnpm dev- API server →
http://localhost:3001 - Web app →
http://localhost:5173
Create a Dev Admin User
pnpm create-adminKey Commands
| Command | Description |
|---|---|
pnpm dev | Start API + frontend in parallel |
pnpm dev:api | Start API only |
pnpm dev:web | Start frontend only |
pnpm test | Run all tests |
pnpm test:watch | Re-run tests on file changes |
pnpm bundle | Build web + copy to ui/ + build package |
pnpm release | Bundle then publish to npm |
pnpm migration:create | Create a new MikroORM migration |
pnpm migration:up | Run pending migrations |
Monorepo Structure
web/ ← React frontend (Vite + TanStack Router)fastify-admin/ ← The npm package + dev servertypes/ ← Shared HTTP contract types (@fastify-admin/types)docs/ ← This documentation site (Astro Starlight)test-app/ ← Minimal app for manual integration testingSee Project Structure for a deeper breakdown.
Running Tests
Tests use a real PostgreSQL database. Set these in fastify-admin/.env:
TEST_DB_NAME=fastifyadmin_testDB_HOST=localhostDB_PORT=5432DB_USER=postgresDB_PASSWORD=passwordThen run:
pnpm testEach suite spins up a full Fastify app, runs tests, then tears down. See Testing for details on writing tests.