Deployment
Express Forge provides production-ready configurations to help you ship your API with confidence.
🐳 Docker Deployment (Recommended)
The easiest way to deploy is using the provided multi-stage Dockerfile.
Build Image
bash
docker build -t my-express-api .Run Container
bash
docker run -p 3000:3000 --env-file .env my-express-apiWhy Multi-stage?
Our Dockerfile uses multi-stage builds to:
- Reduce Image Size: The final image only contains the compiled JavaScript and production dependencies.
- Security: Source code and build tools are not included in the final production image.
☁️ Cloud Platforms
Railway / Render / Fly.io
Most modern PaaS platforms will automatically detect the Dockerfile or the start script in package.json.
- Connect your GitHub repository.
- Configure your environment variables (copy from
.env). - Set the build command to
npm run build(if not using Docker).Note for Prisma users: The generated
package.jsonincludes apostinstall: "prisma generate"script, which ensures your Prisma client is generated automatically before the build step on most PaaS platforms. - Set the start command to
npm start.
🛡️ Production Checklist
Before going live, ensure:
- [ ] Environment Variables:
NODE_ENVis set toproduction. - [ ] Database: Migrations have been run on the production database.
- [ ] Logging: Log level is set appropriately (e.g.,
infoorerror). - [ ] Security: CORS is restricted to your frontend domain.
- [ ] Rate Limiting: Configured for your production traffic.