feat: add SPA controller, Traefik route, CI frontend build, and HOWTO update
- SpaController catch-all forwards non-API routes to index.html - Traefik SPA route at priority=1 catches all unmatched paths - CI pipeline builds frontend before Maven - Dockerfile adds multi-stage frontend build - HOWTO.md documents frontend development workflow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
46
HOWTO.md
46
HOWTO.md
@@ -302,6 +302,52 @@ Query params: `since`, `until` (ISO timestamps), `limit` (default 500), `stream`
|
||||
| HIGH | Unlimited | 50 | 90 days | + Debugger, Replay |
|
||||
| BUSINESS | Unlimited | Unlimited | 365 days | All features |
|
||||
|
||||
## Frontend Development
|
||||
|
||||
The SaaS management UI is a React SPA in the `ui/` directory.
|
||||
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
cd ui
|
||||
npm install
|
||||
```
|
||||
|
||||
### Dev Server
|
||||
|
||||
```bash
|
||||
cd ui
|
||||
npm run dev
|
||||
```
|
||||
|
||||
The Vite dev server starts on http://localhost:5173 and proxies `/api` to `http://localhost:8080` (the Spring Boot backend). Run the backend in another terminal with `mvn spring-boot:run` or via Docker Compose.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Purpose | Default |
|
||||
|----------|---------|---------|
|
||||
| `VITE_LOGTO_ENDPOINT` | Logto OIDC endpoint | `http://localhost:3001` |
|
||||
| `VITE_LOGTO_CLIENT_ID` | Logto application client ID | (empty) |
|
||||
|
||||
Create a `ui/.env.local` file for local overrides:
|
||||
```bash
|
||||
VITE_LOGTO_ENDPOINT=http://localhost:3001
|
||||
VITE_LOGTO_CLIENT_ID=your-client-id
|
||||
```
|
||||
|
||||
### Production Build
|
||||
|
||||
```bash
|
||||
cd ui
|
||||
npm run build
|
||||
```
|
||||
|
||||
Output goes to `src/main/resources/static/` (configured in `vite.config.ts`). The subsequent `mvn package` bundles the SPA into the JAR. In Docker builds, the Dockerfile handles this automatically via a multi-stage build.
|
||||
|
||||
### SPA Routing
|
||||
|
||||
Spring Boot serves `index.html` for all non-API routes via `SpaController.java`. React Router handles client-side routing. The SPA lives at `/`, while the observability dashboard (cameleer3-server) is at `/dashboard`.
|
||||
|
||||
## Development
|
||||
|
||||
### Running Tests
|
||||
|
||||
Reference in New Issue
Block a user