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:
| Mode | AUTH_PROVIDER value | Description |
|---|---|---|
| Local auth | local | Built-in email/password authentication. No external dependencies. Best for self-hosted or internal deployments. |
| WorkOS | workos | Delegates authentication to WorkOS. Enables SSO, MFA, SAML, SCIM, and directory sync. Requires a WorkOS account. |
Environment variables
Create a.env file in your deployment directory. The following variables are required or commonly configured:
Required (all modes)
| Variable | Description |
|---|---|
AUTH_PROVIDER | Authentication mode. Set to local or workos. |
DATABASE_URL | PostgreSQL connection string. Example: postgresql://user:password@db:5432/pwnbook |
SESSION_SECRET | A random 32+ character secret for signing session tokens. |
REDIS_URL | Redis connection string. Example: redis://redis:6379 |
PORT | Port the backend API listens on (default: 3001) |
FRONTEND_URL | The public URL of your Pwnbook frontend. Example: https://pwnbook.example.com |
Local auth variables
Required whenAUTH_PROVIDER=local:
| Variable | Description |
|---|---|
ADMIN_EMAIL | Email address for the auto-seeded admin account (default: admin@local.net) |
ADMIN_PASSWORD | Password for the auto-seeded admin account (default: @dminUser) |
WorkOS variables
Required whenAUTH_PROVIDER=workos:
| Variable | Description |
|---|---|
WORKOS_API_KEY | Your WorkOS API key |
WORKOS_CLIENT_ID | Your WorkOS application client ID |
WORKOS_REDIRECT_URI | The OAuth callback URL. Example: https://pwnbook.example.com/auth/callback |
Optional
| Variable | Description |
|---|---|
STRIPE_SECRET_KEY | Enables billing features. Obtain from your Stripe dashboard. |
ANTHROPIC_API_KEY | Enables the AI assistant using Anthropic’s Claude models. |
OPENAI_API_KEY | Enables the AI assistant using OpenAI’s GPT models. |
ELECTRON_FRONTEND_URL | URL used by the Electron desktop app to connect to this instance. |
Setup
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.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: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 queue
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
In production, place Pwnbook behind a reverse proxy (e.g., nginx or Caddy) that handles TLS termination. Example nginx configuration: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: