Thanks for helping make Databuddy better. Bug reports, docs fixes, and code contributions are all welcome. For a new feature, open an issue first so we can agree on the scope before you start.
Want to run your own instance? Follow the self-hosting guide. This guide is for working on Databuddy itself.
You'll need Docker Compose, Node.js LTS, and the Bun version pinned in
package.json.
git clone --branch staging https://github.com/databuddy-analytics/Databuddy.git
cd Databuddy
bun install --frozen-lockfile
cp .env.example .envIn .env, set SELFHOST=true to work without hosted billing. Set
BETTER_AUTH_SECRET and DATABUDDY_ENCRYPTION_KEY to separate random values.
The example database URLs match the local Docker services.
docker compose up -dOnce the databases are ready, create the schemas and start the app:
bun run db:push
bun run clickhouse:init
bun run dev:dashboardOpen localhost:3000. The dev command builds the SDK and devtools for you. Add provider keys only for the features you're working on; see optional services.
To explore with sample data, run bun run workspace --reset. It targets the
local Docker services only and prints the website. Without --website, it
prints a password for a newly created default account or directs you to use
the existing account's password. It prints an API key only when it creates
the default website. Add --anomaly for a traffic spike and error surge that
Insights will flag, or
--website YOUR_WEBSITE_ID to seed a website you already made. The optional
--events N sets an approximate event target of up to 100,000 across 28 days;
session sizes, weekend traffic and anomaly variation affect the number written.
The command prints the actual inserted counts.
Run these from the repo root before pushing:
bun run lint
bun run check-types
bun run testUse bun run format for formatting with Ultracite/Biome. Package scripts in
package.json and each app's package.json cover other tasks.
For changes to published packages, add a changeset with bun run changeset.
To check self-host initialization against disposable databases, run
bash scripts/test-selfhost-init.sh. It needs Docker Compose 2.24.4 or later and
creates and removes its own test databases.
-
Check open PRs for overlapping work. Start one focused branch from current
staging:git switch staging git pull --ff-only origin staging git switch -c codex/short-description
-
Keep each branch and PR to one change that can be reviewed and reverted on its own. Use a separate worktree for parallel work; one person or agent should edit a branch at a time.
-
Commit by intent, with a scope:
fix(api): handle missing session. Keep unrelated changes in separate commits and PRs. -
Push early and open a draft against
staging. Describe the problem, what changed, how you checked it, and any dependencies or overlaps. -
Rebase onto current
origin/stagingbefore review. If that changes reviewed code, request fresh review. A feature-branch dependency needs the owner's agreement andDepends on #…in both PRs; merge the prerequisite first. -
Mark the PR ready when checks pass. Wait for configured reviewers on the final commit, address every actionable comment, and resolve the review threads. Before merging, check again for pending reviews or unaddressed feedback; green CI alone isn't review approval.
-
After merge or closure, retire the branch and remove its finished worktree. Merged branches are deleted automatically; delete closed branches manually. Start fresh for the next change.
Keep code simple and type-safe, and use shared components and helpers where they fit. AGENTS.md has the repository conventions and full workflow.
AI assistance is welcome. Disclose the tool and how you used it, and personally review and test the result. AI-assisted PRs must reference an accepted issue. Read AI_POLICY.md before contributing with AI.