Setup
Setup
Prerequisites
- Bun (version 1.4.4, as pinned by
packageManagerinpackage.json) - Docker Compose
Installation
-
Install dependencies:
bun install -
Start PostgreSQL via Docker Compose:
bun run db:startThis starts a PostgreSQL 16 container using the configuration in docker-compose.yml. The database is accessible at
localhost:5433(or the port set byPOSTGRES_PORT). -
Push the database schema:
bun run db:pushThis uses Drizzle ORM to push the schema defined in the
@os/dbpackage to the database. -
Generate environment types (if needed):
bun run env:generateThis reads
.env.schemafiles in each app and package and generates TypeScript types insrc/env.tsvia varlock. Run this after modifying any.env.schemafile.
Development
Run both development servers:
bun run dev
This starts:
- Admin UI (Next.js) at http://localhost:3001
- Server API (Hono + oRPC) at http://localhost:3000
To run them separately:
bun run dev:admin # Admin UI only
bun run dev:server # Server API only
Checking the codebase
Run linting, formatting, and TypeScript checking across all workspaces:
bun run check
This command runs ultracite (for linting and formatting) and vp run -r check-types (for TypeScript checking).
Additional notes
- The Docker Compose configuration (docker-compose.yml) defines:
postgres: PostgreSQL 16-alpine service, exposing port 5432 internally and mapping to host port 5433 (or custom viaPOSTGRES_PORT)server: The Hono/oRPC server service, which connects to the database via theDATABASE_URLenvironment variable
- Environment variables for each app are stored in
.envfiles (e.g.,apps/server/.env) and are managed by varlock. The.env.schemafiles define the expected variables and their types. - For information on scaffolding new components using the better-t-stack template, see the
bts.jsoncfile and runbunx create-better-t-stack@latest add. - Related documentation: