Environment Variables
Configure your AppLighter environment for different database adapters. Set up Mock, Supabase, or PocketBase backends with step-by-step instructions.
Overview
AppLighter uses Vibecode DB with a flexible adapter system that lets you choose your database backend. Configuration is done through environment variables in your .env file.
Quick Setup
Copy the example environment file:
cp .env.example .envAdapter Selection
Choose your adapter by setting EXPO_PUBLIC_DB_ADAPTER:
# Options: mock, supabase, pocketbase
EXPO_PUBLIC_DB_ADAPTER=mockMock Adapter (Default)
The mock adapter provides instant local development with seeded data. No backend setup required - perfect for prototyping and development.
EXPO_PUBLIC_DB_ADAPTER=mockWhat happens:
- Uses an in-memory database with mock data from
src/db/seeds/ - Auto-creates a demo user (
alice@example.com/password123) - Signs in automatically on app start
Supabase Adapter
Connect to Supabase for cloud PostgreSQL database with built-in authentication.
EXPO_PUBLIC_DB_ADAPTER=supabase
# Get these from your Supabase project: Settings > API
EXPO_PUBLIC_SUPABASE_URL=https://your-project-id.supabase.co
EXPO_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...When to use:
- Production applications with multi-user support
- Apps requiring real-time sync
- Applications needing OAuth/social login
- Team/collaborative features
Setup Steps:
- Create a project at supabase.com
- Navigate to Settings > API
- Copy the Project URL to
EXPO_PUBLIC_SUPABASE_URL - Copy the anon/public key to
EXPO_PUBLIC_SUPABASE_ANON_KEY
PocketBase Adapter
Connect to PocketBase for a self-hosted, lightweight backend with built-in auth and real-time subscriptions.
EXPO_PUBLIC_DB_ADAPTER=pocketbase
# Your PocketBase instance URL
EXPO_PUBLIC_POCKETBASE_URL=http://127.0.0.1:8090When to use:
- Self-hosted applications with full data ownership
- Projects needing a lightweight, single-binary backend
- Rapid prototyping with a real backend
- Apps that need to run on-premise or offline-first
Setup Steps:
- Download PocketBase from pocketbase.io
- Start PocketBase with
./pocketbase serve - Set
EXPO_PUBLIC_POCKETBASE_URLto your PocketBase instance URL - Push your schema and seed data using the scripts below
PocketBase Scripts:
AppLighter includes scripts for managing your PocketBase backend:
# Push schema collections to PocketBase
yarn pocketbase-db-push
# Seed data to PocketBase
yarn pocketbase-db-seedThese scripts are located in pocketbase/command-scripts/ and use the collection definitions from your project to set up and populate a PocketBase backend.
Environment Variable Reference
| Variable | Required | Default | Description |
|---|---|---|---|
EXPO_PUBLIC_DB_ADAPTER | No | mock | Database adapter: mock, supabase, or pocketbase |
EXPO_PUBLIC_JWT_SECRET | For dev | - | JWT secret for local auth |
EXPO_PUBLIC_SUPABASE_URL | For Supabase | - | Supabase project URL |
EXPO_PUBLIC_SUPABASE_ANON_KEY | For Supabase | - | Supabase anonymous API key |
EXPO_PUBLIC_POCKETBASE_URL | For PocketBase | - | PocketBase instance URL |
How the Adapter System Works
The adapter is selected in src/db/client.ts:
import { createClient } from '@vibecode-db/client'
const DB_ADAPTER = process.env.EXPO_PUBLIC_DB_ADAPTER ?? 'mock'
// Adapter is chosen based on DB_ADAPTER value:
// - 'mock' → MockAdapter (in-memory with seeds)
// - 'supabase' → SupabaseAdapter (cloud PostgreSQL)
// - 'pocketbase' → PocketBaseAdapter (self-hosted backend)All adapters expose the same Vibecode DB API, so your app code doesn't change when switching adapters.
Security Best Practices
- Never commit
.envfiles - They're already in.gitignore - Use strong secrets - Generate with
openssl rand -base64 32 - Rotate secrets regularly - Especially after team changes
- Use different secrets per environment - Dev, staging, production
- Store production secrets securely - Use your CI/CD platform's secret management
Next Steps
- Build your first feature with the Quick Start guide
- Learn about the Database operations
- Explore UI Components