Development #
This document covers day-to-day local development for Lively Forms.
Prerequisites #
- Bun
- Podman + Podman Compose, or Docker with Compose
- PostgreSQL and Garage containers via
compose.yaml - ATProto OAuth/client metadata for creator sign-in during local development
Local setup #
bun install
bun run hooks:install
cp .env.example .env
bun run db:up
bun run prisma:migrate
bun run storage:init
bun run dev
Open http://127.0.0.1:3000.
bun run storage:init prepares the Garage container for file uploads and prints the S3_* lines to paste into .env; see File uploads.
For environment variables and OAuth setup details, see deployment.md.
Daily workflow #
Start the database and object storage #
bun run db:up
This starts Postgres on 127.0.0.1:5432 and Garage with its S3 API on 127.0.0.1:3900.
Start the app #
bun run dev
Stop the database #
bun run db:down
View database logs #
bun run db:logs
Reset the local database volume #
bun run db:reset
Database workflow #
Generate Prisma client after schema changes:
bun run prisma:generate
Create and apply a local migration during development:
bun run prisma:migrate
Open Prisma Studio:
bun run prisma:studio
File uploads #
The FILE_UPLOAD block stores files in S3-compatible object storage. Locally this is Garage (dxflrs/garage:v2.4.1 in compose.yaml), configured by garage/garage.toml as a single node with replication_factor = 1 and a sqlite metadata store. The app only speaks the S3 API with path-style addressing, so any other S3 service works the same way.
After the first bun run db:up:
bun run storage:init
The script (scripts/garage-init.sh) assigns the node to the layout, creates the lively-forms bucket and a key with read, write and owner permissions, sets a CORS rule for http://127.0.0.1:3000 through scripts/garage-cors.ts, and prints the S3_* variables for .env. Running it again is harmless. Set UPLOAD_CORS_ORIGIN before running it if the app is served from another origin.
The browser uploads straight to Garage with a presigned URL, so the origin must be allowed by the bucket's CORS rule or the PUT fails in the browser with a CORS error while curl succeeds.
Abandoned uploads (requested but never submitted) are removed by:
bun run uploads:cleanup
bun run db:reset also wipes the Garage volumes, so bun run storage:init has to run again afterwards.
Quality checks #
Run the full local verification suite used by CI:
bun run check
Run lint only:
bun run lint
Run a production build only:
bun run build
Install git hooks for this repo:
bun run hooks:install
Notes:
- The pre-commit hook runs
bun run check, which includes formatting, unit tests, linting, type-checking, and a production build. bun run buildalso validates translation resources before the Next.js build.bun testruns the unit tests,bun run test:e2eruns the Playwright tests ine2e/.bun run deployrunsscripts/deploy.sh, which ships the working tree over ssh to the host inDEPLOY_HOST(the author's setup, see deployment.md).
Important directories #
app/— App Router pages, layouts, and API routescomponents/— UI and feature componentslib/— business logic, auth, forms, branching, i18n, exportslocales/— translation YAML filesprisma/— schema and migrationsdocs/— project documentationopenspec/— product/spec workflow artifacts
Important files #
lib/blocks.ts— block types, config parsing, branch operator supportlib/branching.ts— branching resolution and validation helperslib/forms.ts— form loading, publish flow, submission shaping, response accesslib/uploads.ts— file upload validation, verification and cleanup ruleslib/object-storage.ts— S3 client and presigned URLscomponents/form-builder.tsx— creator builder shellcomponents/form-builder-panels.tsx— block settings and branching controlscomponents/public-form-runner.tsx— public respondent flow
Notes for contributors #
- Use
buncommands for project workflows. - Creator routes require authentication; public form routes do not.
- Responses are stored anonymously.
- Editing a published form updates the live public form immediately.
- When changing UI copy, update both
locales/en.ymlandlocales/ru.yml.