Prerequisites
Before you begin, make sure you have the following installed and available:- Docker 24.0 or later
- Docker Compose v2.20 or later
- A domain or hostname where Pwnbook will be accessible (required when using WorkOS authentication)
The Docker Compose setup includes PostgreSQL and Redis containers. You do not need to provision those separately unless you want to use external managed instances.
Choosing an authentication provider
Pwnbook supports two authentication modes, configured via theAUTH_PROVIDER environment variable:
For most self-hosted deployments, local auth is recommended. It requires no external accounts and works immediately.
Environment variables
Create a.env file in your deployment directory. The following variables are required or commonly configured:
Required (all modes)
Local auth variables
Required whenAUTH_PROVIDER=local:
WorkOS variables
Required whenAUTH_PROVIDER=workos:
Optional
Setup
1
Clone the deployment repository
2
Configure your environment
Copy the example environment file and fill in your values:Edit
.env with your editor. At minimum, set AUTH_PROVIDER, SESSION_SECRET, and the database/Redis URLs.3
Configure authentication
- Local auth (recommended)
- WorkOS
Set the following in your No external accounts or redirects are required. The admin account is seeded automatically on first startup.
.env:4
Start the services
frontend— React web applicationbackend— Fastify API serverrecon-worker— Python recon scanning serviceai-worker— Python AI assistant servicedb— PostgreSQL databaseredis— Redis for the job queuecaddy— Reverse proxy with automatic HTTPS
5
Verify the deployment
Check that all services are healthy:All services should show a status of Navigate to your configured
running or healthy. You can also check individual service logs:FRONTEND_URL in a browser to confirm the application is accessible.Optional services
Enabling billing with Stripe
To enable subscription billing:- Create a Stripe account and obtain your secret key from the Stripe dashboard.
- Add
STRIPE_SECRET_KEYto your.envfile. - Configure your Stripe webhook endpoint to point to
https://your-domain.com/api/billing/webhook. - Restart the backend service:
docker compose restart backend.
Enabling AI features
AI features require at least one of the following:ANTHROPIC_API_KEY— Uses Claude models (recommended)OPENAI_API_KEY— Uses GPT models
.env file and restart the ai-worker:
Reverse proxy configuration
The Docker Compose stack includes Caddy as the reverse proxy. Caddy automatically provisions and renews TLS certificates via Let’s Encrypt — no manual certificate management required. SetFRONTEND_URL to your public domain (e.g., https://pwnbook.example.com) and Caddy will handle the rest on startup.
Database backup and restore
Manual backup
Export / import
Pwnbook includes built-in scripts for exporting and importing the database, useful for migrating between hosts or creating portable snapshots:Upgrading
To upgrade to a new Pwnbook version:Health checks
The backend exposes a health check endpoint atGET /api/health. You can use this with your monitoring system or load balancer: