Quick start
From clone to a running web app, API and mobile app in about 5 minutes.
What you need
- Node.js 22+ and pnpm 10+ (
npm install -g pnpm) - Docker (Docker Desktop on macOS/Windows) for Postgres and the local mail inbox
- For mobile: the Expo Go app on your phone, or an iOS simulator / Android emulator
1. Install
git clone git@github.com:b2bkit/b2bkit.git my-app
cd my-app
pnpm install
2. Configure
cp .env.example .env
Open .env and set BETTER_AUTH_SECRET to a long random string:
openssl rand -base64 32
Everything else works as is for local development. See Configuration for every variable.
3. Start the database and mail inbox
pnpm db:up # Postgres on :5432, Mailpit on :1025 (SMTP) and :8025 (inbox)
pnpm db:migrate # create the tables
pnpm db:seed # optional: sample organizations, teammates and projects
4. Run web and API
pnpm dev
- Web app: http://localhost:3000
- API: http://localhost:3001 (
/healthanswers{"ok":true}) - Emails (verification, invitations, password reset): http://localhost:8025
Sign up, or sign in with the seeded account demo@b2bkit.dev / demo-password. You'll land on Projects inside the "Acme Agency" organization.
Want the admin panel? Make yourself a platform admin and open http://localhost:3000/admin:
pnpm admin:grant you@example.com
5. Run the mobile app
Keep pnpm dev running and start Expo in a second terminal:
pnpm dev:mobile
Scan the QR code with Expo Go (Android) or the Camera app (iOS). The app finds the API on your computer automatically when the phone is on the same Wi-Fi. If it can't, set the address explicitly in apps/mobile/.env:
EXPO_PUBLIC_API_URL=http://192.168.1.20:3001 # your computer's LAN IP
EXPO_PUBLIC_WEB_URL=http://192.168.1.20:3000
Sign in with the same account: you'll see the same organizations and projects as on the web.
6. Check everything
pnpm typecheck # all packages
pnpm test # API integration tests (uses the database from step 3)
Next steps
- Project structure: what lives where.
- Add a feature to web and mobile: table, endpoint and screens in one pass, by hand or with an AI agent.
- Auth and organizations, Email, Admin.
- Deploy to a VPS with Docker.
Troubleshooting
| Problem | Fix |
|---|---|
port 5432 is already allocated |
Another Postgres is running. Stop it, or change the port in docker-compose.yml and DATABASE_URL. |
DATABASE_URL is not set |
You skipped step 2: cp .env.example .env at the repo root. |
| Sign-in works on web but mobile shows "Network request failed" | The phone can't reach your computer. Use the LAN IP in EXPO_PUBLIC_API_URL and allow port 3001 in your firewall. |
| No emails arrive | Open http://localhost:8025. With SMTP_URL empty, emails are printed in the pnpm dev output instead. |