Get started

Docker Compose

Run Pretend as a Compose service with a persistent volume and settings read from an env file.

The service

Save this as docker-compose.yml:

docker-compose.yml
services:
  resend-emulator:
    image: a2coder/pretend:latest
    ports:
      - "3300:3000"
    env_file:
      - .env.local
    environment:
      DATA_DIR: /app/.data
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - resend-data:/app/.data
    restart: unless-stopped

volumes:
  resend-data:

note

This file publishes Pretend on port 3300, so use http://localhost:3300/ wherever these docs say localhost:3000. Change the left side of 3300:3000 to pick another port.

The env file

Create .env.local next to the Compose file. See Configuration for what each variable does.

.env.local
RESEND_API_KEY=re_local_dev_key
ADMIN_USERNAME=admin
# generate with the command under Configuration › Dashboard login
ADMIN_PASSWORD=scrypt:REPLACE:REPLACE
SESSION_SECRET=change-me-to-a-long-random-string
DISABLE_LOGIN=false
RATE_LIMIT=false
DOMAIN_ENFORCEMENT=true

DATA_DIR is set in the Compose file itself, so it always matches the volume mount.

Start and stop

Start Pretend in the background:

Terminal
docker compose up -d

Stop it:

Terminal
docker compose down

down keeps the resend-data volume. Add -v to delete it along with every captured email.

Use it from another service

Other services in the same Compose project reach Pretend by its service name, on the container port:

.env
RESEND_BASE_URL=http://resend-emulator:3000/