Written in Rust · cross-platform · self-updating

Scaffold Next.js API
handlers in one command

A tiny, fast CLI that generates App-Router API handler files — route.ts, controller.ts and per-method handlers — from a single resource name. Stop copy-pasting boilerplate.

~/app/api/users — zsh
$ next api create user-profile --get --post
created: GET.ts
created: POST.ts
created: controller.ts
created: route.ts
✓ 4 file(s) created.

└─ GET.ts  → class GetUserProfileHandler
└─ route.ts → export const GET = getUserProfileHandler.toRoute()
Why next

Boilerplate, handled

Opinionated, safe, and built to extend. Everything you need for a clean API endpoint, nothing you don't.

One command

Pick a name and your methods — --get --post --put --delete — and get every file wired up instantly.

🧩

Smart naming

user-profile, userProfile, user_profile all normalise to UserProfile across every file.

🛡️

Never clobbers

All-or-nothing writes. Existing files are never silently overwritten — pass --force when you mean it.

📦

Embedded templates

Templates compile into the binary. No config, no runtime files, no surprises — just a single executable.

🔄

Self-updating

Run next --update to pull the latest release for your platform and swap the binary in place.

🖥️

Cross-platform

Prebuilt binaries for macOS (Intel & Apple Silicon), Linux (x86_64, ARM64, musl) and Windows.

Install

Up and running in seconds

Grab a prebuilt binary — no Rust toolchain required. Pick your platform.

# macOS — Apple Silicon (M1/M2/M3/M4) curl -L "https://github.com/floriankyn/next-cli/releases/download/v0.2.0/next-v0.2.0-aarch64-apple-darwin.tar.gz" | tar xz sudo mv next /usr/local/bin/ next --help
# macOS — Intel curl -L "https://github.com/floriankyn/next-cli/releases/download/v0.2.0/next-v0.2.0-x86_64-apple-darwin.tar.gz" | tar xz sudo mv next /usr/local/bin/ next --help
# Linux — x86_64 (ARM64 & musl builds also available) curl -L "https://github.com/floriankyn/next-cli/releases/download/v0.2.0/next-v0.2.0-x86_64-unknown-linux-gnu.tar.gz" | tar xz sudo mv next /usr/local/bin/ next --help
# Windows — PowerShell $Url = "https://github.com/floriankyn/next-cli/releases/download/v0.2.0/next-v0.2.0-x86_64-pc-windows-msvc.zip" Invoke-WebRequest -Uri $Url -OutFile next.zip Expand-Archive next.zip -DestinationPath "$env:LOCALAPPDATA\next-cli" -Force
# With a Rust toolchain (rustup.rs) cargo binstall next # fetches the prebuilt binary # …or build from source cargo install --git https://github.com/floriankyn/next-cli next

The binary is named next — if you use the Next.js CLI, rename it (e.g. next-scaffold). Already installed? Update with next --update.

Usage

A command for every shape

next api create <name> [methods] [-l <path>] [--force] [--dry-run]

All four methods, current directory
next api create User
A subset, into a target folder
next api create user-profile --get -l ./api/users
Overwrite existing files
next api create order --post --put --force
Preview without writing
next api create order --dry-run
Roadmap

Coming soon

Beyond API handlers — next is growing into a scaffolder for the rest of your app.

Next up

Context & Providers

One command to scaffold a fully typed React Context, its Provider, and a ready-to-use useX() hook — wired together, with the boilerplate and types written for you.

# planned
next ui create context Theme --provider
created: ThemeContext.tsx
created: ThemeProvider.tsx
created: useTheme.ts
✓ typed context + provider + hook, ready to wrap your tree.
Planned

🪝 Custom hooks

Scaffold typed useX hooks with sensible boilerplate and tests.

Planned

🧱 Provider composition

Generate a barrel that nests multiple providers into one clean tree.

Planned

🗄️ More resources

next db, next page and friends — same flat, safe workflow.

Have an idea or want to help shape it? Open an issue on GitHub ↗