Skip to main content

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 the AUTH_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 when AUTH_PROVIDER=local:
Change ADMIN_EMAIL and ADMIN_PASSWORD from their defaults before deploying to any non-local environment.

WorkOS variables

Required when AUTH_PROVIDER=workos:

Optional

Never commit your .env file to version control. Store secrets in a secrets manager or use Docker secrets in production.

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

4

Start the services

This starts the following containers:
  • frontend — React web application
  • backend — Fastify API server
  • recon-worker — Python recon scanning service
  • ai-worker — Python AI assistant service
  • db — PostgreSQL database
  • redis — Redis for the job queue
  • caddy — Reverse proxy with automatic HTTPS
Database migrations run automatically on startup.
5

Verify the deployment

Check that all services are healthy:
All services should show a status of running or healthy. You can also check individual service logs:
Navigate to your configured FRONTEND_URL in a browser to confirm the application is accessible.

Optional services

Enabling billing with Stripe

To enable subscription billing:
  1. Create a Stripe account and obtain your secret key from the Stripe dashboard.
  2. Add STRIPE_SECRET_KEY to your .env file.
  3. Configure your Stripe webhook endpoint to point to https://your-domain.com/api/billing/webhook.
  4. Restart the backend service: docker compose restart backend.
See Billing Administration for full details on configuring plans and webhooks.

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
Add the key(s) to your .env file and restart the ai-worker:
Once running, server admins can configure the default AI provider through the admin panel. See AI Providers for more.

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. Set FRONTEND_URL to your public domain (e.g., https://pwnbook.example.com) and Caddy will handle the rest on startup.
Caddy requires ports 80 and 443 to be reachable from the internet for ACME certificate issuance. For internal-only deployments, configure a custom Caddyfile to use a private CA or self-signed certificates.

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:
Always back up your database before upgrading.

Upgrading

To upgrade to a new Pwnbook version:
Database migrations run automatically on startup. If you need to run them manually:

Health checks

The backend exposes a health check endpoint at GET /api/health. You can use this with your monitoring system or load balancer: