Integration Recipes
Use these recipes when you already know the consumer shape and need the smallest maintainable starting point.
React or Vite App
| Field | Value |
|---|---|
| Auth mode | Browser publishable key with allowed origin validation |
| Required env vars | VITE_SPAPS_API_KEY, VITE_SPAPS_API_URL or equivalent app config |
| First verification | npx spaps verify --json |
npm install spaps-sdk
npx spaps quickstart --json
npx spaps create demo-app --template react
npx spaps fixtures apply --base-url http://localhost:5173
npx spaps verify --jsonimport { createBrowserClient } from 'spaps-sdk'
export const spaps = createBrowserClient(import.meta.env.VITE_SPAPS_API_KEY, {
apiUrl: import.meta.env.VITE_SPAPS_API_URL ?? 'http://localhost:3301'
})Next pages:
Next.js App
| Field | Value |
|---|---|
| Auth mode | Browser publishable key for client components; secret key only in server code |
| Required env vars | NEXT_PUBLIC_SPAPS_API_KEY, NEXT_PUBLIC_SPAPS_API_URL, SPAPS_API_KEY |
| First verification | npx spaps quickstart --json then npx spaps verify --json |
npm install spaps-sdk
npx spaps quickstart --json
npx spaps create demo-app --template nextjs
npx spaps verify --jsonimport { createBrowserClient, createServerClient } from 'spaps-sdk'
export const browserSpaps = createBrowserClient(process.env.NEXT_PUBLIC_SPAPS_API_KEY!, {
apiUrl: process.env.NEXT_PUBLIC_SPAPS_API_URL
})
export const serverSpaps = createServerClient(process.env.SPAPS_API_KEY!, {
apiUrl: process.env.NEXT_PUBLIC_SPAPS_API_URL
})Keep createServerClient in server-only modules. Do not pass SPAPS_API_KEY into browser bundles.
Next pages:
FastAPI Consumer
| Field | Value |
|---|---|
| Auth mode | Server-side service settings; start with auth disabled for the smallest route proof |
| Required env vars | SPAPS_API_URL, SPAPS_API_KEY when calling a SPAPS runtime |
| First verification | curl http://127.0.0.1:8000/health |
python -m venv .venv
source .venv/bin/activate
pip install spaps-server-quickstartfrom fastapi import APIRouter
from spaps_server_quickstart import create_app
from spaps_server_quickstart.settings import BaseServiceSettings, create_settings_loader
class Settings(BaseServiceSettings):
app_name: str = "Example Consumer"
spaps_auth_enabled: bool = False
router = APIRouter()
@router.get("/health")
async def health() -> dict[str, bool]:
return {"ok": True}
app = create_app(settings_loader=create_settings_loader(Settings), api_router=router)uvicorn example:app --reload
curl http://127.0.0.1:8000/healthNext pages: