@@ -55,6 +55,155 @@ npm run build -- --filter create-awesome-node-app
5555./packages/create-awesome-node-app/index.js my-app
5656```
5757
58+ ### More Usage Examples
59+
60+ Below are additional real-world examples leveraging the public templates catalog and local ` file:// ` paths.
61+
62+ #### 1. Use a catalog template by slug (non-interactive)
63+
64+ Create a React + Vite project (slug: ` react-vite-boilerplate ` ):
65+
66+ ``` sh
67+ npx create-awesome-node-app my-react-app -t react-vite-boilerplate
68+ ```
69+
70+ Create a NestJS API (slug: ` nestjs-boilerplate ` ):
71+
72+ ``` sh
73+ npx create-awesome-node-app my-nest-api -t nestjs-boilerplate
74+ ```
75+
76+ Create a Next.js full‑stack app (slug: ` nextjs-starter ` ) with a custom ` srcDir ` override:
77+
78+ ``` sh
79+ npx create-awesome-node-app my-next --template nextjs-starter --srcDir app
80+ ```
81+
82+ #### 2. Add extensions (addons) by slug
83+
84+ React project with Tailwind CSS + Zustand state management (extensions ` tailwind-css ` and ` zustand ` ):
85+
86+ ``` sh
87+ npx create-awesome-node-app my-react-app -t react-vite-boilerplate --addons tailwind-css zustand
88+ ```
89+
90+ NestJS project with Drizzle (PostgreSQL) + OpenAPI docs:
91+
92+ ``` sh
93+ npx create-awesome-node-app my-nest-api -t nestjs-boilerplate --addons drizzle-orm-postgresql openapi
94+ ```
95+
96+ #### 3. Mix template + explicit extension URLs
97+
98+ You can always pass full GitHub URLs (they can include ` /tree/<branch>/<subdir> ` ):
99+
100+ ``` sh
101+ npx create-awesome-node-app my-app \
102+ -t https://github.com/Create-Node-App/cna-templates/tree/main/templates/react-vite-starter \
103+ --addons https://github.com/Create-Node-App/cna-templates/tree/main/extensions/react-query
104+ ```
105+
106+ #### 4. Local development with ` file:// ` URLs (templates & extensions)
107+
108+ When iterating on your own template or extension locally, point the CLI to a folder on disk. This is useful while building new starters before publishing.
109+
110+ Supported forms:
111+
112+ ``` sh
113+ # Basic local template (directory contains a template/ or direct files)
114+ npx create-awesome-node-app local-app \
115+ -t file:///absolute/path/to/my-template
116+
117+ # Local template selecting a subdirectory (instead of putting /tree/<branch>/<subdir>)
118+ npx create-awesome-node-app local-app \
119+ -t " file:///absolute/path/to/monorepo?subdir=templates/react-vite-starter"
120+
121+ # Combine a local template with a local extension
122+ npx create-awesome-node-app local-app \
123+ -t file:///absolute/path/to/my-template \
124+ --addons file:///absolute/path/to/my-extension
125+ ```
126+
127+ Notes for local usage:
128+
129+ - ` file:// ` templates do not perform any git clone; files are read directly from disk.
130+ - Optional query ` ?subdir=relative/path ` lets you target a nested directory inside a local repo.
131+ - You can add ` ?ignorePackage=true ` to ignore a template's ` package.json ` (useful when only copying files).
132+
133+ #### 5. Append additional extensions with ` --extend `
134+
135+ ` --extend ` appends more raw URLs or slugs after initial template + addons resolution (handy for layering):
136+
137+ ``` sh
138+ npx create-awesome-node-app layered-app \
139+ -t react-vite-boilerplate \
140+ --addons tailwind-css \
141+ --extend https://github.com/Create-Node-App/cna-templates/tree/main/extensions/react-hook-form
142+ ```
143+
144+ #### 6. Verbose mode for debugging
145+
146+ Add ` --verbose ` to see template resolution, first discovered file, prepared operations count, and copy/append actions:
147+
148+ ``` sh
149+ npx create-awesome-node-app debug-app -t react-vite-boilerplate --verbose
150+ ```
151+
152+ ### Template Catalog Reference (Excerpt)
153+
154+ Some popular template slugs available right now:
155+
156+ | Slug | Description |
157+ | --------------------------------- | ------------------------------------ |
158+ | ` react-vite-boilerplate ` | React + Vite + TypeScript + Router |
159+ | ` nextjs-starter ` | Production-ready Next.js starter |
160+ | ` nestjs-boilerplate ` | Scalable NestJS backend |
161+ | ` turborepo-boilerplate ` | Monorepo with Turborepo + Changesets |
162+ | ` web-extension-react-boilerplate ` | React WebExtension with Vite |
163+ | ` webdriverio-boilerplate ` | WebdriverIO testing setup |
164+
165+ (Full catalog fetched from: ` https://raw.githubusercontent.com/Create-Node-App/cna-templates/main/templates.json ` .)
166+
167+ ### Extension Slug Examples (React)
168+
169+ | Slug | Purpose |
170+ | ------------------------------------ | ------------------------------------- |
171+ | ` tailwind-css ` | Tailwind CSS utility-first styling |
172+ | ` zustand ` | Lightweight state management |
173+ | ` react-query ` (tanstack-react-query) | Async server state management |
174+ | ` react-i18n ` | Internationalization setup |
175+ | ` shadcn-ui ` | Radix + Tailwind component primitives |
176+ | ` material-ui ` | MUI component library |
177+
178+ You can combine multiple in one command via ` --addons ` .
179+
180+ ### Ignoring ` package.json ` from a template
181+
182+ If you only want the file structure (not the template's ` package.json ` ), append ` ?ignorePackage=true ` :
183+
184+ ``` sh
185+ npx create-awesome-node-app structure-only \
186+ -t " https://github.com/Create-Node-App/cna-templates/tree/main/templates/react-vite-starter?ignorePackage=true"
187+ ```
188+
189+ ### Using a Different Source Directory
190+
191+ Most templates expose a ` srcDir ` custom option. Override it like this:
192+
193+ ``` sh
194+ npx create-awesome-node-app custom-src -t react-vite-boilerplate --srcDir app
195+ ```
196+
197+ ### Import Path Alias
198+
199+ Likewise override the import alias (defaults often ` @/ ` ):
200+
201+ ``` sh
202+ npx create-awesome-node-app custom-alias -t react-vite-boilerplate --projectImportPath " ~/"
203+ ```
204+
205+ ---
206+
58207## 🤝 Contributing
59208
60209- Contributions make the open source community such an amazing place to learn, inspire, and create.
0 commit comments