Skip to content

CLI options

The create-nestforge CLI scaffolds a project from the command line. You can run it interactively or pass flags to automate the process.

Terminal window
npx create-nestforge@latest

When run without flags, the CLI asks for:

  1. Project name — lowercase letters, numbers, and dashes only.
  2. Variant — Express + REST or GraphQL (Apollo).
  3. OAuth providers — select which providers to include (currently Google).
Flag Description Example
--help Show help message and exit --help
--version Print version and exit --version
--project-name Project name and target directory --project-name my-app
--oauth-providers Comma-separated OAuth providers: google,github --oauth-providers google
--variant Template variant: rest or graphql --variant graphql
--target-dir Override the output directory --target-dir ./output/my-app
--git Initialize a git repository (default) --git
--no-git Skip git initialization --no-git
Terminal window
npx create-nestforge@latest --project-name my-app --variant graphql --oauth-providers google

This creates my-app in the current working directory, copies the base template, and layers the GraphQL overlay on top.

  1. Copies templates/base into the target directory.
  2. If the variant is graphql, copies the GraphQL overlay, overwriting the shared files.
  3. Merges the GraphQL dependencies into package.json.
  4. Sets the package.json name to the project name.
  5. Creates a .env file from .env.example.

The CLI prints the next steps:

Terminal window
cd my-app
pnpm install
cp .env.example .env
pnpm start:dev

Make sure Redis is running before starting the app. The easiest way is to use Docker Compose:

Terminal window
docker compose up redis

The CLI ignores node_modules, dist, .git, coverage, .env, and pnpm-lock.yaml when copying templates. Install dependencies fresh in the generated project.