Deployment
WEFA deploys as two services: a Vercel frontend (PWA) and a Fly.io API server (packages/api).
Frontend (Vercel)
The React PWA in packages/app deploys to Vercel. vercel.json configures SPA routing, security headers, and CSP.
Client-Side Environment Variables
| Variable | Purpose |
|---|---|
VITE_API_BASE_URL | API server URL (https://api.wefa.app in production) |
VITE_SIGNALING_URLS | WebSocket signaling relay (wss://api.wefa.app) |
VITE_YJS_TRANSPORT | Yjs transport mode (webrtc/websocket/hybrid) |
VITE_APPKIT_PROJECT_ID | Reown AppKit project ID |
VITE_PIMLICO_SPONSORSHIP_POLICY_ID | Pimlico sponsorship policy |
VITE_PASSKEY_RP_ID | WebAuthn relying party ID |
API Server (Fly.io)
The Hono server in packages/api deploys to Fly.io at api.wefa.app. It handles both HTTP API routes and WebSocket signaling.
API Endpoints
| Endpoint | Purpose |
|---|---|
GET / | Health check |
POST /api/creatures/traits | Generate creature traits (OpenAI gpt-4o-mini) |
POST /api/creatures/image | Generate creature sprite (OpenAI gpt-image-1) |
POST /api/creatures/model | Start Meshy Image-to-3D task |
GET /api/creatures/model?taskId= | Poll Meshy task status |
POST /api/environment/infer | Infer biome from GPS (Open-Meteo) |
POST /api/plants/identify | Plant identification (Plant.ID by Kindwise) |
POST /api/auth/pimlico | Pimlico bundler/paymaster proxy |
ws:// | WebSocket signaling relay (y-webrtc) |
Server-Side Secrets
Set via fly secrets set:
| Secret | Purpose |
|---|---|
OPENAI_API_KEY | Creature traits + image generation |
MESHY_API_KEY | Image-to-3D model generation |
PLANTID_API_KEY | Plant identification + health assessment |
PIMLICO_API_KEY | Smart account sponsorship proxy |
Deploy
cd packages/api
fly deploy
CI/CD
GitHub Actions (.github/workflows/ci.yml) runs on PRs to main:
- Lint (Biome + Oxlint)
- Typecheck
- Unit tests (app + api)
- Build
- Lighthouse audit