# {{ project_title }} — Installation Guide

## Prerequisites

- **Python** >= 3.13 (see `.python-version`)
- **Node.js** >= 22 (see `.nvmrc`)
- **PostgreSQL** >= 15 (or use the Docker Compose setup)
- **uv** (recommended) or pip for Python dependency management
- **pnpm** (recommended) or npm for Node dependency management

## Quick Start

```bash
# 1. Clone the repository
git clone <repository-url>
cd {{ project_name }}

# 2. Install all dependencies
prisme install

# 3. Set up environment variables
cp .env.example .env
# Edit .env with your database URL and secrets

# 4. Run database migrations
prisme db migrate

# 5. Start development servers
prisme dev
```

## Manual Setup

### Backend

```bash
cd packages/backend

# Install Python dependencies
uv sync --all-extras

# Run migrations
uv run alembic upgrade head

# Start the API server
uv run uvicorn {{ project_name_snake }}.main:app --reload --port 8000
```

### Frontend

```bash
cd packages/frontend

# Install Node dependencies
pnpm install

# Start the dev server
pnpm dev
```

## Environment Variables

Copy `.env.example` to `.env` and configure:

| Variable | Description | Default |
|----------|-------------|---------|
| `DATABASE_URL` | PostgreSQL connection string | `postgresql+asyncpg://postgres:postgres@localhost:5432/{{ project_name_snake }}` |
| `SECRET_KEY` | JWT signing key | (generate a random string) |
| `CORS_ORIGINS` | Allowed CORS origins | `http://localhost:5173` |

## Docker Setup

If you prefer Docker:

```bash
# Start all services (database, backend, frontend)
docker compose -f docker/docker-compose.yml up -d

# Run migrations inside the container
docker compose -f docker/docker-compose.yml exec backend uv run alembic upgrade head
```

## Running Tests

```bash
# Backend tests
cd packages/backend && uv run pytest

# Frontend tests
cd packages/frontend && pnpm test
```

## Useful Commands

| Command | Description |
|---------|-------------|
| `prisme dev` | Start all development servers |
| `prisme install` | Install all dependencies |
| `prisme generate` | Regenerate code from spec |
| `prisme db migrate -m "description"` | Create a new migration |
| `prisme validate` | Validate the spec file |
