Configuration guide
Configure your self-hosted Screenshothis instance with the right environment variables and settings for your deployment. This guide covers everything from basic setup to advanced production configurations.Always check the source: Refer to the Screenshothis repository
.env.example files for the most up-to-date configuration options. This guide is based on the actual environment variables used in the codebase.Quick configuration
Start with this minimal setup and expand as needed:1
Set up database connection
Configure PostgreSQL connection details in your
apps/server/.env file.2
Configure storage
Set up S3-compatible storage credentials for screenshot storage.
3
Add authentication secrets
Generate secure secrets for user authentication and API keys.
4
Customize performance settings
Adjust rate limits, timeouts, and screenshot quality settings.
Database configuration
Configure your PostgreSQL database connection:- Development
- Production
Redis configuration
Configure Redis for caching and session management:S3-compatible storage
Configure storage for screenshots using any S3-compatible service:Storage region. Use
auto for Cloudflare R2, or the appropriate region for your service.Use path-style URLs instead of virtual-hosted style. Set to
true for MinIO and some other services.Storage provider examples
- AWS S3
- DigitalOcean Spaces
- Cloudflare R2
- MinIO (Local)
Application settings
Configure basic application behavior:Authentication and security
Configure authentication and API key generation:Secret key for Better Auth authentication system. Must be a strong, random string.Generate a secure secret:
Frontend configuration
Configure the web interface inapps/web/.env:
Google OAuth and Polar configurations are optional. You only need them if you want to offer Google sign-in or integrate with Polar for billing.
Performance and limits
Configure rate limiting and screenshot performance:Screenshot settings
Configure screenshot generation limits and defaults:Built-in security features
Screenshothis includes several built-in security measures that you should be aware of:Request size limits
Request size limits
Automatically enforced limits:
- Header size limit: 8 KB (8192 characters) per request
- Cookie size limit: 4 KB (4096 characters) per request
- URL length limit: Standard browser limits (2048 characters)
Rate limiting system
Rate limiting system
Built-in rate limiting:
- Per-user rate limiting via internal
requestLimitssystem - Configurable via
RATE_LIMIT_*environment variables - Automatic abuse protection
CSP bypass auditing
CSP bypass auditing
Security auditing:
- Every use of
bypass_csp=trueis logged server-side - Helps identify potential security issues
- Enables compliance and security reviews
Input validation
Input validation
Automatic validation:
- All API inputs validated using Zod schemas
- URL validation prevents malicious requests
- Parameter validation ensures data integrity
Complete configuration examples
Minimal production setup
Backend configuration (apps/server/.env):
apps/web/.env):
High-performance production setup
For high-traffic deployments, use these optimized settings:Development with external services
For development using cloud services instead of local Docker:Docker deployment configuration
Using environment files
Organize your configuration using environment files:Using Docker secrets
For enhanced security in production:Configuration validation
Validate your configuration before deployment:1
Check required variables
Ensure all required environment variables are set:
2
Test database connection
Verify your database connection:
3
Validate storage configuration
Test your S3-compatible storage:
4
Verify rate limits
Test rate limiting behavior with multiple requests to ensure limits are working correctly.
Troubleshooting configuration
Application won't start
Application won't start
Common causes:
- Missing required environment variables
- Invalid database connection string
- Incorrect Redis URL format
- S3 credentials or bucket access issues
Database connection errors
Database connection errors
Common causes:
- Incorrect DATABASE_URL format
- Database server not accessible
- Wrong credentials
- Database doesn’t exist
psql "postgresql://user:pass@host:port/db"S3 storage errors
S3 storage errors
Common causes:
- Invalid credentials
- Bucket doesn’t exist
- Wrong region configuration
- Incorrect endpoint URL
Next steps
Deployment Guide
Deploy your configured instance to production with Docker, Kubernetes, or cloud platforms
Troubleshooting
Common issues and solutions for self-hosted deployments
API Reference
Complete API documentation for your configured instance
GitHub Repository
View source code and latest configuration options