# {{projectName}}

**Built with [DoNotDev Framework](https://donotdev.com)**

## Setup

**Start the app first — the homepage walks you through everything:**

```bash
bun install
bun dev
```

Open the app and follow the setup steps on the homepage (Git, Firebase, Stripe, etc.).

## Environment Variables

**Each app has its own `.env` file.** Vite loads from the app directory only.

```
{{projectName}}/
├── .env.example              ← NOT loaded by Vite (reference only)
├── apps/
│   └── my-app/
│       ├── .env              ← Vite reads THIS one
│       ├── .env.local         ← Overrides .env (gitignored)
│       ├── .env.production    ← Production overrides
│       └── .env.staging       ← Staging overrides (used by dndev staging)
└── functions/
    └── .env                   ← Server-side secrets (Stripe, OAuth, etc.)
```

**To set up:** Copy `.env.example` to `.env` in your app directory and fill in the values.

```bash
cp apps/my-app/.env.example apps/my-app/.env
```

## CLI Commands

```bash
# Development
bun dev                      # Start dev server
dndev emu start              # Start Firebase emulators (Auth, Firestore, Functions)

# Deployment
dndev deploy                 # Deploy to Firebase (hosting + functions + rules)
dndev staging                # Deploy to staging environment
dndev sync-secrets           # Push functions/.env secrets to Firebase Secret Manager

# Quality
dndev tc                     # Type-check (preferred)
bun test                     # Run tests
dndev build                  # Production build (or bun run build per app)
```

## Project Structure

```
{{projectName}}/
├── apps/
│   └── my-app/
│       ├── src/
│       │   ├── pages/        # Auto-discovered routes (*Page.tsx)
│       │   ├── config/       # App config (app.ts, legal.ts)
│       │   └── locales/      # Translations (optional)
│       ├── .env              # App environment variables
│       └── vite.config.ts    # Vite config
├── entities/                 # Entity definitions (shared across apps)
├── functions/                # Firebase Cloud Functions
│   └── .env                  # Server-side secrets
├── AGENTS.md                 # AI agent runbook (MCP: get_guideline / search_framework)
├── CLAUDE.md                 # Claude Code import bridge (one line: @AGENTS.md)
├── firebase.json             # Firebase config
├── firestore.rules           # Firestore security rules (generated by Phase 4)
└── .firebaserc               # Firebase project aliases
```

## Building with AI

1. Enable **MCP** (donotdev server — see `.mcp.json` / `.cursor/mcp.json`).
2. Point the agent at root **`AGENTS.md`** (and **`CLAUDE.md`** if using Claude Code — it imports `AGENTS.md`).
3. The agent should run **`list_features()`**, then **`start_phase(0)`**, and use **`get_guideline`** / **`lookup_symbol`** instead of guessing APIs.

Quick reference: MCP **`get_guideline("AGENT_START_HERE")`**. WAI-WAY overview: **`get_guideline("WAI_WAY_CLI")`** (shipped with `@donotdev/mcp-server`).

## Key Files

| File | Purpose |
|------|---------|
| `entities/*.ts` | Data model definitions — CRUD, forms, lists auto-generated |
| `src/pages/*Page.tsx` | Pages — auto-discovered as routes by filename |
| `src/config/app.ts` | App name, preset, features |
| `src/config/legal.ts` | Company info, legal compliance |
| **`AGENTS.md`** | Project runbook for the agent (golden path, phases, MCP tools) |

---

**Need help?** Use MCP **`search_framework`** / **`get_guideline`**; see root **`AGENTS.md`**.
