Deployment
Nex applications are standard Elixir applications, and we recommend containerized deployment for running on various platforms.
🐳 Docker Deployment (Recommended)
Every project created with mix nex.new includes an optimized Dockerfile.
-
Build the Image:
docker build -t my_nex_app . -
Run the Container:
docker run -p 4000:4000 -e SECRET_KEY_BASE=your_secret my_nex_app
🚀 Cloud Platform Deployment
Railway (Fastest)
- Connect your GitHub repository.
-
Railway will automatically detect the
Dockerfileand start building. -
Add
SECRET_KEY_BASEin the environment variables (generate one withmix phx.gen.secret).
Fly.io
-
Install
flyctl. -
Run
fly launch. - Fly.io will automatically detect the Elixir project and guide you through deployment.
Render
- Create a new “Web Service.”
- Connect your repository and choose “Docker” as the environment.
- Configure the port to 4000.
📋 Deployment Checklist
- [ ] SECRET_KEY_BASE: Ensure this secret is set in the environment variables.
- [ ] Static Assets: While Nex supports basic static file serving, it’s recommended to use a CDN under high load.
-
[ ] Health Check: Configure your load balancer to check the
/path; a 200 status code indicates the application is healthy.