Render offers a straightforward deployment experience with managed MongoDB and Redis. It's reliable, developer-friendly, and scales easily.
Why Render?
- Native Docker support
- Managed Redis included
- Simple environment configuration
- Automatic SSL certificates
- Good free tier for testing
Prerequisites
- A GitHub account
- A Render account (sign up at render.com)
- A MongoDB Atlas account (Render doesn't offer managed MongoDB)
- Maillayer repository forked to your GitHub
Step 1: Set Up MongoDB Atlas
Since Render doesn't provide managed MongoDB, you'll use MongoDB Atlas (free tier available):
- Go to mongodb.com/atlas and create an account
- Create a new cluster (free M0 tier works fine)
- Click Connect → Connect your application
- Copy the connection string
- Replace
<password>with your database user password
Step 2: Create a Redis Instance on Render
- Log into Render and click New → Redis
- Choose a name like
maillayer-redis - Select the Free plan for testing or Starter for production
- Click Create Redis
- Copy the Internal URL from the Redis dashboard
Step 3: Deploy Maillayer as a Web Service
- Click New → Web Service
- Connect your GitHub and select the Maillayer repository
- Configure the service:
| Setting | Value |
|---|---|
| Name | maillayer |
| Runtime | Docker |
| Instance Type | Starter or higher |
Step 4: Configure Environment Variables
In the Environment section, add these variables:
NODE_ENV=production
BASE_URL=https://maillayer.onrender.com
NEXTAUTH_SECRET=your-secret-key-minimum-32-characters
TRACKING_SECRET=your-tracking-secret
MONGODB_URI=mongodb+srv://user:password@cluster.mongodb.net/maillayer
REDIS_URL=<Internal Redis URL from Step 2>
Step 5: Deploy
- Click Create Web Service
- Render will build and deploy your application
- Wait 5-10 minutes for the initial build
- Access your app at
https://your-service.onrender.com
Step 6: Add Custom Domain (Optional)
- Go to your service Settings → Custom Domains
- Add your domain and configure DNS as instructed
- Render automatically provisions SSL
- Update
BASE_URLto your custom domain
Health Checks
Render performs automatic health checks. If your app becomes unresponsive, it restarts automatically. Configure health check path in Settings if needed.
Estimated Costs
| Resource | Free Tier | Production |
|---|---|---|
| Web Service | Limited (spins down) | $7/month (Starter) |
| Redis | Free tier | $10/month (Starter) |
| MongoDB Atlas | Free M0 | $9/month (M2) |
Total: Free tier available, ~$17-26/month for production.
Troubleshooting
Service keeps spinning down
- Free tier services spin down after 15 minutes of inactivity. Upgrade to Starter plan for always-on.
Slow cold starts
- First request after spin-down takes 30-60 seconds. Use a paid plan to avoid this.
MongoDB connection timeout
- Ensure your MongoDB Atlas cluster allows connections from
0.0.0.0/0(Network Access settings).
Workers crashing
- Check logs in the Render dashboard. Verify Redis connection string is the internal URL.
