# AGENTS.md ## Status Scaffold is in place and verified: Turborepo monorepo with `apps/api`, `apps/web` and `packages/shared`, CI on GitHub Actions, Biome as the only JS/TS tool and the text Bun lockfile committed. Not done yet: product features are just starting (sign-up, shopping lists, list items and invitations exist; there is no Google login and no email verification). The `health` module is the reference example. ## Stack (source of truth: `STACK.md`) - Monorepo orchestrated with **Turborepo** (see the managed block at the end of this file) - Backend: **Bun** + **Hono**, **Prisma 7** against **Postgres** (via `@prisma/adapter-pg`), **Zod** for validation, **Pino** for logging, **BetterAuth** for auth - Frontend: **React + Vite + TypeScript**, **Tailwind v4**, UI components from **shadcn/ui** - Frontend routing: **TanStack Router** (file-based) · server state: **TanStack Query** · forms: **React Hook Form + Zod** - Tooling: Bun workspaces, **Biome** (lint + format + import sorting), **TypeScript 6** ## Repository layout ``` apps/api/ Bun + Hono API (owns the Prisma schema and migrations) prisma/ schema.prisma and (once created) migrations/ src/app.ts createApp(): middleware chain, BetterAuth mount, module mounting src/index.ts Bun entrypoint: exports { port, fetch } src/lib/ logger, prisma, auth, problem-details, validate, result-json src/modules/ modules///{route.ts,use-case.ts} (+ schema.ts, *.test.ts) src/types.ts AppEnv: c.get('logger') / c.get('requestId') apps/web/ React + Vite frontend src/routes/ file-based routes; routeTree.gen.ts is generated src/components/ ui/ (shadcn, vendored source) + layout/ (app shell) src/hooks/ TanStack Query hooks (e.g. use-health.ts) src/lib/ api-client, auth-client, query-client, utils packages/shared/ @superlist/shared: Result pattern + Problem Details helpers/types ``` ## Commands Run from the repo root. Verification order is `build`, then `lint` → `typecheck` → `test`. | Command | Effect | | --------------------- | ----------------------------------------------------------------------------- | | `bun run dev` | API on `:4100`, web on `:7153` (`bun run dev --filter=@superlist/web` for one) | | `bun run build` | `turbo run build` (API bundle + web production build) | | `bun run lint` | `biome check .` per package via turbo — fails on lint, format or import order | | `bun run lint:fix` | `biome check --write .` across the repo (lint fixes, formatting, imports) | | `bun run lint:ci` | `biome ci .` — whole repo, exactly what CI runs | | `bun run format` | `biome format --write .` (`format:check` to verify only) | | `bun run typecheck` | `tsc` per package (`apps/web` regenerates the route tree first) | | `bun run test` | `bun test` in the API, `vitest` in web and shared | | `bun run db:generate` | `prisma generate` (also needed after a fresh clone, before typechecking the API) | | `bun run db:migrate` | `prisma migrate dev` — needs a reachable Postgres | | `bun run db:studio` | Prisma Studio (long-running) | ## Conventions - **Package manager: Bun** — `bun install`, `bun run