NNextron Docs

CLI reference

Commands, prompts, flags, and behavior of the Nextron CLI.

Requirements

  • Node.js 20 or newer.
  • One of pnpm, npm, Yarn, or Bun for installing the generated project's dependencies.

Commands

nextron [command]

Commands:
  create [name]   Create a new Nextron application
  add <module>    Add a module to an existing Nextron application

Global flags:
  --help          Show usage for the CLI or a subcommand
  --version       Print the installed CLI version

Running nextron without a subcommand starts the same interactive generator as nextron create.

Create a project

nextron create [name]

Creates a new directory, copies the base template for the selected stack, applies selected modules, generates environment and agent-context files, and optionally installs dependencies.

npx @edwinfom/nextron@latest create customer-portal

If no name is supplied, the CLI asks for one. Project names may contain lowercase letters, numbers, hyphens, and underscores.

Prompts

The first prompt selects the stack:

ChoiceOptions
StackNext.js, Vite + Node, React Native (Expo)

Next.js stack:

ChoiceOptions
ORMDrizzle, Prisma, none
DatabasePostgreSQL, SQLite, MySQL, none
PostgreSQL providerNeon, Supabase, local/Docker
AuthenticationBetter Auth, Clerk, NextAuth, none
Additional modulestRPC, AI, Stripe, Polar, Inngest, dashboard
AI providerAnthropic, OpenAI, DeepSeek, Google
Package managerpnpm, npm, Yarn, Bun
Dependency installationInstall immediately or skip

Vite + Node stack (see the Express backend guide):

ChoiceOptions
LayoutAPI only, monorepo (apps/api + apps/web)
DatabaseMongoDB (Mongoose), SQL Server (mssql)
PaymentsStripe, Polar (multi-select, optional)
Package managerpnpm, npm, Yarn, Bun — monorepo layouts always use pnpm
Dependency installationInstall immediately or skip

React Native (Expo) stack (see the Expo guide):

ChoiceOptions
LayoutMonorepo (apps/mobile + apps/api), app only
Backend API URLapp only — EXPO_PUBLIC_API_URL for the external backend
Databasemonorepo — MongoDB (Mongoose), SQL Server (mssql)
Authenticationmonorepo — JWT, none
PaymentsStripe, Polar (multi-select, optional)
Additional modulesmonorepo — AI, tRPC, Inngest · app only — Auth, Stripe, Polar, AI chat, tRPC client
Package managerpnpm, npm, Yarn, Bun — monorepo layouts always use pnpm
Dependency installationInstall immediately or skip
  • The dashboard option only appears when authentication is enabled.
  • The AI provider prompt only appears when the AI module is selected.
  • The PostgreSQL provider decides which database client is generated (the Neon serverless driver versus node-postgres).
  • The package manager is auto-detected from how the CLI was invoked and which tools exist on your machine; the detected option is preselected.
  • Cancelling any prompt (Ctrl+C) exits cleanly — no files are written until every prompt is answered.

Installation behavior

With pnpm and npm, dependency installation runs with --prefer-offline, reusing your local store or cache when possible. Install output is captured quietly; on failure, the captured error is shown and the generated files remain in place for a manual install.

Rollback

If generation fails and Nextron created the target directory, it removes that incomplete directory. Directories that existed before the command started are never deleted by rollback.

Add a module

Run this command from a generated project containing nextron.config.ts:

nextron add <module>

Example:

npx @edwinfom/nextron@latest add stripe

The command:

  1. Reads the existing Nextron configuration.
  2. Validates the requested module against the modules already installed.
  3. Resolves required modules automatically and shows everything that will be added before asking for confirmation.
  4. Preserves existing files — conflicting destinations are skipped with a warning.
  5. Adds the module dependencies to package.json and updates nextron.config.ts.
  6. Offers to install new packages with the package manager recorded in the config (falling back to lockfile detection).
  7. Prints any environment variables the new module needs.

Supported module names

NameCapability
databaseDrizzle or Prisma database layer
authBetter Auth, Clerk, or NextAuth integration
trpcEnd-to-end type-safe API
aiAI SDK chat foundation
stripePayments and webhook handling
polarMerchant of Record payments, checkout, portal, and webhooks
inngestBackground jobs and workflows
dashboardProtected dashboard routes and starter UI

Modules for the Vite + Node (Express) and React Native (Expo) stacks:

NameCapability
express-databaseMongoDB (Mongoose) or SQL Server (mssql) database layer (backend only)
express-authJWT register/login backend + Expo sign-in/up screens and secure-store session
express-aiStreaming /api/ai/chat endpoint + an Expo chat screen
express-trpctRPC v11 router over Express + a typed Expo client
express-inngestInngest background jobs and workflows (backend only)
stripe-expressStripe checkout and webhooks + a native Expo PaymentSheet screen
polar-expressPolar checkout, portal, and webhooks + an Expo hosted-checkout screen

On the Expo stack, each module's backend files target apps/api and its mobile screens target apps/mobile (or the project root for app-only projects).

Compatibility rules

  • dashboard requires auth. Adding it to a project with auth: "none" fails before files are written.
  • Better Auth and NextAuth require a database module.
  • Required modules are resolved automatically and confirmed in one step.
  • Incompatibility checks cover the entire resolved set, including modules pulled in as requirements — not just the module you named.
  • Modules are stack-aware: Next.js modules cannot be added to a Vite + Node or Expo project, and *-express modules cannot be added to a Next.js project. In a monorepo (Vite + Node or Expo), run nextron add from apps/api.

Environment variables

Each module declares its variables; create writes them all to .env.example and add prints the new ones:

ModuleVariables
databaseDATABASE_URL
auth (Better Auth)BETTER_AUTH_SECRET, BETTER_AUTH_URL
auth (Clerk)CLERK_SECRET_KEY, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
auth (NextAuth)AUTH_SECRET
aiAI_PROVIDER + the matching provider key
stripeSTRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
polarPOLAR_ACCESS_TOKEN, POLAR_WEBHOOK_SECRET, optional POLAR_SERVER, POLAR_SUCCESS_URL
inngestINNGEST_EVENT_KEY, INNGEST_SIGNING_KEY
express-database (MongoDB)MONGODB_URI
express-database (SQL Server)SQLSERVER_SERVER, SQLSERVER_DATABASE, SQLSERVER_USER, SQLSERVER_PASSWORD
stripe-expressSTRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET
polar-expressPOLAR_ACCESS_TOKEN, POLAR_WEBHOOK_SECRET, optional POLAR_SERVER, POLAR_SUCCESS_URL
Expo app (mobile)EXPO_PUBLIC_API_URL, and EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY with the Stripe module

All variables are validated at boot through the generated src/env.ts (Next.js), src/config/env.ts (Express), or src/shared/env.ts (Expo — only EXPO_PUBLIC_* variables reach the app bundle).

Versioning

The CLI follows semantic versioning: patch releases never change the generated project layout or the command interface. See the changelog for release notes.

On this page