Skip to main content

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.
Important: Always refer to the official Screenshothis repository for the most up-to-date setup instructions, environment variables, and configuration requirements. The repository README and .env.example files contain the definitive setup information.
Why self-host? While our hosted service provides simplicity and reliability, self-hosting gives you complete data control, unlimited customization options, and eliminates external dependencies.

Project architecture

Screenshothis uses a modern monorepo architecture built with TypeScript:

Backend API

Location: apps/serverHono + tRPC API with TypeScript for fast, type-safe screenshot generation

Frontend Web App

Location: apps/webReact with TanStack Start and TailwindCSS for the dashboard and playground

Shared Packages

Location: packages/*Common schemas, utilities, and types shared across applications

Infrastructure

DependenciesPostgreSQL, Redis, and S3-compatible storage for complete functionality

Technology stack

Prerequisites

Before you begin, ensure you have these tools installed:
1

Install Node.js

Download and install Node.js v18 or later from nodejs.org
Verify your installation: node --version should show v18.0.0 or higher
2

Install pnpm

Install the pnpm package manager:
Verify: pnpm --version should show the installed version
3

Install Docker

Download and install Docker Desktop for your operating system
Verify: docker --version and docker-compose --version should both work
4

Install Git

Ensure Git is installed for cloning the repository
Verify: git --version should show your Git installation

Quick setup

Get Screenshothis running locally in under 10 minutes:
1

Clone the repository

You should now be in the screenshothis directory with all source code
2

Install dependencies

This installs all dependencies for the entire monorepo using pnpm workspaces.
You should see “Dependencies installed” and no error messages
3

Start supporting services

Launch PostgreSQL, Redis, and MinIO (for local storage):
This starts:
  • PostgreSQL on localhost:5432
  • Redis on localhost:6379
  • MinIO (S3-compatible) on localhost:9000 (API) and localhost:9001 (Console)
Verify services: docker-compose ps should show all services as “Up”
4

Configure environment variables

Copy and customize the environment files:
The default values work for local development with Docker Compose.
You can customize settings later. The defaults are configured to work with the Docker services.
5

Set up the database

Apply the database schema:
This creates all necessary tables in your PostgreSQL database.
You should see “Schema applied successfully” or similar confirmation
6

Configure local storage

Set up MinIO for local screenshot storage:
  1. Open MinIO console at http://localhost:9001
  2. Login with credentials:
    • Username: screenshothis-access-key
    • Password: screenshothis-secret-key
  3. Create a bucket named screenshothis-bucket
  4. Verify access - you should see the empty bucket
MinIO provides S3-compatible storage for local development. For production, use AWS S3, DigitalOcean Spaces, or another S3-compatible service.
7

Start the applications

Launch both the web interface and API server:
This starts:
Visit both URLs to verify everything is working. You should see the Screenshothis interface and API health check.

Environment configuration

Server environment (apps/server/.env)

Configure the server with these essential variables:

Web environment (apps/web/.env)

Configure the web interface:
Production security: Always use strong, unique passwords and secrets for production deployments. Never use the default development values.

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:
1

Build production images

2

Set up external services

Configure production-grade 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
3

Configure production environment

Create production environment files with:
  • Strong, unique passwords and secrets
  • Production database connections
  • Production S3-compatible storage credentials
  • Appropriate rate limits and timeouts
4

Set up infrastructure

Configure your production 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:
string
required
Strong, unique secret for authentication. Generate with openssl rand -base64 32
string
required
Connection string for your production PostgreSQL database
string
required
Connection string for your production Redis instance
string
required
Access key for your S3-compatible storage service
string
required
Secret key for your S3-compatible storage service
string
required
Name of your production storage bucket

Security considerations

When self-hosting, you’re responsible for security, updates, backups, and monitoring. Ensure you have proper security measures in place.

Built-in security features

Screenshothis includes several security measures:
  • 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
These limits prevent abuse and ensure consistent performance.
  • Screenshot generation is limited per user
  • Configurable rate limits via environment variables
  • Built-in protection against abuse
Monitor rate limit usage and adjust as needed for your use case.
  • Every use of bypass_csp=true is audit-logged server-side
  • Helps identify potential security issues
  • Enables security review and compliance
Review audit logs regularly for security monitoring.
  • All API inputs are validated using Zod schemas
  • URL validation prevents malicious requests
  • Parameter validation ensures data integrity
Input validation helps prevent injection attacks and data corruption.

Additional security recommendations

1

Keep dependencies updated

Regularly update Node.js, dependencies, and base Docker images to get security patches.
2

Secure your database

  • Use strong passwords
  • Enable SSL/TLS connections
  • Restrict network access
  • Regular backups
3

Configure HTTPS

  • Use SSL/TLS certificates for all connections
  • Configure secure headers
  • Enable HSTS (HTTP Strict Transport Security)
4

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:
This opens a web interface at 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:
For production, use migrations:
Development vs Production: Use 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

Problem: Services fail to start due to port conflictsSolutions:
  • Change ports in docker-compose.yml
  • Update environment variables to match new ports
  • Stop conflicting services: sudo lsof -i :5432 to find what’s using PostgreSQL port
Problem: Cannot connect to PostgreSQLSolutions:
  • 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
Problem: Screenshot storage not workingSolutions:
  • 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
Problem: Installation or build failuresSolutions:
  • 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

Search existing issues or create a new one for bugs and feature requests

View Docker Logs

Check service logs: docker-compose logs or docker-compose logs <service-name>

Community Discussions

Join discussions for questions, ideas, and community support

Documentation

Browse complete documentation for configuration and usage guides

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

1

Report issues

Found a bug or have a feature request? Create an issue with detailed information.
2

Improve documentation

Help others by improving documentation, adding examples, or fixing typos.
3

Submit code changes

Follow our development guidelines:
  • Run pnpm run check before 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)
4

Join discussions

Participate in GitHub Discussions to share ideas and help other users.

Development workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b fix-something
  3. Make your changes
  4. Test locally: pnpm run dev
  5. Submit a pull request

Next steps

Configuration Guide

Learn about all environment variables and configuration options

Deployment Guide

Production deployment strategies for different platforms

Troubleshooting

Detailed troubleshooting guide for common issues

API Reference

Complete API documentation for your self-hosted instance

License: AGPL-3.0 • Repository: github.com/screenshothis/screenshothis