nextdeploy

module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT

README

NextDeploy — Self-Hosted Next.js Deployment Engine

GitHub Release Go Version Documentation Discord

Deploy Next.js on your infrastructure. Not someone else's platform.

NextDeploy is an open-source, self-hosted Next.js deployment engine and Vercel and Opensst alternative built in Go. It builds, analyses, and deploys modern Next.js applications (Next.js 14, 15, and 16 App Router, Pages Router, and Turbopack) to your own Linux VPS, AWS infrastructure (Lambda, S3, CloudFront, ACM, Secrets Manager), or Cloudflare Workers from a single nextdeploy.yml configuration file and one CLI.

No managed platform subscription. No infrastructure lock-in. Your servers, your cloud accounts, your deployment pipeline.

curl -sSf https://nextdeploy.org/install.sh | sh

Windows: download install.bat from https://nextdeploy.org/install.bat (curl.exe -sSfO https://nextdeploy.org/install.bat && install.bat).

Questions, bug reports, or just want to follow along? Join the community on Discord or explore the full docs at nextdeploy.org/docs.


Deployment Targets

One deployment engine. Multiple infrastructure targets — switch targets in nextdeploy.yml without rewriting your application.

Target Status Architecture & Capabilities Guides
Linux VPS stable Bare-metal Ubuntu/Debian with nextdeployd, Caddy reverse proxy, automatic HTTPS, atomic port-switching, systemd isolation, Coraza WAF, and instant rollback VPS Quickstart · docs/targets/vps.md
AWS stable Automated provisioning of AWS Lambda, S3, CloudFront, ACM SSL certificates, SQS ISR revalidation, Sharp image optimization, and AWS Secrets Manager AWS Quickstart · docs/targets/aws.md
Cloudflare Workers stable Compiled via nextcompile (nextserver engine) for Cloudflare Workers, R2 static assets, KV, D1, Hyperdrive, Queues, and Durable Objects (Next.js 14/15/16 + Turbopack) Cloudflare Quickstart · docs/targets/cloudflare.md

Build Intelligence (metadata.json)

Current Nextjs deployment tools only move files from one environment to another. NextDeploy inspects your Next.js build output on every nextdeploy build and generates a structured metadata.json so the engine understands your application before shipping:

  • Route classification: Automatically identifies static, SSR, ISR, API, and middleware routes from Next.js build manifests.
  • Integration detection: Inspects generated build output to identify supported third-party integrations and external origins.
  • Secret validation: Cross-references detected integrations with configured secrets and warns about missing configuration before deployment.
  • ISR awareness: Identifies ISR routes and their revalidation intervals for targeted cache management.
  • Deployment provenance: Records Git commit information, dirty working-tree state, Next.js version, and build timestamp.
  • Build fingerprinting: Records package manager, application entrypoint, output mode, and asset inventory to determine how the application should be deployed.

Production Features Without Platform Lock-In

  • Atomic zero-downtime deployments: Dual-stage TCP + HTTP health probing with atomic port-switching and POSIX symlink renames (current.tmp ➔ current) before traffic moves to the new release.
  • Instant rollback: Keep previous releases available and restore a working deployment in seconds via nextdeploy rollback.
  • Infrastructure security: Hardened systemd services (DynamicUser=yes, ProtectSystem=strict, PrivateTmp=yes), ChaCha20-Poly1305 encrypted secrets, HMAC-SHA256 command signing, and integrated Coraza WAF (OWASP CRS) protection.
  • Automated provisioning: Prepare a Linux VPS (nextdeploy prepare) or provision supported AWS and Cloudflare resources through the deployment workflow.
  • Deployment auditability: Structured audit logs tracking deployments, system changes, Git provenance, and application releases.
  • Incremental builds: Avoid unnecessary rebuild work when your application has not changed.
  • Cumulative static chunk pooling (shared_static): Eliminates Next.js ChunkLoadError 404s for active user sessions across zero-downtime updates.
  • Native Agent Trace & MCP server: Track AI coding agent mental models, prompts, and diffs (nextdeploy trace ui on http://localhost:4044), run nextdeploy takeover -o, or connect Cursor, Claude Code, and Antigravity via nextdeploy mcp.
  • Zero-touch CI/CD generation: Generate GitHub Actions or GitLab CI workflows with nextdeploy generate-ci including PR drift detection (nextdeploy plan --detailed-exitcode) and ephemeral Cloudflare preview environments.

How NextDeploy Works

  1. 01. Analyse — Run nextdeploy build to inspect your Next.js output, classify routes, identify integrations, fingerprint assets, and generate deployment metadata.
  2. 02. Validate — Run nextdeploy plan to check deployment requirements, configuration, secrets, build constraints, and application metadata before shipping.
  3. 03. Deploy — Run nextdeploy ship to build when necessary, package your application, and deploy it to your selected infrastructure target.
  4. 04. Verify — Health checks, deployment status (nextdeploy status), release tracking, and instant rollback (nextdeploy rollback) keep production deployments reliable.
CLI Quick Start
# Install NextDeploy
curl -sSf https://nextdeploy.org/install.sh | sh

# Initialize your project (creates nextdeploy.yml)
nextdeploy init

# Prepare your VPS (VPS deployments only)
nextdeploy prepare

# Preview planned infrastructure and release changes
nextdeploy plan

# Deploy your application
nextdeploy ship

# Check deployment status & stream logs
nextdeploy status
nextdeploy logs -f

# Agent Trace & Human Takeover
nextdeploy trace ui     # launch local trace dashboard at http://localhost:4044
nextdeploy takeover -o  # open agent handoff brief in your $EDITOR

nextdeploy.yml holds everything — target type, domain, server, secrets provider, and bindings. See sample.nextdeploy.yml for the full annotated schema.


Who NextDeploy Is For

  • Developers self-hosting Next.js applications on their own infrastructure.
  • Teams deploying Next.js to bare-metal Linux VPS instances (Hetzner, DigitalOcean, Linode, bare metal).
  • Engineers building serverless and edge Next.js apps on AWS and Cloudflare Workers.
  • Businesses seeking predictable cloud costs and full infrastructure ownership.
  • Developers looking for an open-source, self-hosted alternative to managed deployment platforms.

Build from source

git clone https://github.com/aynaash/NextDeploy
cd NextDeploy
go build -o nextdeploy ./cli
Live reloading with Air

For rapid local iteration, run mage dev (or air -c .air.cli.toml) to automatically recompile nextdeploy to ~/.nextdeploy/bin/nextdeploy on every code change. See docs/local-development-air.md.

Requires Go 1.26+. To embed the auxiliary AWS Lambdas (imgopt, revalidator) in a local build, run ./build-lambdas.sh (or mage buildLambdas) before go build. Official release binaries on GitHub compile them automatically via GoReleaser; see .goreleaser.yml.

Repository layout

cli/                       Cobra CLI entry, all top-level commands
daemon/                    nextdeployd — the agent that runs on each VPS
shared/nextcompile/        Build-time compiler + JS runtime for CF Workers
shared/nextcore/           Next.js project introspection (config, routes, deps)
cli/internal/serverless/   AWS & Cloudflare deployment adapters
frontend/                  Official NextDeploy website & documentation (nextdeploy.org)
sample.nextdeploy.yml      Annotated reference config

Documentation

Contributing

Issues and PRs always welcomed. Run go test ./... before pushing , the release pipeline is gated on a green test run. For larger changes, open an issue first so we can align on direction. The Discord is the fastest place to get a yes/no on direction before you spend time on a PR.

License

MIT — see LICENSE.

Directories

Path Synopsis
Package assets is aws embed binary
Package assets is aws embed binary
cli
NextDeploy CLI is a command-line interface for interacting with and managing Next.js app deployments across self-hosted infrastructure.
NextDeploy CLI is a command-line interface for interacting with and managing Next.js app deployments across self-hosted infrastructure.
cmd
NextDeploy - A clean and powerful CLI for Next.js deployments
NextDeploy - A clean and powerful CLI for Next.js deployments
internal/buildflow
Package buildflow is the single entry point for "prepare a Next.js
Package buildflow is the single entry point for "prepare a Next.js
internal/cicd
Package cicd renders the GitHub Actions deploy workflow.
Package cicd renders the GitHub Actions deploy workflow.
internal/infrasniff
Package infrasniff inspects a Next.js project's source tree and package.json to infer which Cloudflare resources it needs (D1, R2, KV, Workers AI, Hyperdrive, Vectorize, Queues), which server-side secrets it references, and whether it has an auth layer worth protecting.
Package infrasniff inspects a Next.js project's source tree and package.json to infer which Cloudflare resources it needs (D1, R2, KV, Workers AI, Hyperdrive, Vectorize, Queues), which server-side secrets it references, and whether it has an auth layer worth protecting.
internal/initialcommand
Package initialcommand process confiuration variables needed to setup the project
Package initialcommand process confiuration variables needed to setup the project
internal/logs
Package logs aggregates and formats log streams from multiple sources.
Package logs aggregates and formats log streams from multiple sources.
internal/scaffold
Package scaffold generates a Cloudflare-ready fullstack Next.js starter (App Router + Drizzle + better-auth + R2 + Workers AI + proxy.ts guard) from embedded templates.
Package scaffold generates a Cloudflare-ready fullstack Next.js starter (App Router + Drizzle + better-auth + R2 + Workers AI + proxy.ts guard) from embedded templates.
internal/server
Package server handles vps deployemtn and connections
Package server handles vps deployemtn and connections
internal/serverless
Package serverless orchestrates serverless deployments across cloud providers.
Package serverless orchestrates serverless deployments across cloud providers.
internal/serverless/aws
Package aws implements the AWS Lambda, S3, and CloudFront serverless provider.
Package aws implements the AWS Lambda, S3, and CloudFront serverless provider.
internal/serverless/cloudflare
Package cloudflare implements the Cloudflare Workers and R2 serverless provider.
Package cloudflare implements the Cloudflare Workers and R2 serverless provider.
internal/serverless/cloudflare/adapter
Package adapter compiles and bundles Next.js standalone builds for Cloudflare Workers.
Package adapter compiles and bundles Next.js standalone builds for Cloudflare Workers.
internal/serverless/cloudflare/cfstate
Package cfstate is the persistent, encrypted record of the Cloudflare resources NextDeploy has provisioned (D1, KV, Hyperdrive, Queues, Vectorize, …) keyed by kind+name → real CF ID.
Package cfstate is the persistent, encrypted record of the Cloudflare resources NextDeploy has provisioned (D1, KV, Hyperdrive, Queues, Vectorize, …) keyed by kind+name → real CF ID.
internal/serverless/core
Package core defines the shared serverless provider contract, types, and local secret loading.
Package core defines the shared serverless provider contract, types, and local secret loading.
cmd
imgopt command
revalidator command
daemon
cmd/decrypt command
cmd/nextdeployd command
internal/config
Package config provides all the config state nextdeploy needs
Package config provides all the config state nextdeploy needs
internal/daemon
Package daemon is the main daemon at vps
Package daemon is the main daemon at vps
internal/prepare
Package prepare provisions a server for NextDeploy from the daemon's own static binary — no Python, no Ansible, nothing pre-installed on the target beyond a shell.
Package prepare provisions a server for NextDeploy from the daemon's own static binary — no Python, no Ansible, nothing pre-installed on the target beyond a shell.
internal
Package shared core sytem logic
Package shared core sytem logic
agenttrace
Package agenttrace manages AI coding agent trace checkpoints, events, and developer takeover briefs.
Package agenttrace manages AI coding agent trace checkpoints, events, and developer takeover briefs.
caddy
Package caddy is the web server and reverse proxy configuration tool
Package caddy is the web server and reverse proxy configuration tool
config
Package config manages the deployment config for nextjs web apps
Package config manages the deployment config for nextjs web apps
credstore
Package credstore stores cloud-provider credentials at rest, encrypted with a per-machine master key.
Package credstore stores cloud-provider credentials at rest, encrypted with a per-machine master key.
fs
git
nextcompile
Package nextcompile transforms a Next.js standalone build into a runtime-native Worker/Lambda bundle by analyzing the compiled output and emitting a dispatch table + manifest that a minimal JS runtime consumes at request time.
Package nextcompile transforms a Next.js standalone build into a runtime-native Worker/Lambda bundle by analyzing the compiled output and emitting a dispatch table + manifest that a minimal JS runtime consumes at request time.
nextcore
Package nextcore introspects Next.js projects, build manifests, routes, and static assets.
Package nextcore introspects Next.js projects, build manifests, routes, and static assets.
protection
Package protection builds the edge-guard runtime config from a user's protection spec.
Package protection builds the edge-guard runtime config from a user's protection spec.
sanitizer
Package sanitizer provides security-focused sanitization functions to prevent common vulnerabilities like command injection, path traversal, and other security issues.
Package sanitizer provides security-focused sanitization functions to prevent common vulnerabilities like command injection, path traversal, and other security issues.
secenv
Package secenv enforces a secure split between non-sensitive *vars* and *secrets*, and provides commit-safety + redaction helpers.
Package secenv enforces a secure split between non-sensitive *vars* and *secrets*, and provides commit-safety + redaction helpers.
sensitive
Package sensitive holds a process-wide registry of secret values that must never appear in any log line, error message, or stdout output.
Package sensitive holds a process-wide registry of secret values that must never appear in any log line, error message, or stdout output.
telemetry
Package telemetry sends a single anonymous "a project shipped" event on a successful deploy.
Package telemetry sends a single anonymous "a project shipped" event on a successful deploy.
utils
This package stores all util functions
This package stores all util functions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL