nextdeploy

module
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 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://hersi.dev/nextdeploy/install.sh | bash
# Mirror: curl -fsSL https://nextdeploy.org/install.sh | bash

Windows: download install.bat from https://hersi.dev/nextdeploy/install.bat (or 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 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.

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 beta Workers + R2 + KV via the nextcompile adapter

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/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
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.
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