# AGENTS.md – Repository Quick‑Start Guide
**Purpose**: Give OpenCode agents the exact commands and conventions they need to work safely and efficiently in the *AITrader* codebase. Only include items that are easy to miss without explicit guidance.
---
## Project structure
- `app/routes/` – React Router 7 file-based routes (`landing.tsx` is the index/home page)
- `app/components/` – Shared React components
- `app/routes.ts` – Route definitions (uses `index` and `route` helpers from `@react-router/dev/routes`)
- `app/root.tsx` – Root layout with global HTML shell, Links, Meta, Scripts
- `app/app.css` – Global styles (Tailwind is configured via Vite)
- `tests/` – Playwright E2E tests
- `vitest.config.ts` / `vitest.setup.ts` – Unit test config (Vitest)
- `vite.config.ts` – Vite config with Tailwind and React Router plugins
- `react-router.config.ts` – React Router framework config
- `tsconfig.json` – TypeScript config (ES modules: `"type": "module"`)
## Core npm scripts (run from the repository root)
- `npm run dev` – Starts the dev server with HMR via **react-router dev**. Served at `http://localhost:5173`.
- `npm run build` – Produces a production build using **react-router build**. Output lives in `./build` with `client/` and `server/`.
- `npm start` – Serves the production bundle with `react-router-serve ./build/server/index.js`. Requires a prior `npm run build`.
- `npm run typecheck` – Runs **react-router typegen** then `tsc`. Must be run before committing TypeScript changes.
- `npm run test:e2e` – Runs Playwright E2E tests (server starts automatically via `playwright.config.ts`).
## Development workflow
1. **Install deps** – `npm install` (first time only).
2. **Start dev** – `npm run dev`. Changes are hot-reloaded; no manual restart.
3. **Iterate** – Edit files under `app/` (routes, components, loaders, actions).
4. **Validate** – Run `npm run typecheck` regularly; it catches missing typegen steps.
5. **E2E tests** – `npm run test:e2e` (Playwright handles server startup).
6. **Build & serve** – `npm run build && npm start`.
## Routing (React Router 7)
- `index()` routes render into the parent `