## Frontend Quick Start

```bash
cd frontend
npm ci
npm run dev
```

Default dev URL: `http://localhost:5173`

The frontend expects the 大时代 gateway WebSocket on `ws://localhost:8765` unless overridden.

## Recommended Local Backend Stack

Start the split backend services from the project root:

```bash
./start-dev.sh
```

That gives you:

- control plane at `http://localhost:8000/api`
- trading service at `http://localhost:8001`
- news service at `http://localhost:8002`
- runtime service at `http://localhost:8003/api/runtime`
- gateway WebSocket at `ws://localhost:8765`

## Frontend Environment Variables

You can point the frontend directly at those services with:

```bash
VITE_CONTROL_API_BASE_URL=http://localhost:8000/api
VITE_RUNTIME_API_BASE_URL=http://localhost:8003/api/runtime
VITE_NEWS_SERVICE_URL=http://localhost:8002
VITE_TRADING_SERVICE_URL=http://localhost:8001
VITE_WS_URL=ws://localhost:8765
```

There is also a starter template at [frontend/env.template](./env.template).

For production deployments, prefer:

```bash
cd frontend
npm ci
npm run build
```

This ensures the deployed frontend matches the checked-in `package-lock.json`.

## Direct-Service Coverage

Current direct-call coverage includes:

- runtime panel data loading
- gateway port/runtime discovery
- `story`
- `similar days`
- `range explain`
- `news for date`
- `news categories`
- selected trading reads such as price history and insider trades

If these variables are not set, the frontend falls back to local defaults and compatibility paths where they still exist.
