Overview
OpenSight uses environment variables for configuration. Copy.env.example to .env and configure the variables for your deployment.
Required Variables
These variables must be configured for OpenSight to function:Database
PostgreSQL connection stringFormat:
postgresql://user:password@host:port/databaseExample:Authentication
Secret key for signing JWT access tokensRequirements: Minimum 64 characters, cryptographically randomExample:Generate secure secret:
Secret key for signing JWT refresh tokensRequirements: Minimum 64 characters, cryptographically random (different from JWT_SECRET)Example:Generate secure secret:
Application URLs
Public URL where the web application is hostedExample:
Public URL where the API server is accessibleExample:
Frontend application URL (used by API for CORS and redirects)Example:
Optional Variables
OAuth Authentication
Configure OAuth providers for user authentication:GitHub OAuth application client secretExample:
Google OAuth 2.0 client secretExample:
Payment Processing (Stripe)
Stripe secret API key for server-side operationsWhere to get: https://dashboard.stripe.com/apikeysExample:
Stripe webhook signing secret for verifying webhook eventsWhere to get: https://dashboard.stripe.com/webhooksExample:
Stripe publishable key for client-side operationsExample:
Stripe Price ID for the Growth planExample:
Email Service (Resend)
Email address used as the sender for outgoing emailsRequirements: Must be a verified domain in ResendExample:
Redis Cache
Upstash Redis REST API authentication tokenNote: Not required for self-hosted RedisExample:
AI Engine APIs
Configure AI service providers for content analysis:Perplexity AI API key for real-time search and analysisWhere to get: https://www.perplexity.ai/settings/apiExample:
File Uploads (Uploadthing)
Uploadthing secret key for server-side file operationsWhere to get: https://uploadthing.com/dashboardExample:
Uploadthing application IDExample:
Error Tracking (Sentry)
Sentry DSN for client-side error trackingExample:
Feature Flags
Enable or disable content scoring featuresExample:
Enable or disable webhook functionalityExample:
Server Configuration
Port number for the API serverExample:
Node.js environment modePossible values:
development, production, testExample:Configuration Examples
Development Environment
.env
Production Environment (Docker)
.env
Production Environment (Managed Services)
.env
Security Best Practices
Generate Secure Secrets
Use cryptographically secure random strings:
Separate Environments
Use different credentials for development, staging, and production environments.
Rotate Secrets
Regularly rotate JWT secrets and API keys, especially after team member changes.
Use Secrets Management
In production, use secret management services (AWS Secrets Manager, HashiCorp Vault, etc.).
Validating Configuration
Verify your environment configuration:Troubleshooting
Database connection failed
Database connection failed
Symptoms: API fails to start with database connection errorsSolutions:
- Verify
DATABASE_URLis correctly formatted - For Docker: Use service name (
postgres) instead oflocalhost - Check PostgreSQL is running:
docker compose ps postgres - Verify credentials match PostgreSQL configuration
JWT authentication not working
JWT authentication not working
Symptoms: Login fails or tokens are invalidSolutions:
- Ensure
JWT_SECRETandJWT_REFRESH_SECRETare set - Verify secrets are at least 64 characters
- Check secrets are different from each other
- Clear browser cookies and try again
OAuth login fails
OAuth login fails
Symptoms: OAuth redirect fails or shows errorSolutions:
- Verify OAuth client IDs and secrets are correct
- Check redirect URIs in OAuth provider settings
- Ensure
NEXT_PUBLIC_APP_URLmatches OAuth configuration - For GitHub: Callback URL should be
{NEXT_PUBLIC_APP_URL}/api/auth/callback/github
Redis connection errors
Redis connection errors
Symptoms: Caching fails or application is slowSolutions:
- For Docker: Use
redis://redis:6379format - For Upstash: Verify both URL and token are set
- Test connection:
docker compose exec redis redis-cli ping - Check Redis is running:
docker compose ps redis
API not accessible from frontend
API not accessible from frontend
Symptoms: Frontend shows network errorsSolutions:
- Verify
NEXT_PUBLIC_API_URLis publicly accessible - Check CORS settings in API server
- Ensure
FRONTEND_URLmatches web application URL - For Docker: Verify port mappings are correct
Next Steps
Docker Deployment
Deploy OpenSight using Docker Compose
Self-Hosting Guide
Learn about self-hosting architecture and options