Self-host Screenshothis
Take complete control of your screenshot infrastructure by running Screenshothis on your own servers. This guide walks you through everything from local development setup to production deployment.Project architecture
Screenshothis uses a modern monorepo architecture built with TypeScript:Backend API
apps/serverHono + tRPC API with TypeScript for fast, type-safe screenshot generationFrontend Web App
apps/webReact with TanStack Start and TailwindCSS for the dashboard and playgroundShared Packages
packages/*Common schemas, utilities, and types shared across applicationsInfrastructure
Technology stack
Prerequisites
Before you begin, ensure you have these tools installed:Install Node.js
node --version should show v18.0.0 or higherInstall pnpm
pnpm --version should show the installed versionInstall Docker
docker --version and docker-compose --version should both workInstall Git
git --version should show your Git installationQuick setup
Get Screenshothis running locally in under 10 minutes:Clone the repository
Install dependencies
Start supporting services
- PostgreSQL on
localhost:5432 - Redis on
localhost:6379 - MinIO (S3-compatible) on
localhost:9000(API) andlocalhost:9001(Console)
docker-compose ps should show all services as “Up”Configure environment variables
Set up the database
Configure local storage
- Open MinIO console at http://localhost:9001
- Login with credentials:
- Username:
screenshothis-access-key - Password:
screenshothis-secret-key
- Username:
- Create a bucket named
screenshothis-bucket - Verify access - you should see the empty bucket
Start the applications
- Web UI: http://localhost:3001
- API Server: http://localhost:3000
Environment configuration
Server environment (apps/server/.env)
Configure the server with these essential variables:
Web environment (apps/web/.env)
Configure the web interface:
Available scripts
Run these commands from the root directory:Development scripts
Build and production scripts
Database management scripts
Code quality scripts
Production deployment
Docker production setup
Build and deploy production-ready Docker images:Build production images
Set up external services
- PostgreSQL: Use managed PostgreSQL (AWS RDS, DigitalOcean Managed Databases, etc.)
- Redis: Use managed Redis (AWS ElastiCache, DigitalOcean Managed Redis, etc.)
- S3 Storage: Use AWS S3, DigitalOcean Spaces, Cloudflare R2, or Backblaze B2
Configure production environment
- Strong, unique passwords and secrets
- Production database connections
- Production S3-compatible storage credentials
- Appropriate rate limits and timeouts
Set up infrastructure
- Reverse proxy: nginx, Traefik, or cloud load balancer
- SSL certificates: Let’s Encrypt, cloud provider, or custom certificates
- Container orchestration: Docker Compose, Kubernetes, or cloud container services
Environment variables for production
Ensure these are properly configured for production:openssl rand -base64 32Security considerations
Built-in security features
Screenshothis includes several security measures:Request size limits
Request size 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)
- Request timeout: 30 seconds maximum
Rate limiting
Rate limiting
- Screenshot generation is limited per user
- Configurable rate limits via environment variables
- Built-in protection against abuse
CSP bypass auditing
CSP bypass auditing
- Every use of
bypass_csp=trueis audit-logged server-side - Helps identify potential security issues
- Enables security review and compliance
Input validation
Input validation
- All API inputs are validated using Zod schemas
- URL validation prevents malicious requests
- Parameter validation ensures data integrity
Additional security recommendations
Keep dependencies updated
Secure your database
- Use strong passwords
- Enable SSL/TLS connections
- Restrict network access
- Regular backups
Configure HTTPS
- Use SSL/TLS certificates for all connections
- Configure secure headers
- Enable HSTS (HTTP Strict Transport Security)
Monitor and log
- Set up application logging
- Monitor resource usage
- Track API usage patterns
- Set up alerts for unusual activity
Database management
View and manage data
Use Drizzle Studio for a visual database interface:http://localhost:4983 where you can:
- View all tables and data
- Edit records
- Run queries
- Manage relationships
Handle schema changes
For development, use the simple approach:db:push for rapid development iteration, but use migrations (db:generate and db:migrate) for production deployments where you need versioned, reversible database changes.Troubleshooting
Common issues and solutions
Port conflicts
Port conflicts
- Change ports in
docker-compose.yml - Update environment variables to match new ports
- Stop conflicting services:
sudo lsof -i :5432to find what’s using PostgreSQL port
Database connection errors
Database connection errors
- Verify PostgreSQL container is running:
docker-compose ps - Check database credentials in environment variables
- Ensure database exists:
docker-compose exec postgres psql -U screenshothis -d screenshothis - Reset database:
docker-compose down && docker-compose up -d
S3 storage connection errors
S3 storage connection errors
- For local development: Verify MinIO container is running and accessible at
http://localhost:9001 - Check AWS environment variables match your storage configuration
- Ensure the bucket exists and has proper permissions
- For production: Verify your S3-compatible service credentials and bucket permissions
- Test connection:
curl http://localhost:9000/minio/health/live
Build and dependency errors
Build and dependency errors
- Clear node_modules and reinstall:
rm -rf node_modules && pnpm install - Clear Turborepo cache:
rm -rf .turbo - Check TypeScript types:
pnpm run check-types - Verify Node.js version:
node --version(should be v18+) - Update pnpm:
npm install -g pnpm@latest
Getting help
GitHub Issues
View Docker Logs
docker-compose logs or docker-compose logs <service-name>Community Discussions
Documentation
Contributing
Screenshothis is an open source project (AGPL-3.0) with an active community. Your contributions help make it better for everyone.Ways to contribute
Report issues
Improve documentation
Submit code changes
- Run
pnpm run checkbefore committing - Ensure TypeScript types are correct:
pnpm run check-types - Test your changes locally with
pnpm run dev - Follow existing code style (Biome handles formatting)
Join discussions
Development workflow
- Quick Fix
- Feature Development
- Documentation
- Fork the repository
- Create a feature branch:
git checkout -b fix-something - Make your changes
- Test locally:
pnpm run dev - Submit a pull request
Next steps
Configuration Guide
Deployment Guide
Troubleshooting
API Reference
License: AGPL-3.0 • Repository: github.com/screenshothis/screenshothis