-
Notifications
You must be signed in to change notification settings - Fork 1
Deployment
Mailbox supports two primary deployment strategies. Choose the one that best fits your infrastructure.
Vercel is the easiest and fastest way to deploy a Next.js application. It handles scaling, SSL, and zero-downtime deployments automatically.
- Go to vercel.com and log in.
- Click Add New Project → Import your
mail-boxGitHub repository. - Select Next.js as the framework preset (should be auto-detected).
In the Vercel project settings, add the following environment variables:
| Variable | Description |
|---|---|
DATABASE_URL |
Pooled connection string from Neon/Supabase |
AUTH_SECRET |
A long random secret string (use openssl rand -base64 32) |
SMTP_HOST |
Outgoing SMTP server |
SMTP_PORT |
SMTP port (465 or 587) |
SMTP_USER |
SMTP username |
SMTP_PASS |
SMTP password |
NEXT_PUBLIC_APP_URL |
Your public app URL (e.g., https://mail.yourcompany.com) |
In Project Settings → Build & Development Settings, set the Build Command to:
npm run vercel-buildThis command runs:
prisma generate && prisma db push && next buildIt automatically handles client generation, schema sync, and the Next.js production build.
Click Deploy. Vercel will build and publish the application. Your app will be live at a .vercel.app URL, which you can then map to your custom domain.
Use this option if you want full control over your infrastructure (AWS EC2, DigitalOcean Droplet, Hetzner, etc.).
- A Linux VPS with Docker and Docker Compose installed.
- A domain name pointing to your server's IP address.
- A reverse proxy (Nginx or Caddy) for SSL termination.
git clone https://github.com/Prashant4900/mail-box.git
cd mail-boxcp .env.example .env
nano .env # or use your preferred editorFill in your production database URL, SMTP credentials, and app URL.
npm run docker:upThis builds the Docker image and starts all containers in detached mode.
server {
listen 80;
server_name mail.yourcompany.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}Use Certbot to provision a free SSL certificate:
sudo certbot --nginx -d mail.yourcompany.com| Command | Description |
|---|---|
npm run docker:up |
Build and start all containers |
npm run docker:down |
Stop and remove containers |
npm run docker:logs |
Stream live logs from all containers |
- Application loads at your public URL over HTTPS.
- Setup wizard completes and admin account is created.
- Database connection is healthy (check logs).
- SMTP sending works (send a test email from compose).
- Cloudflare domain is linked in Settings.
- At least one mailbox address is configured and tested.
- Team members are invited via the Users panel.
Pushing to the main branch on GitHub will trigger an automatic Vercel deployment. Zero manual steps needed.
cd mail-box
git pull origin main
npm run docker:down
npm run docker:up