Skip to content

Contributing

  1. Make a branch from main: feat/, fix/, docs/, chore/, refactor/, test/ or perf/, then a short name.
  2. Make one change on the branch.
  3. Open a pull request. Never push to main.
  4. Merge with squash.

Before you merge, build and run what you changed. A merge to main deploys.

Several branches are built in parallel, so two branches can claim the same migration number. This workflow fixes that before it blocks a merge:

  1. On your branch, change apps/api/src/db/schema.ts and run pnpm db:generate. Commit the migration. Its number is temporary.
  2. Before you open a pull request, and again if main moves before you merge, run pnpm db:sync. It rebases the branch onto origin/main, rebuilds apps/api/drizzle/ as main has it, and regenerates your migration with the next free number.
  3. The pre-push hook runs pnpm db:check. It refuses a push that edits a merged migration, adds a migration on a branch that is behind main, has a snapshot collision, or changes schema.ts without a migration.

For a branch stacked on an unmerged branch, set DB_BASE=<that branch>. Never edit a migration that is on main. Each worktree uses its own database (budi_<worktree> for dev, budi_test_<worktree> for tests).

Every domain term has one meaning, in GLOSSARY.md. Add a new term there before you use it in code or copy. The Glossary page on this site is built from that file.