Quick start (local dev)
Run the dashboard locally in under a minute using an in-memory key store with no Firebase account required:dev:uid:email tokens — no Firebase project or credentials needed.
Production setup
1
Create a Firebase project
- Go to the Firebase console and create a new project.
- Enable Authentication and turn on the Email/Password and Google sign-in providers.
- Create a Firestore database in the same project.
- Generate a service account JSON key from Project Settings → Service accounts and save it somewhere safe.
- Set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable to the path of that JSON file.
2
Configure the web app
Copy the Firebase web app config into the dashboard’s JavaScript bundle:Edit
firebase-config.js to fill in your project’s apiKey, authDomain, projectId, and SC_API_BASE (the origin of your deployed API server if different from the static file host).3
Deploy Firestore security rules
4
Run the API server with Firestore
5
Deploy to Cloud Run or Fly.io
Deploy the FastAPI application to your preferred host — Cloud Run, Fly.io, or any container platform. Vercel serves the static dashboard files only; the API server runs as a separate service.
Key management
Once signed in, the/dashboard page exposes four operations on every key:
Environment variables
API endpoints reference
The FastAPI router exposes two groups of endpoints: dashboard management routes that require a Firebase ID token, and a compression route that requires an API key.Dashboard management (Firebase ID token)
PassAuthorization: Bearer <firebase_id_token> on every request.
Authenticated compression (API key)
Authorization: Bearer sc_live_… if your HTTP client prefers that header. The response includes compressed_text, original_tokens, kept_tokens, kv_savings_pct, and policy_name. Usage is recorded automatically against the key.
Playground (no key required)
POST /api/compress remains unauthenticated for the browser demo and local testing. It accepts the same request body and returns the same response shape.
Security
- Firestore is accessed exclusively from the FastAPI server; the browser client never touches Firestore directly.
- Revoked keys are removed from the hash lookup index immediately — there is no grace period.
- In dev mode (
SC_AUTH_DEV=1) any token in thedev:uid:emailformat is accepted; never run this in production.