---
type: "Reference"
title: "Setup"
openwiki_generated: true
verified:
  - by: openwiki/0.7.2
    at: 2026-10-14T20:42:32.326Z
---


# Setup

## Prerequisites

- [Bun](https://bun.sh/) (version 1.4.4, as pinned by `packageManager` in `package.json`)
- Docker Compose

## Installation

1. Install dependencies:
   ```bash
   bun install
   ```

2. Start PostgreSQL via Docker Compose:
   ```bash
   bun run db:start
   ```
   This starts a PostgreSQL 16 container using the configuration in [docker-compose.yml](../docker-compose.yml). The database is accessible at `localhost:5433` (or the port set by `POSTGRES_PORT`).

3. Push the database schema:
   ```bash
   bun run db:push
   ```
   This uses Drizzle ORM to push the schema defined in the [`@os/db`](repo://packages/db/) package to the database.

4. Generate environment types (if needed):
   ```bash
   bun run env:generate
   ```
   This reads `.env.schema` files in each app and package and generates TypeScript types in `src/env.ts` via [varlock](https://www.npmjs.com/package/varlock). Run this after modifying any `.env.schema` file.

## Development

Run both development servers:
```bash
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:
```bash
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:
```bash
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](../docker-compose.yml)) defines:
  - `postgres`: PostgreSQL 16-alpine service, exposing port 5432 internally and mapping to host port 5433 (or custom via `POSTGRES_PORT`)
  - `server`: The Hono/oRPC server service, which connects to the database via the `DATABASE_URL` environment variable
- Environment variables for each app are stored in `.env` files (e.g., `apps/server/.env`) and are managed by varlock. The `.env.schema` files define the expected variables and their types.
- For information on scaffolding new components using the better-t-stack template, see the [`bts.jsonc`](repo://bts.jsonc) file and run `bunx create-better-t-stack@latest add`.
- Related documentation:
  - [Deployment](/deployment)
  - [Quickstart](/quickstart)
  - [Testing checks](/testing/checks)