## Project: {{project-name}}

This is a **Turborepo monorepo** project named `{{project-slug}}`, built with Next.js and pnpm workspaces.

### Workspace Structure

```
apps/
  product/     ← main user-facing Next.js application
  website/     ← marketing / landing site (Next.js)
  admin/       ← internal admin panel (Next.js)
  storybook/   ← component browser for packages/ui

packages/
  ui/          ← shared React components (@{{project-slug}}/ui)
  tokens/      ← design tokens — CSS variables + TypeScript (@{{project-slug}}/tokens)
  types/       ← shared TypeScript interfaces and types (@{{project-slug}}/types)
  config/      ← shared tsconfig and eslint config (@{{project-slug}}/config)
```

### Build Commands (always run from repo root)

| Task | Command |
|------|---------|
| Install dependencies | `pnpm install` |
| Build one app | `pnpm turbo run build --filter=product` |
| Build all apps | `pnpm turbo run build` |
| Dev one app | `pnpm turbo run dev --filter=product` |
| Dev all | `pnpm turbo run dev` |
| Lint | `pnpm turbo run lint` |
| Type-check | `pnpm turbo run type-check` |
| Add dep to app | `pnpm add <pkg> --filter=product` |
| Add dep to package | `pnpm add <pkg> --filter=@{{project-slug}}/ui` |

### Shared Package Imports

Always import workspace packages by their scoped name:

```typescript
import { Button } from '@{{project-slug}}/ui';
import type { User } from '@{{project-slug}}/types';
import '@{{project-slug}}/tokens/css'; // CSS variables
```

Reference in `package.json` dependencies:
```json
{ "@{{project-slug}}/ui": "workspace:*" }
```

### Key Rules

- **Never** use `npm install` — always `pnpm install` from the repo root
- **Never** run `next build` or `next dev` directly inside an app directory — use `turbo run` from root
- **Always** add dependencies with `--filter` to target the correct workspace
- Turbo caches build outputs in `.turbo/` — run `pnpm turbo run clean` to clear cache
- The `packages/config` package exports shared `tsconfig.base.json` and eslint config

### Apps Overview

- **product**: The primary user-facing Next.js app. Port `3000` in dev.
- **website**: Marketing site. Port `3001` in dev.
- **admin**: Admin panel. Port `3002` in dev.
- **storybook**: Visual component browser for `packages/ui`. Port `6006` in dev.

### Next.js App Router

All apps use the Next.js App Router (`app/` directory). Page files are `page.tsx`, layouts are `layout.tsx`.
