Architecture
Replane's architecture is straightforward: a Next.js web app backed by PostgreSQL.
System Components
┌─────────────────┐
│ Web Browser │
│ (React UI) │
└────────┬────────┘
│
│ HTTPS
↓
┌─────────────────┐
│ Next.js App │
│ (API + UI) │
└────────┬────────┘
│
│ PostgreSQL
↓
┌─────────────────┐
│ PostgreSQL │
│ (Database) │
└─────────────────┘
Technology Stack
- Frontend: React with Next.js App Router
- Backend: Next.js API routes + custom server (for SSE)
- Database: PostgreSQL 14+
- Authentication: OAuth (GitHub or Okta)
- Realtime: Server-Sent Events (SSE)
Data Model
Projects
Each project is isolated and contains:
- Configs
- Snapshots (version history)
- Team members
- API keys
- Audit log entries
Configs
A config has:
- Name (unique per project)
- Current value (JSON)
- Optional JSON schema
- List of snapshots (versions)
Snapshots
Each snapshot stores:
- Config value at that point in time
- Who created it
- When it was created
- Version number (auto-incrementing)
Snapshots are append-only. Rollbacks create new snapshots pointing to old values.
API Keys
Each API key:
- Belongs to one project
- Has a hashed token
- Can be revoked (soft delete)
Authentication Flow
- User clicks "Sign in with GitHub/Okta"
- OAuth provider authenticates user
- Replane receives user info and creates/updates account
- Session cookie is set
- User is redirected to dashboard
API keys use Bearer token authentication:
Authorization: Bearer your-api-key-here
Realtime Updates (SSE)
When a client calls watchConfigValue:
- SDK opens an SSE connection to
/api/v1/configs/{name}/watch - Server streams the current value immediately
- On config updates, server pushes new values to all connected clients
- Client SDK updates the in-memory value automatically
SSE is unidirectional (server → client) and works over HTTP/1.1. It's simpler than WebSockets for this use case.
Security
- HTTPS required in production (use a reverse proxy like Nginx or Caddy)
- Session cookies are httpOnly and secure
- API keys are hashed with bcrypt before storage
- SQL injection prevented by parameterized queries
- CSRF protection via Next.js middleware
Scalability
Replane is designed for tens of thousands of configs and hundreds of users:
- Database queries are optimized with indexes
- SSE connections are lightweight (one per watcher)
- No heavy background jobs or queues
For larger deployments:
- Use read replicas for API requests
- Load balance multiple app instances
- Keep SSE connections on dedicated instances
Backups
All state is in PostgreSQL. Use standard backup tools:
# Backup
pg_dump -U postgres replane > backup.sql
# Restore
psql -U postgres replane < backup.sql
Deployment
See the Self-Hosting Guide for deployment instructions.
Next Steps
- Self-Hosting - Deploy Replane
- Environment Variables - Configuration reference
- Guides - Common use cases