nextdeploy

module
v1.0.0 Latest Latest
Warning

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

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

README

NextDeploy

Deploy Next.js apps to a VPS, AWS Lambda, or Cloudflare Workers from one config file and one command. Open source, self-hosted, no vendor lock-in.

curl -fsSL https://nextdeploy.org/install.sh | bash

Windows: download install.bat from https://nextdeploy.org/install.bat.

Questions, bug reports, or just want to follow along? Join the community on Discord.

Quick start

nextdeploy init         # scaffold nextdeploy.yml in your Next.js repo
nextdeploy plan         # show what will happen, change nothing
nextdeploy ship         # build + push + deploy to your target
nextdeploy takeover -o  # human takeover from AI coding agents in your $EDITOR
nextdeploy trace ui     # launch local trace dashboard at http://localhost:4044
nextdeploy logs -f      # tail production logs

nextdeploy.yml holds everything — target type, domain, server, secrets provider. See sample.nextdeploy.yml in this repo for the full schema.

Key Architecture & Features

  • True Zero-Downtime Atomic Cutover: Dual-stage TCP + HTTP health probing with atomic POSIX symlink renames (current.tmp ➔ current).
  • Cumulative Static Chunk Pooling (shared_static): Eliminates the Next.js ChunkLoadError 404s for active user sessions across updates.
  • Bare-Metal Speed (Go + Caddy + Systemd): No Docker daemon overhead. Uses Linux kernel cgroup v2 memory sandboxing and offloads all static bytes directly to NVMe disk via Caddy.
  • Multi-Target Portability: Deploy to a $4 VPS, AWS Lambda, or Cloudflare Workers from a single config file.
  • Native Agent Trace & Human Takeover: Track the mental model, prompts, and diffs of AI coding agents (Antigravity, Claude Code, Cursor) with an embedded local dashboard (nextdeploy trace ui on :4044) and 1-command developer takeover (nextdeploy takeover -o).
  • Zero-Touch CI/CD Automation: Production-ready GitHub Actions workflows for VPS (hardened SSH, dual-key paths, host-key pinning) and Cloudflare (ephemeral PR previews, remote state encryption, and dry-run IaC planning via nextdeploy plan --detailed-exitcode).

Targets

Target Status What it gives you
VPS stable Caddy + the nextdeployd daemon over SSH
AWS stable Lambda + S3 + CloudFront, full SSR/ISR/image opt
Cloudflare stable Workers + R2 + KV + D1 + Hyperdrive + Queues via nextcompile (nextserver engine, Next.js 14/15/16 + Turbopack)

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.25+. The release binaries on GitHub are built with 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 adapter (Lambda, S3, CloudFront, ACM)
sample.nextdeploy.yml      Annotated reference config

Documentation

Contributing

Issues and PRs welcome. 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
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/serverless
Package serverless is the serverless deployment package for nextdeploy
Package serverless is the serverless deployment package for nextdeploy
internal/serverless/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.
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
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