Deployment
Nile runs anywhere Bun or Node.js can run. It is designed for stateful backends, long-running servers with high availability, rather than serverless environments.
Runtime Requirements
Nile is not optimized for serverless functions. Each request handler maintains internal state through the action pipeline, hooks, and context. Cold starts would reset this state. Deploy Nile as a persistent server, not as ephemeral functions.
Database Support
Nile uses Drizzle ORM, which supports any database Drizzle supports. This includes PostgreSQL, MySQL, SQLite, Cloudflare D1, and more. The default template uses PGLite for simplicity, but you can switch to any supported database by updating your Drizzle configuration.
Deployment Options
Docker (Recommended for Production)
The fastest way to deploy Nile with a production database is using Docker.
With PostgreSQL
Create a docker-compose.yml for a production-ready setup with PostgreSQL:
Build and run:
With PGLite (Simplified)
For simpler setups or development, use PGLite (embedded PostgreSQL):
This requires no external database. PGLite stores data in a Docker volume.
Bare Metal / VPS
Deploy directly on a server with Bun or Node.js installed:
Or build and run with Node.js:
Container Platforms
Nile works on any container platform:
- Railway —
railway upwith a Dockerfile - Render — Deploy from GitHub with a Dockerfile
- Fly.io —
fly launchwith a Dockerfile - AWS EC2 — Run a Docker container on an EC2 instance
- GCP Cloud Run — Deploy the container to Cloud Run
- Kubernetes — Deploy the Docker image with kubectl
All platforms work the same way: build a Docker image and run it.
Docker Setup
Dockerfile
A production-ready Dockerfile for Nile:
.dockerignore
Exclude unnecessary files from the build:
Build and Run
Multi-Stage Build (Smaller Image)
For a smaller production image:
Environment Variables
Nile reads configuration from environment variables. Common ones:
Refer to the Server Configuration for the full list.
Health Checks
Nile exposes a /status endpoint when enabled:
Configure your orchestrator to use this for health checks:
Scaling
Nile is designed for vertical scaling on a single instance. For horizontal scaling:
- Use a separate PostgreSQL database (not PGLite)
- Session storage must be external (Redis, database)
- Use a load balancer in front of multiple instances
PGLite does not support horizontal scaling because it is embedded. For production with multiple instances, use PostgreSQL as the database.
What's Not Supported
- Serverless — Lambda, Vercel Functions, Cloudflare Workers
- Serverless databases — DynamoDB, Firestore (use PostgreSQL)
- Horizontal scaling with PGLite — Use PostgreSQL instead