generator-t-generator
v0.5.3
Published
Yeoman generators for bootstrapping React apps, Next.js apps, NestJS servers, and Node.js servers.
Maintainers
Readme
t-generator
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-generatorWithout a global install:
npx -p yo -p generator-t-generator yo t-generatorDirect 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-serverAdd 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-addStack overview
| Stack | Base scaffold | Installable features |
| --- | --- | --- |
| React | React, TypeScript, Vite, React Router, Vitest, FSD structure | bff, tailwind, ui-library, auth, redux, react-query, apollo, pwa |
| Next.js | App Router, TypeScript, Jest, FSD 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 |
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.tsxBase includes
- React + TypeScript via Vite
- React Router wiring
@path alias tosrc- ESLint and Prettier
- Vitest + Testing Library
.env.exampleand env helper- provider composition entry point
- Feature-Sliced Design starter structure
Installable React features
bff: adds a top-levelserver/package for API proxying and frontend servingtailwind: adds Tailwind CSS v4 through@tailwindcss/viteand shared styles from@batoanng/tailwind-configui-library: adds MUI theme wiring and integrates@batoanng/mui-componentsauth: adds Auth0 React SDK wiring and an/authexample pageredux: adds Redux Toolkit,redux-persist, typed hooks, and a/reduxexample pagereact-query: adds TanStack Query, Axios helpers, and a/react-queryexample pageapollo: adds Apollo Client wiring and an/apolloexample pagepwa: addsvite-plugin-pwa, install/update state handling, and a/pwaexample 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 pwaNext.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 tosrc- ESLint and Prettier
- Jest + Testing Library
.env.exampleand env helper- provider composition entry point
- Feature-Sliced Design starter structure
Installable Next.js features
tailwind: adds Tailwind CSS v4 through@tailwindcss/postcssand shared styles from@batoanng/tailwind-configui-library: adds MUI theme wiring and integrates@batoanng/mui-componentsauth: adds Auth0 route handlers, middleware, env wiring, and an/authexample pageredux: adds Redux Toolkit,redux-persist, typed hooks, and a/reduxexample pagereact-query: adds TanStack Query, Axios helpers, and a/react-queryexample pageapollo: adds Apollo Client wiring and an/apolloexample pagepwa: addsapp/manifest.ts,public/sw.js, registration client wiring, and a/pwaexample 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 pwaNestJS 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.prismaBase 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, andme - typed config provider
- Vitest starter tests
Installable NestJS features
graphql: adds Apollo code-first GraphQL at/api/graphqlwith demo resolver scaffoldingqueue: adds BullMQ infrastructure, shared Redis env, and a demo queue endpointcache: adds Redis-backed cache infrastructure and a demo cache modulellm: 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 llmNode.js stack
Base command:
yo t-generator:nodejs-app [appName]The Node.js generator prompts for one of two architectures:
cleanmvp
Shared base structure
src/
config/
infrastructure/
prisma/
shared/
auth/
app.ts
server.ts
tests/
prisma/
schema.prismaClean 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
cleanormvp - Prisma configured for MySQL
GET /healthand/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/graphqlqueue: adds BullMQ plus Redis-backed demo queue infrastructurecache: adds Redis-backed demo cache endpointsllm: 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 llmGenerator 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.jsonundertGenerator.features
Typical flow after generation:
cd my-app
npm install
npm run devLocal development
From packages/t-generator:
pnpm install
pnpm run type-check
pnpm run lint
pnpm test
pnpm run build
pnpm run test:distLink the built package locally:
pnpm run link:devIf yo is not installed yet:
npm install -g yoIf you already linked an older local build:
npm unlink -g generator-t-generator
pnpm run link:devManual 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 changesetApply pending changesets from the repository root:
pnpm version-packagesPublish from packages/t-generator:
pnpm run releaseGitHub Actions can publish automatically from main when a Changesets release PR is merged and NPM_TOKEN is configured in repository secrets.
