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 versionRunning 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-portalIf 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:
| Choice | Options |
|---|---|
| Stack | Next.js, Vite + Node, React Native (Expo) |
Next.js stack:
| Choice | Options |
|---|---|
| ORM | Drizzle, Prisma, none |
| Database | PostgreSQL, SQLite, MySQL, none |
| PostgreSQL provider | Neon, Supabase, local/Docker |
| Authentication | Better Auth, Clerk, NextAuth, none |
| Additional modules | tRPC, AI, Stripe, Polar, Inngest, dashboard |
| AI provider | Anthropic, OpenAI, DeepSeek, Google |
| Package manager | pnpm, npm, Yarn, Bun |
| Dependency installation | Install immediately or skip |
Vite + Node stack (see the Express backend guide):
| Choice | Options |
|---|---|
| Layout | API only, monorepo (apps/api + apps/web) |
| Database | MongoDB (Mongoose), SQL Server (mssql) |
| Payments | Stripe, Polar (multi-select, optional) |
| Package manager | pnpm, npm, Yarn, Bun — monorepo layouts always use pnpm |
| Dependency installation | Install immediately or skip |
React Native (Expo) stack (see the Expo guide):
| Choice | Options |
|---|---|
| Layout | Monorepo (apps/mobile + apps/api), app only |
| Backend API URL | app only — EXPO_PUBLIC_API_URL for the external backend |
| Database | monorepo — MongoDB (Mongoose), SQL Server (mssql) |
| Authentication | monorepo — JWT, none |
| Payments | Stripe, Polar (multi-select, optional) |
| Additional modules | monorepo — AI, tRPC, Inngest · app only — Auth, Stripe, Polar, AI chat, tRPC client |
| Package manager | pnpm, npm, Yarn, Bun — monorepo layouts always use pnpm |
| Dependency installation | Install 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 stripeThe command:
- Reads the existing Nextron configuration.
- Validates the requested module against the modules already installed.
- Resolves required modules automatically and shows everything that will be added before asking for confirmation.
- Preserves existing files — conflicting destinations are skipped with a warning.
- Adds the module dependencies to
package.jsonand updatesnextron.config.ts. - Offers to install new packages with the package manager recorded in the config (falling back to lockfile detection).
- Prints any environment variables the new module needs.
Supported module names
| Name | Capability |
|---|---|
database | Drizzle or Prisma database layer |
auth | Better Auth, Clerk, or NextAuth integration |
trpc | End-to-end type-safe API |
ai | AI SDK chat foundation |
stripe | Payments and webhook handling |
polar | Merchant of Record payments, checkout, portal, and webhooks |
inngest | Background jobs and workflows |
dashboard | Protected dashboard routes and starter UI |
Modules for the Vite + Node (Express) and React Native (Expo) stacks:
| Name | Capability |
|---|---|
express-database | MongoDB (Mongoose) or SQL Server (mssql) database layer (backend only) |
express-auth | JWT register/login backend + Expo sign-in/up screens and secure-store session |
express-ai | Streaming /api/ai/chat endpoint + an Expo chat screen |
express-trpc | tRPC v11 router over Express + a typed Expo client |
express-inngest | Inngest background jobs and workflows (backend only) |
stripe-express | Stripe checkout and webhooks + a native Expo PaymentSheet screen |
polar-express | Polar 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
dashboardrequiresauth. Adding it to a project withauth: "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
*-expressmodules cannot be added to a Next.js project. In a monorepo (Vite + Node or Expo), runnextron addfromapps/api.
Environment variables
Each module declares its variables; create writes them all to .env.example and add prints the new ones:
| Module | Variables |
|---|---|
database | DATABASE_URL |
auth (Better Auth) | BETTER_AUTH_SECRET, BETTER_AUTH_URL |
auth (Clerk) | CLERK_SECRET_KEY, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
auth (NextAuth) | AUTH_SECRET |
ai | AI_PROVIDER + the matching provider key |
stripe | STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY |
polar | POLAR_ACCESS_TOKEN, POLAR_WEBHOOK_SECRET, optional POLAR_SERVER, POLAR_SUCCESS_URL |
inngest | INNGEST_EVENT_KEY, INNGEST_SIGNING_KEY |
express-database (MongoDB) | MONGODB_URI |
express-database (SQL Server) | SQLSERVER_SERVER, SQLSERVER_DATABASE, SQLSERVER_USER, SQLSERVER_PASSWORD |
stripe-express | STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET |
polar-express | POLAR_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.
React Native (Expo)
The Expo stack — a React Native app on Expo SDK 56 with Expo Router and NativeWind, standalone or in a monorepo with the same modular Express backend, plus mobile screens for auth, payments, AI, and tRPC.
Module catalog
Add only the infrastructure and product foundations your application needs.