NextRush
Getting Started

create-nextrush

CLI reference for create-nextrush — flags, presets, generated layouts, and next steps

The create-nextrush package scaffolds a runnable NextRush app: scripts, tsconfig, routers, optional controllers, and middleware presets. For the onboarding flow, start from Installation; this page lists flags and templates.

Quick Start

pnpm create nextrush, npm create nextrush, and similar commands use a space between create and nextrush. Your package manager resolves that to the npm package create-nextrush. You can also call that package directly with npx or pnpm dlx using the hyphenated name.

# Interactive (recommended) — space after "create"
pnpm create nextrush
npm create nextrush
yarn create nextrush
bun create nextrush

Pin the scaffolder (for example to @latest or a specific version) by putting @… after nextrush:

npm create nextrush@latest
pnpm create nextrush@latest

Same tool, using the published package name:

npx create-nextrush@latest
pnpm dlx create-nextrush@latest
bunx create-nextrush

pnpm dlx uses the package name

Use pnpm dlx create-nextrush, not pnpm dlx create nextrush. The latter is not a valid package name; the scaffolder’s name on npm is create-nextrush (with a hyphen).

"command not found" on npm

If npm create or npx fails with create-nextrush: command not found, the installed create-nextrush build does not include the published bin file. Use the latest version from the registry once a fixed release is available, or scaffold from a local clone of this repository.

The CLI walks you through project name, style, middleware preset, and runtime target.

Non-Interactive

Pass flags to skip the prompts:

pnpm create nextrush my-api --style functional --middleware api --runtime node

Options

create-nextrush flags

PropertyTypeDescription
--style, -s"functional" | "class-based" | "full"= "functional"Project style
--middleware, -m"minimal" | "api" | "full"= "api"Middleware preset
--runtime, -r"node" | "bun" | "deno"= "node"Runtime target
--gitboolean= trueInitialize git repository
--no-gitbooleanSkip git initialization
--install, -iboolean= trueInstall dependencies
--no-installbooleanSkip dependency installation
--pm"pnpm" | "npm" | "yarn" | "bun"= auto-detectedPackage manager
-y, --yesboolean= falseAccept all defaults (non-interactive)

Project Styles

functional (default)

Lightweight, function-based routing. Typical for HTTP APIs and small services.

my-api/
├── src/
│   ├── index.ts
│   └── routes/
│       └── health.ts
├── package.json
├── tsconfig.json
└── .gitignore
src/index.ts
import { createApp, createRouter, listen } from 'nextrush';

const app = createApp();
const router = createRouter();
const PORT = resolvePort();

router.get('/', (ctx) => ctx.json({ message: 'Welcome to NextRush!' }));

app.route('/', router);
await listen(app, PORT);

The generated src/index.ts includes resolvePort(), which reads PORT and falls back to 3000.

class-based

Decorator-driven controllers with dependency injection. Typical when you want controllers and DI from day one.

my-api/
├── src/
│   ├── index.ts
│   ├── controllers/
│   │   └── health.controller.ts
│   └── services/
│       └── app.service.ts
├── package.json
├── tsconfig.json
└── .gitignore

The scaffold splits services and controllers into separate files (see src/index.ts for controllersPlugin and route wiring).

src/services/app.service.ts
import { Service } from 'nextrush/class';

@Service()
export class AppService {
  getHealth() {
    return { status: 'ok', timestamp: new Date().toISOString() };
  }
}
src/controllers/health.controller.ts
import { Controller, Get } from 'nextrush/class';
import { AppService } from '../services/app.service.js';

@Controller('/health')
export class HealthController {
  constructor(private readonly appService: AppService) {}

  @Get()
  check() {
    return this.appService.getHealth();
  }
}

full

Both functional routes and class-based controllers with custom error-handling middleware. Use when you want the scaffold to include both styles and shared error middleware.

my-api/
├── src/
│   ├── index.ts
│   ├── routes/
│   │   └── health.ts
│   ├── controllers/
│   │   └── hello.controller.ts
│   ├── services/
│   │   └── hello.service.ts
│   └── middleware/
│       ├── error-handler.ts
│       └── not-found.ts
├── package.json
├── tsconfig.json
└── .gitignore

Middleware Presets

PresetIncluded packages
minimalNone — core only
api@nextrush/cors, @nextrush/body-parser, @nextrush/helmet
fullapi preset plus @nextrush/rate-limit, @nextrush/compression, @nextrush/request-id

After Scaffolding

cd my-api

# Start development server (hot reload)
pnpm dev

# Build for production
pnpm build

# Run production build
pnpm start

Code Generators

Once your project is set up, use npx nextrush generate to scaffold controllers, services, middleware, guards, and routes. See the generators guide.

What's Next?

On this page