Web-based frontend for the Keylime Monitoring Dashboard, providing centralized monitoring, management, and compliance for Keylime remote attestation infrastructure.
Built with React 18, TypeScript, Vite, and React Router.
- Node.js 18+
- npm
# Install dependencies
npm install
# Start the development server
npm run devThe app runs at http://localhost:5173 by default. API requests are proxied to http://localhost:8080 (the backend).
| Command | Description |
|---|---|
npm run dev |
Start development server with HMR |
npm run build |
Type-check and build for production |
npm run preview |
Preview the production build |
npm run lint |
Run ESLint |
npm run test |
Run tests with Vitest |
TypeScript runs side by side, as recommended in the TypeScript 7.0 announcement:
@typescript/nativealiasestypescript@7, the native compiler that provides thetscbinary used for type checking and builds.typescriptaliases@typescript/typescript6, which keeps the JavaScript compiler API thattypescript-eslintstill requires (TypeScript 7 does not ship an API until 7.1).
Once typescript-eslint supports the TypeScript 7.1 API, the typescript6 alias can be dropped.
Create a .env.local file to override defaults:
VITE_API_BASE_URL=http://localhost:8080
VITE_WS_URL=ws://localhost:8080/wsThe dashboard supports an anonymous viewer mode (SR-001): unauthenticated
users browse with the read-only Viewer role. Privileged (Operator/Admin)
operations require an OIDC login; when such an action returns 401, the
frontend redirects to /login?returnTo=<current page> so the user returns
to where they were after authenticating.
OIDC sign-in flow:
- The user clicks Sign in (Login page or TopBar).
POST /api/auth/loginreturns an opaqueredirect_url; the browser is sent there (the frontend never constructs IdP URLs).- The identity provider returns the browser to
/auth/callback?code=…&state=…. - The SPA exchanges the code via
POST /api/auth/callbackand stores the short-lived JWT (SR-010) insessionStorageunderaccess_token. - The user's role comes from the token's
roleclaim, which the backend derives from the OIDC claims (SR-002 — MFA/acr/amrare never interpreted in the frontend).
Session tokens expire after 15 minutes; the API client transparently
performs one POST /api/auth/refresh and retries the failed request
when a token expires mid-session. Sign out calls POST /api/auth/logout
(SR-011, server-side revocation) and clears the local session.
Note: the backend
/api/auth/*endpoints are still stubs returning500 not implemented. The frontend implements strictly against the contract above; end-to-end verification is pending the backend SR-001 task.
src/
api/ - API client modules (Axios)
components/ - Reusable UI components (Layout, DataTable, KpiCard, etc.)
hooks/ - Custom React hooks (auth, WebSocket)
pages/ - Page components for each module
store/ - Zustand state stores
types/ - TypeScript type definitions
A pre-commit hook is provided to run CI checks (type check, lint, test, build) before each commit. To enable it:
git config core.hooksPath .githooksYou can also run the checks manually at any time:
./scripts/pre-commit.shApache-2.0