Skip to Content
🎉 Mailprex 1.0 is soon to released. Read more →
Self-host Mailprex with Docker

Self-host Mailprex with Docker

Run Mailprex on your own VPS with MongoDB and your SMTP server.

Quick start

  1. Copy environment file:
cp back/.example.env back/.env
  1. Edit back/.env — minimum required:
MAILPREX_MODE=selfhost JWT_SECRET=your-long-random-secret MAILPREX_SMTP_HOST=smtp.example.com MAILPREX_SMTP_PORT=587 MAILPREX_SMTP_USER=your-user MAILPREX_SMTP_PASS=your-password FRONTEND_URL=http://localhost:3000
  1. Start stack:
docker compose up -d --build

API listens on http://localhost:5000.

Environment reference

VariableDescription
MAILPREX_MODEselfhost for private deployments
MAILPREX_ALLOW_SIGNUPfalse to disable public registration
MAILPREX_REQUIRE_EMAIL_VERIFYtrue to require email verification (default false in self-host)
MAILPREX_SMTP_*Custom SMTP transport (recommended)
MONGODB_URISet automatically in docker-compose.yml to mongodb://mongo:27017/mailprex

Frontend

Point the Next.js app to your API:

NEXT_PUBLIC_API_URL=http://localhost:5000

For production, serve the front behind HTTPS on the same domain or configure CORS_ORIGINS.

Health check

curl http://localhost:5000/

Response includes the active MAILPREX_MODE.

Legacy token audit

On the host machine with Mongo access:

cd back && npm run report-legacy-tokens

Ask affected users to regenerate tokens in the dashboard (mk_live_… format).

Last updated on
Mailprex Docs 2026 © Mailprex.