Skip to main content

ness generate

ness generate, or its g alias, creates framework-aware modules using the project language. Projects with tsconfig.json receive .ts and .tsx; other projects receive .js and .jsx.

ness generate <type> <name> [options]
ness g <type> <name> [options]

Names are relative paths, so nested application structure can be generated directly:

ness g page dashboard/settings
ness g service billing/invoices
ness g component account/avatar

Options​

  • --dry-run prints the destination without writing a file.
  • --force intentionally replaces an existing destination.

Generation rejects . and .. path segments and refuses to overwrite existing files by default.

React route schematics​

SchematicAliasOutput
pagepapp/routes/<name>/page.tsx
layoutlapp/routes/<name>/layout.tsx
routerapp/routes/<name>/route.ts
loadingapp/routes/<name>/loading.tsx
errorapp/routes/<name>/error.tsx
not-foundapp/routes/<name>/not-found.tsx
forbiddenapp/routes/<name>/forbidden.tsx
unauthorizedapp/routes/<name>/unauthorized.tsx

route creates a low-level React Router resource module. Public application APIs should use a Nest controller.

NestJS backend schematics​

SchematicAliasesOutput
controllercoapp/server/<name>/<name>.controller.ts
resourceresapp/server/<name>/<name>.controller.ts
services, providerapp/server/<name>/<name>.service.ts
modulemoapp/server/<name>/<name>.module.ts
guardguapp/server/<name>/<name>.guard.ts

controller creates starter GET and POST endpoints. resource creates CRUD endpoints for collection and :id routes. Generated controllers, providers, guards, and modules are registered in the root AppModule automatically.

Nest backend schematics always use TypeScript so decorators and dependency-injection metadata are explicit, even when the React application uses JavaScript.

UI and server schematics​

SchematicAliasesOutput
componentcapp/components/<name>.tsx
hookhapp/hooks/<name>.ts
contextctxapp/context/<name>.context.tsx
actionaapp/actions/<name>.server.ts
middlewaremiapp/middleware/<name>.ts
modelmapp/models/<name>.server.ts

General schematics​

SchematicAliasOutput
classclapp/lib/<name>.ts
interfaceiapp/types/<name>.ts
enumeapp/types/<name>.ts
testspectest/<name>.test.ts

JavaScript interface and enum schematics use JSDoc and frozen objects so the commands remain useful without TypeScript.