Choosing Your Backend
LightningAddon supports three backend modes. Set VITE_BACKEND and the required environment variables for your choice, or run pnpm choose:backend for an interactive wizard.
| Backend | Use When |
|---|---|
| Supabase | You want hosted Postgres, Edge Functions, and built-in auth. Fastest to ship. |
| Firebase | You prefer Firestore, Firebase Auth, and Firebase Functions. |
| Custom | You already have an API. The extension validates users via a session cookie from your domain. |
Backend Resolution
parseIntegrationEnv() in @repo/integrations validates env vars and determines the active backend. Set VITE_BACKEND explicitly, or omit it to auto-detect from which keys are present (Supabase or Firebase only; custom requires VITE_BACKEND=custom).
Supabase
Add to envs/.env.development:
VITE_BACKEND=supabase
VITE_SUPABASE_URL= # from Supabase dashboard → Settings → API
VITE_SUPABASE_ANON_KEY= # from Supabase dashboard
VITE_STRIPE_PUBLISHABLE_KEY=
Your server uses apps/supabase/functions/* and envs/.env.supabase.local.
Firebase
Add to envs/.env.development:
VITE_BACKEND=firebase
VITE_FIREBASE_API_KEY=
VITE_FIREBASE_AUTH_DOMAIN=
VITE_FIREBASE_PROJECT_ID=
VITE_FIREBASE_FUNCTIONS_URL= # optional; e.g. https://us-central1-PROJECT.cloudfunctions.net
VITE_STRIPE_PUBLISHABLE_KEY=
Your server uses apps/firebase/functions/* and envs/.env.firebase.local.
Custom (Bring Your Own Backend)
Add to envs/.env.development:
VITE_BACKEND=custom
VITE_CUSTOM_API_URL= # e.g. https://api.yourapp.com
VITE_CUSTOM_COOKIE_DOMAIN= # e.g. https://app.yourapp.com (where session cookie is set)
VITE_CUSTOM_COOKIE_NAME= # e.g. session
VITE_STRIPE_PUBLISHABLE_KEY=
The extension validates users by reading the session cookie from your domain and calling GET {apiBaseUrl}/auth/me with that cookie. There is no extension login form—users log in on your website.
Manifest: Add your cookie domain to optional_host_permissions and ensure optional_permissions includes cookies. See Using with an Existing Backend.
For a feature comparison across all backends, see Architecture: Backends.