DOCS / DEVELOPMENT / LOCAL DEVELOPMENT
Local Development
Workspace-wide commands
| Command | Purpose |
|---|---|
bun install | Install every workspace's dependencies. |
bun run check | Format + format-check + lint. Run before pushing. |
bun run test | vitest run, repo-wide. |
bun run typecheck | Typecheck every workspace (packages/api-contract, apps/gateway, then apps/dashboard's own nuxt typecheck). |
bun run fmt / bun run fmt:check | oxfmt, write or check-only. |
bun run lint | oxlint, type-aware. |
Per-app filtering
bash
Authorization: Bearer lattice_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Root package.json defines gateway, dashboard, and docs as shorthands for the respective bun --filter.
Gateway (apps/gateway)
| Command | Purpose |
|---|---|
bun run dev | nitro dev, default :3001. |
bun run build / preview | nitro build / nitro preview. |
bun run db:migrate | Apply pending Drizzle migrations. |
bun run db:generate | Generate a new migration from schema changes. |
bun run db:studio | Drizzle Studio against the gateway's DB. |
bun run generate-pepper | Print a fresh API_KEY_PEPPER. |
bun run seed <name> | Create an application + its first API key. |
bun run seed-management-key <name> | Mint a management API key. |
Dashboard (apps/dashboard)
| Command | Purpose |
|---|---|
bun run dev | nuxt dev, default :3000. |
bun run build / preview | nuxt build / nuxt preview. |
bun run typecheck | nuxt typecheck. |
bun run db:migrate | Apply better-auth's schema migrations against the dashboard's own DB. |
bun run db:studio | Drizzle Studio against the dashboard's DB. |
Running one app against a real gateway
The dashboard and gateway are independently runnable — you don't need both if you're only changing one. To iterate on the dashboard alone, point LATTICE_GATEWAY_URL at any running gateway (local or shared) and skip standing up a second Postgres database for gateway data.
CI order
text
type ProviderAdapter = {
id: ProviderId;
createChatCompletion(
request: ChatCompletionRequest,
ctx: ProviderRequestContext,
): Promise<ChatCompletionResponse>;
streamChatCompletion(
request: ChatCompletionRequest,
ctx: ProviderRequestContext,
): AsyncGenerator<ChatCompletionChunk, void, void>;
};
type ProviderRequestContext = {
apiKey?: string;
providerModel: string;
signal: AbortSignal;
}; Mirrors what bun run check plus bun run test do locally — running both before pushing catches everything CI will.
Git hooks (husky)
| Hook | Runs |
|---|---|
| Pre-commit | bun run stage → lint-staged: oxfmt + oxlint on staged *.{ts,vue,md,yml,json,css,html} files only. |
| Pre-push | bun run test (typecheck is intentionally commented out here — see Coding Standards). |
Hooks are installed automatically by the prepare script the first time you run bun install.
Testing
See Testing for the full layout and how to run a subset.
Database work
See Database & Migrations for the Drizzle Kit workflow shared by both apps.