File size: 1,430 Bytes
177c3f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Frontend Setup (FeatureFlag)

This frontend connects to the FastAPI backend used by the feature rollout simulation.

## 1) Configure Environment

Create `frontend/.env.local` from `frontend/.env.example`:

```bash
NEXT_PUBLIC_API_URL=http://127.0.0.1:8000
```

If your backend runs on another port (for example 7860), set it accordingly.

## 2) Start Backend

From repository root:

```bash
python -m feature_flag_env.server.app
```

Default health endpoint:

- `http://127.0.0.1:8000/health`

## 3) Start Frontend

```bash
cd frontend
npm install
npm run dev
```

Open:

- `http://localhost:3000`

## 4) Configure API Key and URL in UI

In **Settings** page:

- Save your `X-API-Key` value.
- Save your API base URL if it differs from `.env`.
- Use **Test** to verify backend connectivity.

## UI pages

- **Dashboard** (`/`): core simulation overview + charts
- **Control** (`/flags`): the current backend simulation “flag” and manual rollout control
- **Monitoring** (`/monitoring`): `/monitoring/*` endpoints and raw `/metrics` output
- **AI Decisions** (`/ai-decisions`): action history + rewards

## Notes

- Backend CORS allowlist is configured through `FRONTEND_ORIGINS` in backend `.env`.
- Frontend API client supports fallback between common local ports (`8000`, `7860`) if no URL is configured.
- If monitoring endpoints are disabled in backend config, dashboard gracefully falls back to core health/state data.