# AGENTS.md — Pram Project Guide
> This file is for AI agents. Read this first before making any changes.
---
## 1. Project Identity
- **Name:** `pram` — AI-powered multi-language test practice platform.
- **Repo type:** Turborepo monorepo (Bun workspaces).
- **Workspace packages:** `apps/*`, `packages/*`.
- **Runtime & package manager:** **Bun** (`packageManager: "bun@1.3.11"`).
- Do **NOT** use `pnpm`, `npm`, or `yarn` unless explicitly required by a global tool.
---
## 2. Technology Stack
| Layer | Technology | Notes |
|-------|------------|-------|
| Frontend | React 19 + Vite + TanStack Router | File-based routing. **Not Next.js.** |
| Backend | Hono + tRPC | Entry: `apps/server/src/index.ts`. Port 3000. |
| DB Engine | PostgreSQL | Managed via Drizzle. |
| DB ORM | Drizzle ORM | **Not Prisma.** |
| Auth | Better-Auth | Email/password + OAuth. |
| UI | shadcn/ui (shared) | Lives in `packages/ui`. Imported as `@pram/ui/components/*`. |
| AI | OpenAI-compatible API | User-managed API keys via Settings UI. |
| Build | Turborepo + `tsdown` | Server compiled with `tsdown`. |
---
## 3. Architecture Overview
```
pram/
├── apps/
│ ├── web/ # Frontend (Vite, TanStack Router) — Port 5173
│ └── server/ # Backend (Hono, tRPC) — Port 3000
├── packages/
│ ├── ui/ # Shared shadcn/ui components & styles
│ ├── api/ # tRPC routers & business logic
│ ├── auth/ # Better-Auth configuration
│ ├── db/ # Drizzle schema, queries, migrations
│ ├── ai/ # AI generation: prompts, schemas, agentic pipeline
│ ├── env/ # Shared environment validation
│ └── config/ # Shared TypeScript configs
```
- **Internal imports** use the `@pram/*` workspace namespace.
- Do **NOT** create cross-imports between `apps/*` directly; route through `packages/*`.
---
## 4. Essential Commands
Use these exact commands. Do not substitute with `pnpm`/`npm`/`npx` equivalents.
```bash
# Install dependencies
bun install
# Development
bun run dev # Start all apps (web + server)
bun run dev:web # Start web app only
bun run dev:server # Start server only
# Type checking
bun run check-types # Check all packages
# Database (Drizzle)
bun run db:push # Push schema changes to PostgreSQL
bun run db:studio # Open Drizzle Studio UI
bun run db:migrate # Run migrations
bun run db:generate # Generate migration files
bun run db:seed # Seed reference data (exam types, etc.)
bun run db:start # Start local DB (if configured)
bun run db:stop # Stop local DB
# Testing
bun test # Run all tests
bun run turbo test # Run via turbo pipeline
# Build
bun run build # Build all packages
```
---
## 5. Common Pitfalls — DO NOT
- ❌ **Do not use `pnpm` / `npm` / `yarn`** for package management or running scripts.
- ❌ **Do not assume Docker or Docker Compose** exists in this repo. There are no Dockerfiles or compose files.
- ❌ **Do not assume Next.js**. This project uses **Vite + TanStack Router**, not Next.js App Router or Pages Router.
- ❌ **Do not assume Prisma**. Database layer is **Drizzle ORM**.
- ❌ **Do not hardcode API keys** in source code. AI keys are user-managed via the Settings UI.
- ❌ **Do not add global CSS** in `apps/web` without checking `packages/ui/src/styles/globals.css` for existing design tokens and CSS variables.
- ❌ **Do not skip heading levels**. After `
`, the next heading must be `
`, not `
` (or lower). Never have two `
` on one page.
- ❌ **Do not create custom modal/dialog components**. Use shadcn `