Skip to content

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

ToolVersion
Node.js20 or newer
pnpm10 or newer
Dockerany recent

Setup

Terminal window
git clone https://github.com/your-org/fastify-admin
cd fastify-admin
pnpm install

Start the database:

Terminal window
docker compose up postgres -d

Start both the API and frontend in parallel:

Terminal window
pnpm dev
  • API server → http://localhost:3001
  • Web app → http://localhost:5173

Create a Dev Admin User

Terminal window
pnpm create-admin

Key Commands

CommandDescription
pnpm devStart API + frontend in parallel
pnpm dev:apiStart API only
pnpm dev:webStart frontend only
pnpm testRun all tests
pnpm test:watchRe-run tests on file changes
pnpm bundleBuild web + copy to ui/ + build package
pnpm releaseBundle then publish to npm
pnpm migration:createCreate a new MikroORM migration
pnpm migration:upRun pending migrations

Monorepo Structure

web/ ← React frontend (Vite + TanStack Router)
fastify-admin/ ← The npm package + dev server
types/ ← Shared HTTP contract types (@fastify-admin/types)
docs/ ← This documentation site (Astro Starlight)
test-app/ ← Minimal app for manual integration testing

See Project Structure for a deeper breakdown.


Running Tests

Tests use a real PostgreSQL database. Set these in fastify-admin/.env:

TEST_DB_NAME=fastifyadmin_test
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=password

Then run:

Terminal window
pnpm test

Each suite spins up a full Fastify app, runs tests, then tears down. See Testing for details on writing tests.