ENVIRONMENT_VARIABLES
Documentation for ENVIRONMENT_VARIABLES
RitualOS Environment Variables Reference
Updated: March 13, 2026
Architecture: Consolidated single service (id.ritualos.com) with internal ledger module
Status: All APIs merged - API_SERVICE_URL and LEDGER_SERVICE_URL deprecated
Overview
After consolidation, RitualOS uses a single backend service with clear internal modules. All services only need to configure ID_SERVICE_URL.
Security Notes:
- Never commit
.envfiles to version control - Use strong secrets (minimum 32 characters for sensitive values)
- Rotate secrets regularly (recommended: 90 days for production)
- Use Vercel Environment Variables for production
Global Variables (All Consuming Services)
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
NODE_ENV | Yes | Environment (development/staging/production) | production | Affects logging, optimization |
DATABASE_URL | Yes | PostgreSQL connection string | postgresql://user:pass@localhost:5432/dbname | Service-specific database |
ID_SERVICE_URL | Yes | Consolidated ID service endpoint | https://id.ritualos.com | OAuth, auth, all backend APIs, ledger module |
SESSION_SECRET | Yes | Session encryption key (32+ chars) | secure-random-32-char-key | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | secure-random-32-char-key | Minimum 32 characters |
Deprecated Variables (Remove from all services):
- ❌
API_SERVICE_URL- Moved to id.ritualos.com - ❌
LEDGER_SERVICE_URL- Ledger is now internal module
Per-Service Variables
id.ritualos.com (Consolidated Service)
| Variable | Required | Description | Example | Security |
|---|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection | postgresql://ritualos:ritualos_dev_password@localhost:5432/ritualos_id | Encrypt at rest |
JWT_SECRET | Yes | JWT session signing (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 chars |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 chars |
ENCRYPTION_KEY | Yes | Credential encryption (32-byte hex) | 1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6 | 32 bytes hex |
ISSUER_API_KEY | Yes | OAuth issuer key (id service only) | rit_sk_prod_abc123... | Start with rit_sk_ |
PARTNER_WEBHOOK_SECRET | No | Secret for signing partner webhooks | whsec_abc123... | For secure event delivery |
CORS_ORIGIN | No | CORS allowed origins | http://localhost:3000 | Comma-separated for prod |
PORT | No | Server port | 3000 | Default: 3000 |
NODE_ENV | No | Environment | development | development/production |
Development .env Example:
DATABASE_URL=postgresql://ritualos:ritualos_dev_password@localhost:5432/ritualos_id
JWT_SECRET=development-secret-key-32-chars-long-minimum
SESSION_SECRET=session-secret-key-32-chars-long-minimum
ENCRYPTION_KEY=1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6
ISSUER_API_KEY=rit_sk_dev_test_key_123456789
CORS_ORIGIN=http://localhost:3000,http://localhost:3001
PORT=3000
NODE_ENV=development
Consolidated Service Endpoints:
- OAuth:
/api/oauth/* - Authentication:
/api/auth/* - User Profile:
/api/me - Credentials:
/api/credentials/* - Badges:
/api/badges/* - Cards:
/api/cards/* - Partners:
/api/partners/* - Admin:
/api/admin/* - Ledger Receipts:
/api/ledger/receipts/* - Ledger Health:
/api/ledger/health
home.ritualos.com
Marketing and documentation site. OAuth config is optional (used when home needs auth flows).
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
ID_SERVICE_URL | No | ID service URL (for OAuth) | http://localhost:7000 | Defaults to localhost:7000 in dev |
NEXT_PUBLIC_ID_SERVICE_URL | No | Public ID service URL | http://localhost:7000 | For client-side redirects |
OAUTH_CLIENT_ID | If using auth | OAuth client identifier | home | Pre-registered with ID service |
OAUTH_CLIENT_SECRET | If using auth | OAuth client secret | ... | From pnpm oauth:register-clients -- --client home |
Development .env Example (when using OAuth):
ID_SERVICE_URL=http://localhost:7000
NEXT_PUBLIC_ID_SERVICE_URL=http://localhost:7000
OAUTH_CLIENT_ID=home
OAUTH_CLIENT_SECRET=<from oauth:register-clients --client home>
demo.ritualos.com
Reference template app for OAuth integration. Port 3010 locally.
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
ID_SERVICE_URL | Yes | ID service URL | http://localhost:7000 | |
NEXT_PUBLIC_ID_SERVICE_URL | Yes | Public ID service URL | http://localhost:7000 | |
OAUTH_CLIENT_ID | Yes | OAuth client identifier | demo | Pre-registered |
OAUTH_CLIENT_SECRET | Yes | OAuth client secret | ... | From pnpm oauth:register-clients -- --client demo |
SESSION_SECRET | Yes | Session cookie signing (32+ chars) | ... | Minimum 32 characters |
Development .env Example:
ID_SERVICE_URL=http://localhost:7000
NEXT_PUBLIC_ID_SERVICE_URL=http://localhost:7000
OAUTH_CLIENT_ID=demo
OAUTH_CLIENT_SECRET=<from oauth:register-clients --client demo>
SESSION_SECRET=<min-32-char-secret>
path.ritualos.com
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection | postgresql://ritualos_Path:password@localhost:5434/ritualos_game | Port 5434 |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
OAUTH_CLIENT_ID | Yes | OAuth client identifier | path | Pre-registered with ID service |
OAUTH_CLIENT_SECRET | Yes | OAuth client secret | rit_sc_abc123... | From OAuth registration |
ID_SERVICE_URL | Yes | Consolidated ID service | http://localhost:7000 | Only this service URL needed |
Development .env Example:
DATABASE_URL=postgresql://ritualos_Path:password@localhost:5434/ritualos_game
SESSION_SECRET=path-dev-session-secret-32-chars-minimum
JWT_SECRET=path-dev-jwt-secret-32-chars-minimum
OAUTH_CLIENT_ID=path
OAUTH_CLIENT_SECRET=rit_sc_dev_secret_from_registration
ID_SERVICE_URL=http://localhost:7000
NODE_ENV=development
PORT=4000
scroll.ritualos.com
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection | postgresql://ritualos_Scroll:password@localhost:5433/ritualos_scroll | Port 5433 |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
OAUTH_CLIENT_ID | Yes | OAuth client identifier | scroll | Pre-registered |
OAUTH_CLIENT_SECRET | Yes | OAuth client secret | rit_sc_abc123... | From OAuth registration |
ID_SERVICE_URL | Yes | Consolidated ID service | http://localhost:7000 | Only this service URL needed |
Development .env Example:
DATABASE_URL=postgresql://ritualos_Scroll:password@localhost:5433/ritualos_scroll
SESSION_SECRET=scroll-dev-session-secret-32-chars-minimum
JWT_SECRET=scroll-dev-jwt-secret-32-chars-minimum
OAUTH_CLIENT_ID=scroll
OAUTH_CLIENT_SECRET=rit_sc_dev_secret_from_registration
ID_SERVICE_URL=http://localhost:7000
NODE_ENV=development
PORT=3003
learn.ritualos.com
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection | postgresql://ritualos_Learn:password@localhost:5435/ritualos_learn | Port 5435 |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
OAUTH_CLIENT_ID | Yes | OAuth client identifier | learn | Pre-registered |
OAUTH_CLIENT_SECRET | Yes | OAuth client secret | rit_sc_abc123... | From OAuth registration |
ID_SERVICE_URL | Yes | Consolidated ID service | http://localhost:7000 | Only this service URL needed |
Development .env Example:
DATABASE_URL=postgresql://ritualos_Learn:password@localhost:5435/ritualos_learn
SESSION_SECRET=learn-dev-session-secret-32-chars-minimum
JWT_SECRET=learn-dev-jwt-secret-32-chars-minimum
OAUTH_CLIENT_ID=learn
OAUTH_CLIENT_SECRET=rit_sc_dev_secret_from_registration
ID_SERVICE_URL=http://localhost:7000
NODE_ENV=development
PORT=3005
governance.ritualos.com
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection | postgresql://ritualos_Governance:password@localhost:5436/ritualos_governance | Port 5436 |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
OAUTH_CLIENT_ID | Yes | OAuth client identifier | governance | Pre-registered |
OAUTH_CLIENT_SECRET | Yes | OAuth client secret | rit_sc_abc123... | From OAuth registration |
ID_SERVICE_URL | Yes | Consolidated ID service | http://localhost:7000 | Only this service URL needed |
Development .env Example:
DATABASE_URL=postgresql://ritualos_Governance:password@localhost:5436/ritualos_governance
SESSION_SECRET=governance-dev-session-secret-32-chars-minimum
JWT_SECRET=governance-dev-jwt-secret-32-chars-minimum
OAUTH_CLIENT_ID=governance
OAUTH_CLIENT_SECRET=rit_sc_dev_secret_from_registration
ID_SERVICE_URL=http://localhost:7000
NODE_ENV=development
PORT=3007
guild.ritualos.com
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection | postgresql://ritualos_Guild:password@localhost:5437/ritualos_guild | Port 5437 |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
OAUTH_CLIENT_ID | Yes | OAuth client identifier | guild | Pre-registered |
OAUTH_CLIENT_SECRET | Yes | OAuth client secret | rit_sc_abc123... | From OAuth registration |
ID_SERVICE_URL | Yes | Consolidated ID service | http://localhost:7000 | Only this service URL needed |
Development .env Example:
DATABASE_URL=postgresql://ritualos_Guild:password@localhost:5437/ritualos_guild
SESSION_SECRET=guild-dev-session-secret-32-chars-minimum
JWT_SECRET=guild-dev-jwt-secret-32-chars-minimum
OAUTH_CLIENT_ID=guild
OAUTH_CLIENT_SECRET=rit_sc_dev_secret_from_registration
ID_SERVICE_URL=http://localhost:7000
NODE_ENV=development
PORT=3006
market.ritualos.com
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection | postgresql://ritualos_Market:password@localhost:5440/ritualos_market | Port 5440 |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
OAUTH_CLIENT_ID | Yes | OAuth client identifier | market | Pre-registered |
OAUTH_CLIENT_SECRET | Yes | OAuth client secret | rit_sc_abc123... | From OAuth registration |
ID_SERVICE_URL | Yes | Consolidated ID service | http://localhost:7000 | Only this service URL needed |
Development .env Example:
DATABASE_URL=postgresql://ritualos_Market:password@localhost:5440/ritualos_market
SESSION_SECRET=market-dev-session-secret-32-chars-minimum
JWT_SECRET=market-dev-jwt-secret-32-chars-minimum
OAUTH_CLIENT_ID=market
OAUTH_CLIENT_SECRET=rit_sc_dev_secret_from_registration
ID_SERVICE_URL=http://localhost:7000
NODE_ENV=development
PORT=3009
realm.ritualos.com (Vite + Vue)
| Variable | Required | Description | Example | Notes |
|---|---|---|---|---|
VITE_ID_SERVICE_URL | Yes | Frontend env - ID service URL | http://localhost:3000 | Only this service URL needed |
DATABASE_URL | Yes | PostgreSQL connection (backend) | postgresql://ritualos_Realm:password@localhost:5439/ritualos_realm | Port 5439 |
SESSION_SECRET | Yes | Session encryption (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
JWT_SECRET | Yes | JWT signing key (32+ chars) | abcdefghijklmnopqrstuvwxyz123456 | Minimum 32 characters |
Development .env Example:
VITE_ID_SERVICE_URL=http://localhost:7000
DATABASE_URL=postgresql://ritualos_Realm:password@localhost:5439/ritualos_realm
SESSION_SECRET=realm-dev-session-secret-32-chars-minimum
JWT_SECRET=realm-dev-jwt-secret-32-chars-minimum
NODE_ENV=development
PORT=3008
ritualos.com (Portal)
No environment variables needed - static site with no backend.
Production Database URLs (Vercel + Neon)
When deploying to Vercel, replace localhost DATABASE_URL with Neon database URLs:
Neon Database URL Format
DATABASE_URL=postgresql://user:password@ep-cool-name.aws.us-east-1.aws.neon.tech/dbname?sslmode=require
Vercel Environment Variables Checklist
For each service in Vercel dashboard:
Required Variables:
-
ID_SERVICE_URL=https://id.ritualos.com -
DATABASE_URL= PostgreSQL connection string -
JWT_SECRET= Secure random string (32+ chars) -
SESSION_SECRET= Secure random string (32+ chars) -
NODE_ENV=production
Variables to Remove:
- Delete
API_SERVICE_URL(if present) - Delete
LEDGER_SERVICE_URL(if present)
Secret Management Best Practices
Development
- Create
.envfile in each service directory - Copy from
.env.example(if available) - Set required variables with development values
- Never commit
.envfiles (add to.gitignore)
Production (Vercel)
- Create Neon databases for each service (9 total)
- Add
DATABASE_URLto Vercel Environment Variables - Add sensitive variables (
JWT_SECRET,SESSION_SECRET, etc.) to Vercel - Use strong, unique secrets for each environment
- Enable Vercel's secret encryption
Secret Rotation
- JWT_SECRET / SESSION_SECRET: Rotate every 90 days
- ISSUER_API_KEY: Rotate every 90 days
- OAUTH_CLIENT_SECRET: Rotate if compromised
Troubleshooting
Database Connection Failed
# Verify Docker database is running
docker ps | findstr ritualos
# Test connection manually
psql postgresql://ritualos:password@localhost:5432/ritualos_id
# Check DATABASE_URL format
# Must include: protocol://user:password@host:port/database
OAuth Flow Failed
# Verify ID service is running
docker ps | findstr ritualos-id
# Check OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET
# Must match values registered in id.ritualos.com database
# Test OAuth endpoint
curl http://localhost:3000/api/oauth/authorize
Ledger Operations Not Working
# Verify ledger module is running as part of id.ritualos.com
curl http://localhost:3000/api/ledger/health
# Check ledger receipt endpoint
curl http://localhost:3000/api/ledger/receipts?identityId=test
Missing Environment Variable
# Check .env file exists
ls -la path.ritualos.com/.env
# Check .gitignore contains .env
type path.ritualos.com\.gitignore | findstr ".env"
# Add to Vercel Environment Variables
# In Vercel Dashboard: Project Settings > Environment Variables
Next Steps
-
Development Setup:
- Copy environment variables from this document
- Create
.envfiles for each service - Start Docker databases
- Test connections to id.ritualos.com
-
Production Setup:
- Create Neon databases (9 projects)
- Add
DATABASE_URLto Vercel for each service - Add
ID_SERVICE_URL=https://id.ritualos.comto all services - Remove
API_SERVICE_URLandLEDGER_SERVICE_URLfrom all services - Test production connections
Last Updated: February 2, 2026
Architecture: Consolidated id.ritualos.com with internal ledger module
Last updated: 3/13/2026
Edit this page on GitHub →