···11+# ============================================================================
22+# atBB Production Environment Configuration
33+# ============================================================================
44+# Copy this file to .env.production and fill in your actual values.
55+# NEVER commit .env.production with real secrets to version control!
66+#
77+# After copying:
88+# 1. Generate SESSION_SECRET: openssl rand -hex 32
99+# 2. Fill in your AT Protocol credentials (FORUM_DID, PDS_URL, etc.)
1010+# 3. Set strong passwords for FORUM_PASSWORD and database
1111+# 4. Update URLs to match your deployment domain
1212+# 5. Restrict file permissions: chmod 600 .env.production
1313+#
1414+# Security note: This file contains sensitive credentials. Protect it like
1515+# you would protect SSH keys or API tokens.
1616+# ============================================================================
1717+1818+# ============================================================================
1919+# Database Configuration
2020+# ============================================================================
2121+# PostgreSQL connection string
2222+# Format: postgresql://username:password@hostname:port/database
2323+#
2424+# Production example (managed PostgreSQL):
2525+# DATABASE_URL=postgresql://atbb_prod:S3cureP@ssw0rd@db.example.com:5432/atbb_prod
2626+#
2727+# Docker Compose example (container name as hostname):
2828+# DATABASE_URL=postgresql://atbb:changeme@postgres:5432/atbb
2929+#
3030+# Notes:
3131+# - Use strong passwords (minimum 16 characters, alphanumeric + symbols)
3232+# - Enable SSL/TLS in production: ?sslmode=require
3333+# - Consider connection pooling for high traffic
3434+DATABASE_URL=postgresql://atbb_user:CHANGE_ME_STRONG_PASSWORD@db.example.com:5432/atbb_production
3535+3636+# ============================================================================
3737+# AT Protocol Configuration
3838+# ============================================================================
3939+# These settings connect your forum to the AT Protocol network (Bluesky/atproto).
4040+4141+# Forum's Decentralized Identifier (DID)
4242+# This is your forum's unique identity on the AT Protocol network.
4343+# Get this after creating your forum account on a PDS.
4444+#
4545+# Example: did:plc:abcdef1234567890
4646+# Production: Use your actual forum DID from your PDS
4747+FORUM_DID=did:plc:CHANGE_ME_YOUR_FORUM_DID
4848+4949+# Personal Data Server URL
5050+# The PDS where your forum's records are stored.
5151+# This can be your own PDS instance or a hosted service.
5252+#
5353+# Examples:
5454+# - Self-hosted: https://pds.yourdomain.com
5555+# - Bluesky PDS: https://bsky.social
5656+PDS_URL=https://pds.example.com
5757+5858+# Note: FORUM_HANDLE and FORUM_PASSWORD are only used by the spike test script,
5959+# not by the production applications. The appview and web services do not require
6060+# forum credentials to operate.
6161+6262+# ============================================================================
6363+# Application URLs
6464+# ============================================================================
6565+# These URLs determine how services communicate and handle OAuth.
6666+6767+# Public URL where your forum is accessible to users
6868+# Used for OAuth redirect URIs and client_id generation.
6969+# MUST be HTTPS in production (HTTP only for local development).
7070+#
7171+# Examples:
7272+# - Production: https://forum.example.com
7373+# - Staging: https://staging.forum.example.com
7474+OAUTH_PUBLIC_URL=https://forum.example.com
7575+7676+# Internal URL for web service to reach appview API
7777+# In single-container deployments: http://localhost:3000
7878+# In multi-container deployments: http://appview:3000 (Docker service name)
7979+# In Kubernetes: http://appview-service:3000
8080+#
8181+# Notes:
8282+# - Use container/service names, not external domains
8383+# - HTTP is fine for internal communication (encrypted at network layer)
8484+# - Must be reachable from web service container
8585+APPVIEW_URL=http://localhost:3000
8686+8787+# ============================================================================
8888+# Session Management
8989+# ============================================================================
9090+# Session security is critical for protecting user accounts.
9191+9292+# Secret key for encrypting and signing session cookies
9393+# CRITICAL: Generate a strong random value, never use the default!
9494+#
9595+# Generate with: openssl rand -hex 32
9696+#
9797+# Security requirements:
9898+# - Minimum 32 bytes (64 hex characters)
9999+# - Use cryptographically secure random generation
100100+# - Unique per environment (dev, staging, production)
101101+# - Never commit to version control
102102+# - Rotate periodically (invalidates all active sessions)
103103+#
104104+# Example output from openssl:
105105+# a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456
106106+SESSION_SECRET=
107107+108108+# ============================================================================
109109+# Service Ports (Optional)
110110+# ============================================================================
111111+# Override default ports if needed for your deployment environment.
112112+# Most deployments can use the defaults.
113113+114114+# AppView API server port (default: 3000)
115115+# This is the internal port the appview service listens on.
116116+# PORT=3000
117117+118118+# Note: The web service also uses PORT (not WEB_PORT) and defaults to 3001.
119119+# In the Docker container, nginx listens on port 80 and proxies to both services.
120120+121121+# ============================================================================
122122+# AT Protocol Features (Optional)
123123+# ============================================================================
124124+# Advanced AT Protocol configuration.
125125+126126+# Jetstream firehose URL for real-time updates
127127+# Receives live events from the AT Protocol network to keep your forum
128128+# synchronized with user posts and profile changes.
129129+#
130130+# Default: wss://jetstream2.us-east.bsky.network/subscribe
131131+#
132132+# Notes:
133133+# - Uses WebSocket (wss://) for real-time streaming
134134+# - Alternative endpoints available for different regions
135135+# - Required for live post indexing
136136+# JETSTREAM_URL=wss://jetstream2.us-east.bsky.network/subscribe
137137+138138+# ============================================================================
139139+# Session Configuration (Optional)
140140+# ============================================================================
141141+# Fine-tune session behavior for your deployment.
142142+143143+# Session cookie TTL (Time To Live) in days
144144+# How long users stay logged in before requiring re-authentication.
145145+#
146146+# Default: 7 days
147147+# Recommended ranges:
148148+# - High security: 1-7 days (default)
149149+# - Balanced: 14-30 days
150150+# - Convenience: 90 days
151151+#
152152+# Notes:
153153+# - Shorter TTL = more secure, more logins required
154154+# - Longer TTL = less secure, better user experience
155155+# - Consider your forum's security requirements
156156+# SESSION_TTL_DAYS=7
157157+158158+# Redis session storage (optional, for multi-instance deployments)
159159+# If set, sessions are stored in Redis instead of memory.
160160+# Required for horizontal scaling (multiple appview instances).
161161+#
162162+# Format: redis://[username]:[password]@hostname:port/database
163163+#
164164+# Examples:
165165+# - Local Redis: redis://localhost:6379
166166+# - Docker Compose: redis://redis:6379
167167+# - Managed Redis: redis://default:password@redis.example.com:6379/0
168168+#
169169+# Notes:
170170+# - Leave blank/commented for single-instance deployments (uses in-memory)
171171+# - Required for multi-instance deployments (shared session state)
172172+# - Supports Redis Cluster and Sentinel configurations
173173+# REDIS_URL=redis://redis:6379
174174+175175+# ============================================================================
176176+# Security Checklist
177177+# ============================================================================
178178+# Before deploying to production, verify:
179179+#
180180+# [ ] Generated SESSION_SECRET with: openssl rand -hex 32
181181+# [ ] Used strong, unique passwords (minimum 16 characters)
182182+# [ ] Never committed .env.production to version control
183183+# [ ] Set file permissions: chmod 600 .env.production
184184+# [ ] All URLs use HTTPS (except APPVIEW_URL for internal communication)
185185+# [ ] Database connection uses SSL/TLS (?sslmode=require)
186186+# [ ] Forum account password is unique (not reused)
187187+# [ ] SESSION_SECRET is different from dev/staging environments
188188+# [ ] Documented secret rotation schedule (every 90 days recommended)
189189+# [ ] Tested OAuth flow with OAUTH_PUBLIC_URL
190190+# [ ] Verified APPVIEW_URL is reachable from web service
191191+# [ ] Reviewed firewall rules (only expose necessary ports)
192192+#
193193+# ============================================================================
194194+# Deployment Notes
195195+# ============================================================================
196196+#
197197+# Single Container Deployment (appview + web in same container):
198198+# - Use APPVIEW_URL=http://localhost:3000
199199+# - No Redis required (in-memory sessions OK)
200200+# - Simpler setup, suitable for small forums
201201+#
202202+# Multi Container Deployment (separate appview and web containers):
203203+# - Use APPVIEW_URL=http://appview:3000 (Docker service name)
204204+# - Consider Redis for session storage
205205+# - Better scalability, suitable for larger forums
206206+#
207207+# Kubernetes Deployment:
208208+# - Use APPVIEW_URL=http://appview-service:3000
209209+# - Redis highly recommended for multi-replica deployments
210210+# - Use Secrets for sensitive values (not ConfigMaps)
211211+#
212212+# Environment Variable Loading:
213213+# - Docker: Use --env-file flag or docker-compose env_file
214214+# - Kubernetes: Mount as Secret or use external-secrets
215215+# - Systemd: Use EnvironmentFile=/path/to/.env.production
216216+# - Node.js: Use --env-file flag (Node 20.6+)
217217+#
218218+# ============================================================================
219219+# Troubleshooting
220220+# ============================================================================
221221+#
222222+# "Database connection failed":
223223+# - Verify DATABASE_URL is correct and accessible
224224+# - Check network connectivity to database host
225225+# - Ensure database exists and user has permissions
226226+# - Enable SSL if required by your database provider
227227+#
228228+# "OAuth redirect URI mismatch":
229229+# - Verify OAUTH_PUBLIC_URL matches your actual domain
230230+# - Must use HTTPS in production (not HTTP)
231231+# - Check for trailing slashes (should not have one)
232232+#
233233+# "Session errors / users logged out randomly":
234234+# - Verify SESSION_SECRET is set (not blank)
235235+# - For multi-instance: must use Redis (set REDIS_URL)
236236+# - Check SESSION_TTL_DAYS is reasonable (default 7)
237237+#
238238+# "Cannot reach appview API":
239239+# - Verify APPVIEW_URL uses correct hostname
240240+# - In Docker: use service name, not localhost
241241+# - Check container/service networking configuration
242242+#
243243+# ============================================================================