All packages/generator-t-generator
Scaffolding

generator-t-generator

Yeoman generators for React, Next.js, NestJS, and Node.js stacks with documented base structures and installable features.

Version 0.4.66 min read1 entrypoint

Quick install

npm install -g yo generator-t-generator

Generate a stack starter

Install the generator globally, then use either the interactive router or the direct stack commands for React, Next.js, NestJS, and Node.js.

Overview

What It Covers

Generate one of four stack-specific base projects, then extend it with supported add-on features for UI, auth, data, GraphQL, queues, caching, PWA support, or LLM tooling.

Supported stacks

| Stack | Base scaffold | Installable features |

| --- | --- | --- |

| React | React, TypeScript, Vite, React Router, Vitest, Feature-Sliced Design structure | bff, tailwind, ui-library, auth, redux, react-query, apollo, pwa |

| Next.js | App Router, TypeScript, Jest, Feature-Sliced Design structure | tailwind, ui-library, auth, redux, react-query, apollo, pwa |

| NestJS | Nest 11, Fastify, Prisma, Swagger, JWT auth | graphql, queue, cache, llm |

| Node.js | Express, Prisma, JWT auth, clean or mvp architecture | graphql, queue, cache, llm |

Core behavior

  • Base generators create a new normalized directory and fail if it already exists and is not empty.
  • Add-feature generators must run from the root of a compatible generated project.
  • Generators write files only and do not install dependencies or initialize Git.
  • Installed features are tracked in package.json under tGenerator.features.

Setup

Install And Run

Install globally for the standard Yeoman flow:

npm install -g yo generator-t-generator
yo t-generator

Run without a global install:

npx -p yo -p generator-t-generator yo t-generator

Use direct stack commands when you want to skip the interactive router:

yo t-generator:react-app my-app
yo t-generator:nextjs-app my-next-app
yo t-generator:nestjs-app my-server
yo t-generator:nodejs-app my-node-server

Use feature generators from the root of an existing generated project:

yo t-generator:react-add
yo t-generator:nextjs-add
yo t-generator:nestjs-add
yo t-generator:nodejs-add

Frontend

React And Next.js Stacks

React base structure

src/
  app/
    entrypoint/
    providers/
    routes/
    styles/
  pages/
    home/
      ui/
      index.ts
  widgets/
  features/
  entities/
  shared/
    api/
    config/
    lib/
    ui/
  test/
main.tsx

React base includes

  • React + TypeScript via Vite.
  • React Router wiring, @ path alias, ESLint, Prettier, Vitest, and Testing Library.
  • .env.example, env helper, provider composition entry point, and Feature-Sliced Design starter structure.

React installable features

  • bff: adds a top-level server/ package for API proxying and frontend serving.
  • tailwind: adds Tailwind CSS v4 through @tailwindcss/vite and shared styles from @batoanng/tailwind-config.
  • ui-library: adds MUI theme wiring and integrates @batoanng/mui-components.
  • auth: adds Auth0 React SDK wiring and an /auth example page.
  • redux: adds Redux Toolkit, redux-persist, typed hooks, and a /redux example page.
  • react-query: adds TanStack Query, Axios helpers, and a /react-query example page.
  • apollo: adds Apollo Client wiring and an /apollo example page.
  • pwa: adds vite-plugin-pwa, install/update state handling, and a /pwa example page.
yo t-generator:react-add bff
yo t-generator:react-add tailwind
yo t-generator:react-add ui-library
yo t-generator:react-add auth
yo t-generator:react-add redux
yo t-generator:react-add react-query
yo t-generator:react-add apollo
yo t-generator:react-add pwa

Next.js base structure

src/
  app/
    layout.tsx
    page.tsx
    providers/
  pages/
    home/
      ui/
      index.ts
  widgets/
  features/
  entities/
  shared/
    api/
    config/
    lib/
    ui/

Next.js base includes

  • Next.js App Router with TypeScript via @batoanng/tsconfig/nextjs.json.
  • @ path alias, ESLint, Prettier, Jest, Testing Library, .env.example, env helper, and provider composition entry point.
  • Feature-Sliced Design starter structure with optional add-ons layered in later.

Next.js installable features

  • tailwind: adds Tailwind CSS v4 through @tailwindcss/postcss and shared styles from @batoanng/tailwind-config.
  • ui-library: adds MUI theme wiring and integrates @batoanng/mui-components.
  • auth: adds Auth0 route handlers, middleware, env wiring, and an /auth example page.
  • redux: adds Redux Toolkit, redux-persist, typed hooks, and a /redux example page.
  • react-query: adds TanStack Query, Axios helpers, and a /react-query example page.
  • apollo: adds Apollo Client wiring and an /apollo example page.
  • pwa: adds app/manifest.ts, public/sw.js, registration client wiring, and a /pwa example page.

bff is intentionally not available for Next.js because App Router and route handlers already provide the server-side integration layer.

yo t-generator:nextjs-add tailwind
yo t-generator:nextjs-add ui-library
yo t-generator:nextjs-add auth
yo t-generator:nextjs-add redux
yo t-generator:nextjs-add react-query
yo t-generator:nextjs-add apollo
yo t-generator:nextjs-add pwa

Backend

NestJS And Node.js Stacks

NestJS base structure

src/
  modules/
    app.module.ts
    auth/
    common/
      controller/
      flow/
      provider/
      security/
    tokens.ts
  test/
  types/
server.ts
prisma/
  schema.prisma

NestJS base includes

  • Nest 11 with Fastify, Swagger at /docs, versioned API prefix, and Prisma configured for MongoDB.
  • Health endpoint protected by HEALTH_TOKEN plus local access/refresh JWT auth with login, refresh, logout, and me.
  • Typed config provider and Vitest starter tests.

NestJS installable features

  • graphql: adds Apollo code-first GraphQL at /api/graphql with demo resolver scaffolding.
  • queue: adds BullMQ infrastructure, shared Redis env, and a demo queue endpoint.
  • cache: adds Redis-backed cache infrastructure and a demo cache module.
  • llm: adds OpenAI client wiring and a demo prompt-chain endpoint.
yo t-generator:nestjs-add graphql
yo t-generator:nestjs-add queue
yo t-generator:nestjs-add cache
yo t-generator:nestjs-add llm

Node.js shared base structure

src/
  config/
  infrastructure/
    prisma/
  shared/
    auth/
  app.ts
  server.ts
tests/
prisma/
  schema.prisma

Node.js architecture options

Clean Architecture:

src/
  domain/
  usecases/
  interfaces/
    controllers/
    routes/
  infrastructure/
    prisma/
    repositories/

MVP:

src/
  modules/
    auth/
    health/
  infrastructure/
    prisma/

Node.js base includes

  • Express + Prisma with a prompt to choose clean or mvp.
  • Prisma configured for MySQL, GET /health, /api/auth/*, shared env parsing with zod, JWT auth, logging, security middleware, and graceful shutdown.
  • Jest + Supertest starter coverage.

Node.js installable features

  • graphql: adds a GraphQL endpoint at /api/graphql.
  • queue: adds BullMQ plus Redis-backed demo queue infrastructure.
  • cache: adds Redis-backed demo cache endpoints.
  • llm: adds OpenAI client wiring and a demo REST endpoint.
yo t-generator:nodejs-add graphql
yo t-generator:nodejs-add queue
yo t-generator:nodejs-add cache
yo t-generator:nodejs-add llm

Workflow

Local Development And Release Workflow

Local development

pnpm install
pnpm run type-check
pnpm run lint
pnpm test
pnpm run build
pnpm run test:dist

Link the built package locally:

pnpm run link:dev

If yo is not installed yet:

npm install -g yo

If you already linked an older local build:

npm unlink -g generator-t-generator
pnpm run link:dev

Manual package validation from packages/t-generator:

PACKAGE_TGZ=\"$(npm pack)\"
npm install -g yo \"./$PACKAGE_TGZ\"

Release workflow

Create a changeset from the repository root:

pnpm changeset

Apply pending changesets from the repository root:

pnpm version-packages

Publish from packages/t-generator:

pnpm run release

GitHub Actions can publish automatically from main when a Changesets release PR is merged and NPM_TOKEN is configured in repository secrets.

Source docs

Reference

The full README is rendered below so the package guide stays detailed and traceable to the source docs that live with the package itself.

t-generator is a Yeoman generator package for bootstrapping four stacks:

  • React + TypeScript + Vite
  • Next.js App Router
  • NestJS + Fastify + Prisma
  • Node.js + Express + Prisma

It supports two workflows:

  • create a new base project
  • add supported features to an existing generated project

The long-term direction lives in SPECS.md.

Install and run

Global install:

npm install -g yo generator-t-generator
yo t-generator

Without a global install:

npx -p yo -p generator-t-generator yo t-generator

Direct stack commands:

yo t-generator:react-app my-app
yo t-generator:nextjs-app my-next-app
yo t-generator:nestjs-app my-server
yo t-generator:nodejs-app my-node-server

Add features from an existing generated project root:

yo t-generator:react-add
yo t-generator:nextjs-add
yo t-generator:nestjs-add
yo t-generator:nodejs-add

Stack overview

StackBase scaffoldInstallable features
ReactReact, TypeScript, Vite, React Router, Vitest, FSD structurebff, tailwind, ui-library, auth, redux, react-query, apollo, pwa
Next.jsApp Router, TypeScript, Jest, FSD structuretailwind, ui-library, auth, redux, react-query, apollo, pwa
NestJSNest 11, Fastify, Prisma, Swagger, JWT authgraphql, queue, cache, llm
Node.jsExpress, Prisma, JWT auth, clean or mvp architecturegraphql, queue, cache, llm

React stack

Base command:

yo t-generator:react-app [appName]

Base structure

src/
  app/
    entrypoint/
    providers/
    routes/
    styles/
  pages/
    home/
      ui/
      index.ts
  widgets/
  features/
  entities/
  shared/
    api/
    config/
    lib/
    ui/
  test/
main.tsx

Base includes

  • React + TypeScript via Vite
  • React Router wiring
  • @ path alias to src
  • ESLint and Prettier
  • Vitest + Testing Library
  • .env.example and env helper
  • provider composition entry point
  • Feature-Sliced Design starter structure

Installable React features

  • bff: adds a top-level server/ package for API proxying and frontend serving
  • tailwind: adds Tailwind CSS v4 through @tailwindcss/vite and shared styles from @batoanng/tailwind-config
  • ui-library: adds MUI theme wiring and integrates @batoanng/mui-components
  • auth: adds Auth0 React SDK wiring and an /auth example page
  • redux: adds Redux Toolkit, redux-persist, typed hooks, and a /redux example page
  • react-query: adds TanStack Query, Axios helpers, and a /react-query example page
  • apollo: adds Apollo Client wiring and an /apollo example page
  • pwa: adds vite-plugin-pwa, install/update state handling, and a /pwa example page

Feature commands:

yo t-generator:react-add bff
yo t-generator:react-add tailwind
yo t-generator:react-add ui-library
yo t-generator:react-add auth
yo t-generator:react-add redux
yo t-generator:react-add react-query
yo t-generator:react-add apollo
yo t-generator:react-add pwa

Next.js stack

Base command:

yo t-generator:nextjs-app [appName]

Base structure

src/
  app/
    layout.tsx
    page.tsx
    providers/
  pages/
    home/
      ui/
      index.ts
  widgets/
  features/
  entities/
  shared/
    api/
    config/
    lib/
    ui/

Base includes

  • Next.js App Router
  • TypeScript via @batoanng/tsconfig/nextjs.json
  • @ path alias to src
  • ESLint and Prettier
  • Jest + Testing Library
  • .env.example and env helper
  • provider composition entry point
  • Feature-Sliced Design starter structure

Installable Next.js features

  • tailwind: adds Tailwind CSS v4 through @tailwindcss/postcss and shared styles from @batoanng/tailwind-config
  • ui-library: adds MUI theme wiring and integrates @batoanng/mui-components
  • auth: adds Auth0 route handlers, middleware, env wiring, and an /auth example page
  • redux: adds Redux Toolkit, redux-persist, typed hooks, and a /redux example page
  • react-query: adds TanStack Query, Axios helpers, and a /react-query example page
  • apollo: adds Apollo Client wiring and an /apollo example page
  • pwa: adds app/manifest.ts, public/sw.js, registration client wiring, and a /pwa example page

bff is intentionally not available for Next.js because App Router and route handlers already provide the server-side integration layer.

Feature commands:

yo t-generator:nextjs-add tailwind
yo t-generator:nextjs-add ui-library
yo t-generator:nextjs-add auth
yo t-generator:nextjs-add redux
yo t-generator:nextjs-add react-query
yo t-generator:nextjs-add apollo
yo t-generator:nextjs-add pwa

NestJS stack

Base command:

yo t-generator:nestjs-app [appName]

Base structure

src/
  modules/
    app.module.ts
    auth/
    common/
      controller/
      flow/
      provider/
      security/
    tokens.ts
  test/
  types/
server.ts
prisma/
  schema.prisma

Base includes

  • Nest 11 with Fastify
  • Swagger at /docs
  • versioned API prefix
  • Prisma configured for MongoDB
  • health endpoint protected by HEALTH_TOKEN
  • local access/refresh JWT auth with login, refresh, logout, and me
  • typed config provider
  • Vitest starter tests

Installable NestJS features

  • graphql: adds Apollo code-first GraphQL at /api/graphql with demo resolver scaffolding
  • queue: adds BullMQ infrastructure, shared Redis env, and a demo queue endpoint
  • cache: adds Redis-backed cache infrastructure and a demo cache module
  • llm: adds OpenAI client wiring and a demo prompt-chain endpoint

Feature commands:

yo t-generator:nestjs-add graphql
yo t-generator:nestjs-add queue
yo t-generator:nestjs-add cache
yo t-generator:nestjs-add llm

Node.js stack

Base command:

yo t-generator:nodejs-app [appName]

The Node.js generator prompts for one of two architectures:

  • clean
  • mvp

Shared base structure

src/
  config/
  infrastructure/
    prisma/
  shared/
    auth/
  app.ts
  server.ts
tests/
prisma/
  schema.prisma

Clean Architecture structure

src/
  domain/
  usecases/
  interfaces/
    controllers/
    routes/
  infrastructure/
    prisma/
    repositories/

MVP structure

src/
  modules/
    auth/
    health/
  infrastructure/
    prisma/

Base includes

  • Express + Prisma
  • prompt to choose clean or mvp
  • Prisma configured for MySQL
  • GET /health and /api/auth/* endpoints
  • shared env parsing with zod
  • local access/refresh JWT auth
  • logging, security middleware, and graceful shutdown
  • Jest + Supertest starter coverage

Installable Node.js features

  • graphql: adds a GraphQL endpoint at /api/graphql
  • queue: adds BullMQ plus Redis-backed demo queue infrastructure
  • cache: adds Redis-backed demo cache endpoints
  • llm: adds OpenAI client wiring and a demo REST endpoint

Feature commands:

yo t-generator:nodejs-add graphql
yo t-generator:nodejs-add queue
yo t-generator:nodejs-add cache
yo t-generator:nodejs-add llm

Generator behavior

  • base generators create a new normalized directory and fail if it already exists and is not empty
  • add-feature generators must run from the root of a compatible generated project
  • generators write files only; they do not install dependencies or initialize Git
  • installed features are tracked in package.json under tGenerator.features

Typical flow after generation:

cd my-app
npm install
npm run dev

Local development

From packages/t-generator:

pnpm install
pnpm run type-check
pnpm run lint
pnpm test
pnpm run build
pnpm run test:dist

Link the built package locally:

pnpm run link:dev

If yo is not installed yet:

npm install -g yo

If you already linked an older local build:

npm unlink -g generator-t-generator
pnpm run link:dev

Manual package validation from packages/t-generator:

PACKAGE_TGZ="$(npm pack)"
npm install -g yo "./$PACKAGE_TGZ"

Release workflow

This package is published from this README and uses Changesets in the monorepo.

Create a changeset from the repository root:

pnpm changeset

Apply pending changesets from the repository root:

pnpm version-packages

Publish from packages/t-generator:

pnpm run release

GitHub Actions can publish automatically from main when a Changesets release PR is merged and NPM_TOKEN is configured in repository secrets.