Skip to content

Development

This guide walks you through setting up a local PizzaPi development environment, running the dev servers, and contributing changes.


You’ll need these installed before you start:

ToolWhy
Bun ≥ 1.1Runtime, package manager, test runner, and bundler. PizzaPi uses Bun exclusively — not Node, npm, yarn, or pnpm.
RedisThe relay server buffers session events in Redis. Run it locally or via Docker.
Docker (optional)Only needed if you prefer the containerized dev setup, or want to test production builds.
GitVersion control. You know this one.

  1. Clone the repository

    Terminal window
    git clone https://github.com/Pizzaface/PizzaPi.git
    cd PizzaPi
  2. Install dependencies

    Terminal window
    bun install

    This also applies any patches from the patches/ directory automatically.

  3. Run database migrations

    Terminal window
    bun run migrate

    This creates (or updates) the SQLite database at packages/server/auth.db.


Section titled “Option A — Without Docker (recommended for most development)”

Start Redis in one terminal:

Terminal window
redis-server

Then start the dev servers:

Terminal window
bun run dev

This launches both servers with hot-reload via concurrently:

PortServiceDetails
7492Bun API serverHTTP + WebSocket relay, hot-reloads on save
5173Vite UI dev serverReact app with HMR

Open http://localhost:5173 in your browser for the UI (it proxies API calls to :7492).

If you prefer containers, use the dev profile:

Terminal window
docker compose -f docker/compose.yml --profile dev up

This starts Redis, the API server, and the Vite UI server in containers with the repo mounted as a volume. Same ports as above.


packages/
protocol/ Shared TypeScript types for the relay wire protocol
tools/ Shared agent tools (bash, read-file, write-file, search)
server/ Bun HTTP + WebSocket relay server (auth, sessions, push notifications)
ui/ React 19 PWA web interface (Vite, TailwindCSS v4, Radix UI / shadcn)
cli/ CLI wrapper — launches pi with PizzaPi extensions and the runner daemon
docs/ This documentation site (Astro Starlight)
npm/ npm distribution — builds & publishes @pizzapi packages
docker/ Docker Compose (redis + server services)
patches/ Bun patches for upstream pi packages (auto-applied on bun install)

PizzaPi is a monorepo with ordered package dependencies. The build must follow this sequence:

protocol → tools → server → ui → cli

docs and npm are independent and can be built separately.

Terminal window
# Build everything (in correct order)
bun run build
# Build individual packages
bun run build:protocol
bun run build:tools
bun run build:server
bun run build:ui
bun run build:cli
# Build the docs site
bun run build:docs
# Type-check all packages at once
bun run typecheck
# Clean all dist/ directories
bun run clean
Terminal window
# Full dev environment (API server + Vite UI, hot-reload)
bun run dev
# Run just the server in dev mode
bun run dev:server
# Run just the UI in dev mode
bun run dev:ui
# Run the CLI from source
bun run dev:cli
# Run the runner daemon from source
bun run dev:runner
# Dev the docs site
bun run dev:docs

PizzaPi uses Bun’s built-in test runner — no additional frameworks needed.

Terminal window
# Run all tests
bun run test
# Run tests for a specific package (from the repo root)
bun test packages/server
bun test packages/tools
bun test packages/ui
bun test packages/cli
  • Co-locate tests next to their source: foo.tsfoo.test.ts
  • Integration tests go in packages/<pkg>/tests/
  • Import describe, test, and expect from bun:test
  • Keep tests fast — mock network/Redis/DB calls in unit tests
PackageWhat’s tested
serverValidation, security, sessions store, attachments, API routes, pruning
uiMessage grouping, session viewer utils, path utilities
toolsToolkit helpers, pi compatibility layer
cliPatch application and runtime behavior

The relay server uses SQLite (via Kysely) for user accounts and session metadata.

Terminal window
# Run pending migrations
bun run migrate

The database file lives at packages/server/auth.db. After schema changes, always run migrations.


PizzaPi patches some upstream pi packages to add relay streaming and other features. Patches live in the patches/ directory and are applied automatically during bun install.

Never edit files in node_modules directly. If you need to change upstream behavior:

  1. Make your changes in the installed package
  2. Generate a patch with bun patch
  3. Save it to patches/
  4. Verify with bun install (the patch is re-applied cleanly)

LayerTechnology
Runtime & package managerBun
LanguageTypeScript (strict mode, ESM throughout)
ServerBun.serve, better-auth, Kysely + SQLite, Redis, web-push
UIReact 19, Vite 6, TailwindCSS v4, Radix UI, shadcn/ui
Agent core@mariozechner/pi-coding-agent
DocsAstro Starlight
DeploymentDocker Compose

  • Hot reload covers both the API server and the Vite UI when using bun run dev. The server restarts on file changes; the UI uses Vite’s HMR.
  • Redis must be running for the server to start. If you see connection errors, check that redis-server is up (or docker compose up redis).
  • TypeScript errors? Run bun run typecheck to get a full picture across all packages at once.
  • Docs changes are previewed with bun run dev:docs at http://localhost:4321/PizzaPi/.
  • Build order matters. If you change protocol or tools, rebuild those before building downstream packages.

Architecture

Understand the relay protocol, event flow, and component design.

Architecture →