create app
Any flag left off a command below is asked for interactively — press Enter to accept the shown default, or pass the flag to skip the question entirely.
nexler create app
nexler create app <name> [flags…]
Scaffolds a new app with the standard handlers/services/store/models layout. Scaffolding is always fully self-contained — no network access, no git required, every template ships embedded inside the binary. The one exception: if -db selects a driver, the generated app's first go build needs one go mod tidy (network access, on your machine, not Nexler's) to fetch the driver package.
| Flag | Default | Description |
|---|---|---|
| -dir | "." | Output directory (a subfolder named after the app is created inside it). |
| -module | app name | Go module path for the generated app. |
| -ui | false | Serve the homepage from editable templates/html/home/{home,layout}.html on disk via response.HTML, instead of the built-in embedded homepage. |
| -auth | none | What middleware.RequireAuth enforces: none (unverified stub), jwt (bearer token, stdlib HMAC-SHA256), session (in-memory cookie store), or both. |
| -remember-me | false | Only with -auth session|both — adds a rememberMe option to auth.StartSession swapping the default 24h lifetime for 30 days. |
| -jwt-secret | "" | Reuse an existing JWT signing secret instead of generating one — set when multiple apps must validate each other's tokens. Blank generates a fresh, unique secret. |
| -db | "" | Comma-separated driver support to generate in db/: mongo, mysql, postgres, mssql (any subset). Only opening/closing connections — no ORM, query builder, or migrations. |
| -core | auto | Which -db type is the app's conventional default ("core") connection. Required only when -db selects more than one type; defaults to mongo if selected, else the first type listed. |
| -db-host | "" | Core connection host. Blank leaves .env's DSN blank for you to fill in by hand; every flag below is only consulted when this is set. |
| -db-port | conventional port | Defaults to 3306/5432/1433/27017 for mysql/postgres/mssql/mongo when -db-host is set. |
| -db-name | "" | Core database name. |
| -db-user | "" | Core database username (blank = no auth). |
| -db-password | "" | Core database password (blank = no auth). Passed/prompted in plain text — there's no masked-input prompt in this CLI. |
| -merge-service-auth | false | Only with -auth jwt|both and -db — folds X-Api-Secret service-key auth into middleware.RequireAuth itself (as a fallback after JWT/session) instead of generating a separate middleware.RequireServiceAuth, so a service/automation caller can hit the exact same -protected routes a human user would. See "Authentication" below for the tradeoff against the default separate-middleware design. |
| -multitenant | false | Only with -auth jwt|session|both — errors otherwise. Threads a tenant Org through auth.ContextWithOrg/Org, StartSession/SessionFromRequest's org parameter (when -auth includes session), and core.User.OrgId (when a core database connection and a JWT-capable -auth choice are both present). See "Authentication" below. |
-ui, -auth, -db, and the DB-detail flags are each independent — an app can mix any combination, e.g. a session-authenticated UI app with a Postgres core connection.
nexler create app test -ui nexler create app test -auth jwt nexler create app test -auth both -remember-me nexler create app test -db postgres,mongo -core mongo nexler create app test -db mongo -db-host localhost -db-name test nexler create app test -auth both -db mongo -merge-service-auth nexler create app test -auth session -multitenant