# tssbot.web-frontend

React/Vite frontend and production Node.js server for the TSS Bot web platform.

## Structure

- `frontend/` - React SPA (Vite + Tailwind v4)
- `server.cjs` - Production Node.js server (serves SPA, proxies API, analytics, uptime)
- `webhook.cjs` - GitHub deploy webhook listener
- `systemd/` - systemd unit files for all services
- `scripts/` - Deployment and test scripts

## Development

```bash
npm install
cp example.env .env  # edit with your values
npm run dev          # Vite dev server on :3001
```

## Build

```bash
npm run build        # Outputs to dist/
```

## Production

```bash
npm run build
node server.cjs      # Serves on PORT (default 3010)
```

## Deploy Webhook

```bash
node webhook.cjs     # Listens on WEBHOOK_PORT (default 3011)
```

## Environment Variables

See `example.env` for all available variables. Key ones:

| Variable | Description |
|---|---|
| `PORT` | Server port (default: 3010) |
| `API_UPSTREAM` | Backend API URL (default: http://127.0.0.1:6000) |
| `PUBLIC_ORIGIN` | Public-facing URL |
| `VITE_TURNSTILE_SITE_KEY` | Cloudflare Turnstile public key |
| `TURNSTILE_SECRET_KEY` | Cloudflare Turnstile secret key |
