Your First Deployment
Learn how to deploy your first Next.js application with NextDeploy in just a few steps.
Prerequisites
Make sure you have:
- ✓NextDeploy CLI installed
- ✓A Next.js project ready to deploy
- A Linux VPS (Ubuntu/Debian) or AWS Account
- ✓A VPS with SSH access
- ✓Doppler account for secrets (optional)
Step-by-Step Guide
Step 1: Initialize Your Project
cd your-nextjs-project
nextdeploy initThis creates:
- •
nextdeploy.yml- Primary configuration - •
.nextdeploy/- Auto-generated route metadata cache
Step 2: Configure Your Deployment
Edit nextdeploy.yml for your target environment:
For AWS Serverless:
version: 1.0
target_type: "serverless"
serverless:
provider: "aws"
region: "us-east-1"
s3_bucket: "my-nextjs-assets"For Linux VPS:
version: 1.0
target_type: "vps"
servers:
- host: 192.168.1.100
ssh_key: "~/.ssh/id_rsa"Step 3: Server Preparation (VPS Only)
nextdeploy prepareNextDeploy will securely connect to your server, install dependencies, and configure the background daemon automatically.
Step 4: Continuous Integration (Zero-Touch)
nextdeploy generate-ciThis generates a GitHub Actions workflow. Add your secrets to GitHub and NextDeploy handles everything on Git Push.
Step 5: Deploy Manually
nextdeploy build
nextdeploy deployThe CLI analyzes your Route Plan and executes a Zero-Downtime port swap (VPS) or S3 static synchronization (AWS).
Step 6: Instant Rollbacks
nextdeploy rollbackBecause NextDeploy uses a Symlink architecture on VPS targets, rollbacks occur instantly without rebuilds.
What Happens During Deployment
- Project analyzed to determine Next.js Output Mode
- VPS: Bundle transferred, extracted to isolated release directory
- VPS: Dynamic port allocated, Next.js server booted via systemd
- VPS: Symlink updated to point to new release
- VPS: Caddy config dynamically rewritten and reloaded without dropping traffic
- AWS: Static assets intelligently pushed to S3/CloudFront
- AWS: Lambda Web Adapter attached for Next.js SSR backend
Common Issues
SSH Connection Failed
Make sure your SSH key is properly configured:
ssh -i ~/.ssh/id_rsa deploy@192.0.2.123Port Already in Use
If port 3000 is already in use, change it in nextdeploy.yml:
app:
port: 8080