@navneet_25/tempjs 1.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +800 -35
  2. package/cli/brand-manager.js +277 -78
  3. package/cli/config.js +22 -1
  4. package/cli/copy.js +4 -18
  5. package/cli/db-setup.js +170 -49
  6. package/cli/doctor.js +393 -0
  7. package/cli/fetch-core-modules.js +130 -0
  8. package/cli/fetch.js +47 -29
  9. package/cli/file-tree.js +113 -0
  10. package/cli/fs-ignore.js +60 -0
  11. package/cli/index.js +274 -112
  12. package/cli/info.js +115 -0
  13. package/cli/init-options.js +209 -0
  14. package/cli/module-manager.js +168 -0
  15. package/cli/parse-args.js +177 -0
  16. package/cli/progress.js +33 -0
  17. package/cli/project-stamp.js +69 -0
  18. package/cli/prompt.js +19 -0
  19. package/cli/template-resolver.js +48 -0
  20. package/cli/theme-manager.js +28 -2
  21. package/cli/update.js +227 -0
  22. package/cli/version-manager.js +518 -0
  23. package/package.json +31 -4
  24. package/packages/core/modules/README.md +72 -0
  25. package/packages/core/modules/blog-compose/app/admin/components/blog-compose-form.ts +44 -0
  26. package/packages/core/modules/blog-compose/app/admin/hooks/useBlogPosts.ts +103 -0
  27. package/packages/core/modules/blog-compose/app/admin/panels/BlogComposePanel.tsx +388 -0
  28. package/packages/core/modules/blog-compose/app/api/blog-posts/[id]/route.ts +29 -0
  29. package/packages/core/modules/blog-compose/app/api/blog-posts/route.ts +21 -0
  30. package/packages/core/modules/blog-compose/app/blog/[slug]/page.tsx +79 -0
  31. package/packages/core/modules/blog-compose/app/blog/layout.tsx +22 -0
  32. package/packages/core/modules/blog-compose/app/blog/page.tsx +102 -0
  33. package/packages/core/modules/blog-compose/app/components/BlogSection.tsx +74 -0
  34. package/packages/core/modules/blog-compose/app/components/BlogShell.tsx +36 -0
  35. package/packages/core/modules/blog-compose/app/components/BlogSidebar.tsx +112 -0
  36. package/packages/core/modules/blog-compose/lib/blog/compose/annotate-text.tsx +103 -0
  37. package/packages/core/modules/blog-compose/lib/blog/compose/blocks/media-blocks.tsx +97 -0
  38. package/packages/core/modules/blog-compose/lib/blog/compose/blocks/text-blocks.tsx +115 -0
  39. package/packages/core/modules/blog-compose/lib/blog/compose/index.ts +21 -0
  40. package/packages/core/modules/blog-compose/lib/blog/compose/interpreter.tsx +55 -0
  41. package/packages/core/modules/blog-compose/lib/blog/compose/registry.ts +276 -0
  42. package/packages/core/modules/blog-compose/lib/blog/compose/types.ts +128 -0
  43. package/packages/core/modules/blog-compose/lib/blog/register-sitemap.ts +18 -0
  44. package/packages/core/modules/blog-compose/lib/controllers/BlogComposeController.ts +2 -0
  45. package/packages/core/modules/blog-compose/lib/features/blog-compose/blog-compose.controller.ts +78 -0
  46. package/packages/core/modules/blog-compose/lib/features/blog-compose/blog-compose.repository.ts +78 -0
  47. package/packages/core/modules/blog-compose/lib/features/blog-compose/blog-compose.service.ts +72 -0
  48. package/packages/core/modules/blog-compose/lib/features/blog-compose/blog-compose.types.ts +20 -0
  49. package/packages/core/modules/blog-compose/lib/features/blog-compose/index.ts +7 -0
  50. package/packages/core/modules/blog-compose/prisma/blog-compose.prisma +13 -0
  51. package/packages/core/modules/enquiry-modal/app/components/EnquiryModal.tsx +308 -0
  52. package/packages/core/modules/footer/app/components/Footer.tsx +127 -0
  53. package/packages/core/modules/gallery/app/admin/components/GalleryFormModal.tsx +132 -0
  54. package/packages/core/modules/gallery/app/admin/components/GalleryList.tsx +142 -0
  55. package/packages/core/modules/gallery/app/admin/hooks/useGallery.ts +72 -0
  56. package/packages/core/modules/gallery/app/api/gallery/[id]/route.ts +29 -0
  57. package/packages/core/modules/gallery/app/api/gallery/route.ts +22 -0
  58. package/packages/core/modules/gallery/app/components/GallerySection.tsx +92 -0
  59. package/packages/core/modules/gallery/app/gallery/layout.tsx +12 -0
  60. package/packages/core/modules/gallery/app/gallery/page.tsx +179 -0
  61. package/packages/core/modules/gallery/lib/controllers/GalleryController.ts +2 -0
  62. package/packages/core/modules/gallery/lib/features/gallery/gallery.controller.ts +78 -0
  63. package/packages/core/modules/gallery/lib/features/gallery/gallery.repository.ts +55 -0
  64. package/packages/core/modules/gallery/lib/features/gallery/gallery.service.ts +43 -0
  65. package/packages/core/modules/gallery/lib/features/gallery/gallery.types.ts +17 -0
  66. package/packages/core/modules/gallery/lib/features/gallery/index.ts +4 -0
  67. package/packages/core/modules/gallery/prisma/gallery.prisma +11 -0
  68. package/packages/core/modules/hero-simple/app/components/Hero.tsx +160 -0
  69. package/packages/core/modules/legal-pages/app/components/LegalDocumentPage.tsx +61 -0
  70. package/packages/core/modules/legal-pages/app/privacy-policy/page.tsx +19 -0
  71. package/packages/core/modules/legal-pages/app/terms-and-conditions/page.tsx +19 -0
  72. package/packages/core/modules/reviews/app/admin/components/ReviewFormModal.tsx +110 -0
  73. package/packages/core/modules/reviews/app/admin/components/ReviewsList.tsx +116 -0
  74. package/packages/core/modules/reviews/app/admin/hooks/useReviews.ts +70 -0
  75. package/packages/core/modules/reviews/app/api/reviews/[id]/route.ts +29 -0
  76. package/packages/core/modules/reviews/app/api/reviews/route.ts +17 -0
  77. package/packages/core/modules/reviews/app/components/ReviewsSection.tsx +100 -0
  78. package/packages/core/modules/reviews/lib/controllers/ReviewController.ts +2 -0
  79. package/packages/core/modules/reviews/lib/features/reviews/index.ts +3 -0
  80. package/packages/core/modules/reviews/lib/features/reviews/review.controller.ts +64 -0
  81. package/packages/core/modules/reviews/lib/features/reviews/review.repository.ts +50 -0
  82. package/packages/core/modules/reviews/lib/features/reviews/review.service.ts +38 -0
  83. package/packages/core/modules/reviews/prisma/reviews.prisma +9 -0
  84. package/packages/core/modules/seo/app/components/SiteJsonLd.tsx +16 -0
  85. package/packages/core/modules/seo/app/robots.ts +30 -0
  86. package/packages/core/modules/seo/app/sitemap.ts +9 -0
  87. package/packages/core/modules/seo/lib/seo/index.ts +5 -0
  88. package/packages/core/modules/seo/lib/seo/json-ld.ts +128 -0
  89. package/packages/core/modules/seo/lib/seo/metadata.ts +65 -0
  90. package/packages/core/modules/seo/lib/seo/sitemap.ts +82 -0
  91. package/packages/core/modules/seo/lib/seo/types.ts +30 -0
  92. package/packages/core/modules/seo/lib/seo/urls.ts +27 -0
  93. package/packages/core/modules/theme-modes/app/components/ThemeModeInit.tsx +24 -0
  94. package/packages/core/modules/theme-modes/app/components/ThemeModeToggle.tsx +58 -0
  95. package/packages/core/modules.json +140 -0
  96. package/packages/core/prisma/schema.prisma +33 -0
  97. package/scripts/module-installer-core.mjs +657 -0
  98. package/scripts/template-modules-admin.mjs +366 -0
  99. package/scripts/template-modules-home.mjs +120 -0
  100. package/templates.json +188 -3
package/README.md CHANGED
@@ -17,6 +17,8 @@ git add .
17
17
  git commit -m "Initial project"
18
18
  ```
19
19
 
20
+ **Documentation site:** [`docsite/`](docsite/) — JSON-driven docs for developers and maintainers. Run `pnpm docs:dev` from repo root.
21
+
20
22
  ## Available templates
21
23
 
22
24
  | ID | Name | Description |
@@ -30,29 +32,521 @@ List templates from the CLI:
30
32
  tempjs list
31
33
  ```
32
34
 
33
- ## CLI usage
35
+ ## CLI reference
36
+
37
+ ### Discover templates
38
+
39
+ #### `tempjs list`
40
+
41
+ Shows every available template with a short summary:
42
+
43
+ ```bash
44
+ tempjs list
45
+ ```
46
+
47
+ Output includes:
48
+
49
+ - Template **id** (what you pass to `tempjs hotel`, etc.)
50
+ - **Name** and **description**
51
+ - **Tags** (e.g. `admin`, `cms`, `gallery`)
52
+ - **Stack** preview (first few technologies)
53
+
54
+ Run `tempjs info <id>` for full details.
55
+
56
+ #### `tempjs info <template-id>`
57
+
58
+ Shows everything a developer needs before choosing a template:
59
+
60
+ ```bash
61
+ tempjs info hotel
62
+ tempjs info real-estate
63
+ ```
64
+
65
+ Displays:
66
+
67
+ | Field | Example |
68
+ |-------|---------|
69
+ | Version | `1.0.0` |
70
+ | Stack | Next.js 16, React 19, Prisma, MariaDB, … |
71
+ | Node.js | `>=20` |
72
+ | Package manager | `pnpm` |
73
+ | Typical setup time | `~10 min` |
74
+ | Docker | Yes / No |
75
+ | Tags | `admin`, `cms`, `gallery` |
76
+ | Features | Bullet list of capabilities |
77
+ | Source path | `templates/hotel-website-template` |
78
+ | Repository | `github.com/SidhartGautam25/templates` |
79
+ | Quick start commands | Copy-paste examples |
80
+ | Docs file | `DEVELOPER_GUIDE.md` (in generated project) |
81
+
82
+ If the template id is wrong:
83
+
84
+ ```text
85
+ Unknown template: xyz
86
+ Run `tempjs list` to see available templates.
87
+ ```
88
+
89
+ ---
90
+
91
+ ### Create a project
92
+
93
+ #### Basic (copy only)
94
+
95
+ ```bash
96
+ mkdir my-client && cd my-client
97
+ tempjs hotel
98
+ ```
99
+
100
+ Copies template files into the **current directory** (not a subfolder). Does not run theme, brand, or database setup.
101
+
102
+ #### Interactive full setup
103
+
104
+ ```bash
105
+ tempjs hotel config
106
+ # or
107
+ tempjs hotel --config
108
+ ```
109
+
110
+ After copying, prompts for:
111
+
112
+ 1. **Theme** (theme1–theme5)
113
+ 2. **Font pairing** (default, inter, lora-montserrat, …)
114
+ 3. **Brand & contact** (name, URL, phone, email, address)
115
+ 4. **Database & admin** (.env + optional `prisma db push`)
116
+
117
+ #### Non-interactive full setup
118
+
119
+ Use `--yes` (or `-y` / `--no-prompt`) to skip every prompt. Values come from flags; anything not provided uses template defaults.
120
+
121
+ ```bash
122
+ mkdir mi-plaza && cd mi-plaza
123
+
124
+ tempjs hotel --config --yes \
125
+ --theme theme2 \
126
+ --name "Mi Plaza" \
127
+ --base-url "https://miplaza.com" \
128
+ --db-host localhost \
129
+ --db-name mi_plaza_db \
130
+ --admin-user admin \
131
+ --admin-password mypass \
132
+ --skip-db-push
133
+ ```
134
+
135
+ #### Partial automation
136
+
137
+ Configure only what you care about; the rest uses defaults:
138
+
139
+ ```bash
140
+ tempjs hotel --config --yes --theme theme3 --name "Mi Plaza"
141
+ ```
142
+
143
+ Then configure the rest later in the same project directory:
144
+
145
+ ```bash
146
+ tempjs init-db --yes --db-host localhost --db-name mi_plaza_db
147
+ tempjs brand --yes --name "Mi Plaza" --email "hello@miplaza.com"
148
+ tempjs theme --theme theme2 --yes
149
+ tempjs font --font inter --yes
150
+ ```
151
+
152
+ #### Fetch progress
153
+
154
+ When downloading a template, tempjs reports size, file count, and duration:
155
+
156
+ ```text
157
+ Fetching template "hotel"... done (4.2 MB, 130 files, 1.8s, download)
158
+ ```
159
+
160
+ From a linked local dev copy (no network):
161
+
162
+ ```text
163
+ Fetching template "hotel"... done (130 files, 0ms, local copy)
164
+ ```
165
+
166
+ ---
167
+
168
+ ### Template versioning (`.tempjs.json`)
169
+
170
+ Every new project is stamped with a `.tempjs.json` file at the root:
171
+
172
+ ```json
173
+ {
174
+ "template": "hotel",
175
+ "templateVersion": "1.2.0",
176
+ "templateDirectory": "hotel-website-template",
177
+ "generatedAt": "2026-08-26T04:52:13.543Z",
178
+ "updatedAt": "2026-08-26T05:10:00.000Z",
179
+ "repository": "SidhartGautam25/templates",
180
+ "branch": "main",
181
+ "fileHashes": {
182
+ "package.json": "abc123…",
183
+ "lib/database/prisma.ts": "def456…"
184
+ }
185
+ }
186
+ ```
187
+
188
+ | Field | Purpose |
189
+ |-------|---------|
190
+ | `template` | CLI id (`hotel`, `real-estate`) |
191
+ | `templateVersion` | Manifest version when last stamped |
192
+ | `generatedAt` | First `tempjs` run in this folder |
193
+ | `updatedAt` | Last successful `tempjs update --merge` |
194
+ | `fileHashes` | SHA-256 of each template file at stamp time (baseline for updates) |
195
+
196
+ **Commit `.tempjs.json`** to your client repo so you know which template version the project started from.
197
+
198
+ Check version in manifest:
199
+
200
+ ```bash
201
+ tempjs list # shows v1.2.0 next to template name
202
+ tempjs info hotel # shows full version in details
203
+ ```
204
+
205
+ When maintainers bump `"version"` in `templates.json` and push, clients can pull fixes safely.
206
+
207
+ **Two version numbers (don’t confuse them):**
208
+
209
+ | Version | Where | Meaning |
210
+ |---------|--------|---------|
211
+ | **CLI** (`@navneet_25/tempjs`) | npm / `package.json` in templates repo | The `tempjs` tool itself |
212
+ | **Template** (`hotel`, `real-estate`) | `templates.json` → your `.tempjs.json` | The website template snapshot |
213
+
214
+ Maintainers: see **[VERSIONING.md](./VERSIONING.md)** for `tempjs version check` / `tempjs version inc`.
215
+
216
+ ---
217
+
218
+ ### Update an existing project (`tempjs update`)
219
+
220
+ Use inside a project that has `.tempjs.json` (created by `tempjs hotel`, etc.).
221
+
222
+ #### Check what changed (read-only)
223
+
224
+ ```bash
225
+ cd mi-plaza
226
+ tempjs update --check
227
+ ```
228
+
229
+ Example output:
230
+
231
+ ```text
232
+ Template update report: Hotel Website
233
+ Project version: 1.1.0
234
+ Latest version: 1.2.0
235
+
236
+ Safe updates (1) — template changed, you did not edit:
237
+ ~ lib/utils/slugify.ts
238
+
239
+ Conflicts (1) — you modified these files:
240
+ ! app/components/Hero.tsx
241
+
242
+ 129 file(s) already match the latest template.
243
+ ```
244
+
245
+ | Report section | Meaning |
246
+ |----------------|---------|
247
+ | **New files** | Added in latest template; not in your project yet |
248
+ | **Safe updates** | Template changed; you did **not** edit since generation → can auto-merge |
249
+ | **Conflicts** | You modified files that also changed in the template → manual review |
250
+ | **Removed from template** | No longer in template; **not deleted** from your project |
251
+
252
+ #### Apply non-conflicting updates
253
+
254
+ ```bash
255
+ tempjs update --merge
256
+ # or without prompt:
257
+ tempjs update --merge --yes
258
+ ```
259
+
260
+ Only **new files** and **safe updates** are copied. Conflicts are listed but never overwritten.
261
+
262
+ **Protected paths** (never touched by merge):
263
+
264
+ - `.env`, `.env.*` (except `.env.example`)
265
+ - `constants/site.ts` (brand/contact)
266
+ - `.tempjsrc`, `app/tempjs-theme.css`
267
+ - `.tempjs.json` (updated after merge with new version + hashes)
268
+
269
+ #### Full workflow example
270
+
271
+ ```bash
272
+ # 1. Create client project (stamped v1.1.0)
273
+ mkdir mi-plaza && cd mi-plaza
274
+ tempjs hotel --config --yes --name "Mi Plaza"
275
+
276
+ # 2. Customize freely
277
+ # edit app/components/Hero.tsx, constants/site.ts, .env …
278
+
279
+ # 3. Later — maintainer published template v1.2.0 with bug fixes in lib/
280
+
281
+ tempjs update --check # see safe updates vs conflicts
282
+ tempjs update --merge --yes # apply only non-conflicting fixes
283
+
284
+ # 4. Manually merge conflicts if any (e.g. Hero.tsx)
285
+ ```
286
+
287
+ Use `--remote` to fetch the latest template from GitHub instead of a local linked copy:
288
+
289
+ ```bash
290
+ tempjs update --check --remote
291
+ tempjs update --merge --remote --yes
292
+ ```
293
+
294
+ ---
295
+
296
+ ### Post-init commands (inside a generated project)
297
+
298
+ Run these from the project root (where `package.json` exists):
299
+
300
+ | Command | Purpose |
301
+ |---------|---------|
302
+ | `tempjs theme` | Change color theme |
303
+ | `tempjs font` | Change font pairing |
304
+ | `tempjs brand` | Update brand name, URL, contact info |
305
+ | `tempjs init-db` | Create/update `.env` and sync Prisma schema |
306
+
307
+ Examples:
308
+
309
+ ```bash
310
+ tempjs theme --theme theme3 --yes
311
+ tempjs brand --yes --name "New Name" --email "new@example.com"
312
+ tempjs init-db --yes --db-host 127.0.0.1 --db-name my_db --db-push
313
+ ```
314
+
315
+ When re-running with `--yes`, unspecified fields keep existing values from `constants/site.ts` or `.env`.
316
+
317
+ ---
318
+
319
+ ### All CLI flags
320
+
321
+ #### General
322
+
323
+ | Flag | Short | Description |
324
+ |------|-------|-------------|
325
+ | `--config` | | Run theme + font + brand + database setup after copy |
326
+ | `--yes` | `-y` | Skip all prompts |
327
+ | `--no-prompt` | | Same as `--yes` |
328
+ | `--force` | `-f` | Overwrite existing files; auto-confirm overwrite warnings |
329
+ | `--remote` | | Fetch from GitHub even if local templates exist |
330
+ | `--init-git` | | Run `git init` after copying |
331
+ | `--help` | `-h` | Show help |
332
+
333
+ #### Theme & typography
334
+
335
+ | Flag | Values | Description |
336
+ |------|--------|-------------|
337
+ | `--theme` | `theme1` … `theme5` | Color theme id |
338
+ | `--font` | See table below | Font pairing id |
339
+
340
+ **Theme ids**
341
+
342
+ | Id | Name |
343
+ |----|------|
344
+ | `theme1` | Slate / Blue (default) |
345
+ | `theme2` | Forest / Green |
346
+ | `theme3` | Purple / Violet |
347
+ | `theme4` | Red / Crimson |
348
+ | `theme5` | Amber / Gold |
349
+
350
+ **Font ids**
351
+
352
+ | Id | Pairing |
353
+ |----|---------|
354
+ | `default` | Playfair Display + Outfit (default) |
355
+ | `inter` | Inter + Inter |
356
+ | `lora-montserrat` | Lora + Montserrat |
357
+ | `merriweather-open-sans` | Merriweather + Open Sans |
358
+ | `cinzel-montserrat` | Cinzel + Montserrat |
359
+
360
+ With `--yes`, if `--theme` / `--font` is omitted, the current or default id is used.
361
+
362
+ #### Brand & contact
363
+
364
+ | Flag | Example | Written to |
365
+ |------|---------|------------|
366
+ | `--name` | `"Mi Plaza"` | `constants/site.ts` → brand name |
367
+ | `--short-name` | `"Mi Plaza"` | Short / display name |
368
+ | `--base-url` | `"https://miplaza.com"` | Site URL (also derives `wwwHost`) |
369
+ | `--phone` | `"9876543210"` | Raw phone number |
370
+ | `--phone-display` | `"+91 98765 43210"` | Formatted display phone |
371
+ | `--country-code` | `"91"` | Phone country code |
372
+ | `--email` | `"info@miplaza.com"` | Contact email |
373
+ | `--address` | `"Pune, Maharashtra, India"` | Full address string |
374
+
375
+ Quotes are optional in the shell when the value has no spaces:
376
+
377
+ ```bash
378
+ --email info@miplaza.com
379
+ --name "Mi Plaza"
380
+ --base-url=https://miplaza.com # --key=value also works
381
+ ```
382
+
383
+ #### Database & admin
384
+
385
+ | Flag | Example | Written to |
386
+ |------|---------|------------|
387
+ | `--db-host` | `localhost` | `.env` → `DATABASE_URL` host |
388
+ | `--db-port` | `3306` | Database port |
389
+ | `--db-user` | `root` | Database username |
390
+ | `--db-password` | `secret` | Database password |
391
+ | `--db-name` | `mi_plaza_db` | Database name |
392
+ | `--admin-user` | `admin` | `.env` → `ADMIN_USER` |
393
+ | `--admin-password` | `mypass` | `.env` → `ADMIN_PASSWORD` |
394
+ | `--db-push` | | With `--yes`, run `npx prisma db push` after writing `.env` |
395
+ | `--skip-db-push` | | With `--yes`, skip `prisma db push` |
396
+
397
+ Default database name (if not set): derived from the folder name, e.g. `mi-plaza` → `mi_plaza_db`.
398
+
399
+ **Prisma / database behavior**
400
+
401
+ | Mode | Behavior |
402
+ |------|----------|
403
+ | Interactive `init-db` | Prompts for DB fields; asks whether to run `prisma db push` |
404
+ | `--yes` without flags | Uses defaults / existing `.env` values; runs `prisma db push` |
405
+ | `--yes --skip-db-push` | Writes `.env` only; no Prisma |
406
+ | `--yes --db-push` | Explicitly runs `prisma db push` |
407
+
408
+ Ensure MySQL/MariaDB is running before `--db-push`.
409
+
410
+ ---
411
+
412
+ ### Manifest metadata (`templates.json`)
413
+
414
+ Each template entry can include metadata used by `tempjs list` and `tempjs info`:
415
+
416
+ ```json
417
+ {
418
+ "repository": {
419
+ "owner": "SidhartGautam25",
420
+ "repo": "templates",
421
+ "branch": "main",
422
+ "templatesPath": "templates"
423
+ },
424
+ "templates": {
425
+ "hotel": {
426
+ "directory": "hotel-website-template",
427
+ "name": "Hotel Website",
428
+ "description": "Modern hotel and resort website with admin panel, gallery, and booking features",
429
+ "version": "1.0.0",
430
+ "stack": ["Next.js 16", "React 19", "TypeScript", "Tailwind CSS 4", "Prisma", "MariaDB", "NextAuth"],
431
+ "packageManager": "pnpm",
432
+ "node": ">=20",
433
+ "setupTime": "~10 min",
434
+ "docker": true,
435
+ "tags": ["admin", "cms", "gallery", "booking", "leads"],
436
+ "features": [
437
+ "Admin dashboard for rooms, facilities, reviews, and leads",
438
+ "Gallery and promo banner management",
439
+ "FTP asset upload pipeline"
440
+ ],
441
+ "docs": "DEVELOPER_GUIDE.md"
442
+ }
443
+ }
444
+ }
445
+ ```
446
+
447
+ | Field | Required | Used by |
448
+ |-------|----------|---------|
449
+ | `directory` | Yes | CLI copy path |
450
+ | `name` | Yes | `list`, `info`, success messages |
451
+ | `description` | Yes | `list`, `info` |
452
+ | `version` | No | `info` |
453
+ | `stack` | No | `list`, `info` |
454
+ | `packageManager` | No | `info` |
455
+ | `node` | No | `info` |
456
+ | `setupTime` | No | `info` |
457
+ | `docker` | No | `info` |
458
+ | `tags` | No | `list`, `info` |
459
+ | `features` | No | `info` |
460
+ | `docs` | No | `info` — filename inside generated project |
461
+
462
+ Adding a new template: add the folder + one manifest entry. No CLI code changes required.
463
+
464
+ ---
465
+
466
+ ### Install & update the CLI
467
+
468
+ ```bash
469
+ # First install
470
+ npm install -g @navneet_25/tempjs
471
+
472
+ # Update to latest (recommended after new templates or CLI features)
473
+ npm install -g @navneet_25/tempjs@latest
474
+ ```
475
+
476
+ Current version: **2.1.0** (doctor, version tracking, copy-once core starter kit, optional sync propagate, update merge).
477
+
478
+ See also: [guide.md](./guide.md) for CLI architecture, [VERSIONING.md](./VERSIONING.md) for release workflow.
479
+
480
+ Verify:
481
+
482
+ ```bash
483
+ tempjs --help
484
+ tempjs list
485
+ ```
486
+
487
+ ## CLI usage (quick reference)
34
488
 
35
489
  ```bash
36
490
  tempjs list # show available templates
37
- tempjs hotel # create project from hotel template using default theme
38
- tempjs hotel config # create project and run full interactive configuration (theme, font, brand, database)
39
- tempjs theme # change/reset the theme of an initialized project
40
- tempjs font # change/reset the font pairing of an initialized project
41
- tempjs brand # configure brand identity & contact info of an initialized project
42
- tempjs init-db # set up .env file and run database schema sync on an initialized project
491
+ tempjs info hotel # detailed template metadata (stack, features, setup)
492
+ tempjs hotel # create project from hotel template
493
+ tempjs hotel config # interactive setup (theme, font, brand, database)
494
+ tempjs hotel --config --yes # non-interactive setup with defaults
495
+ tempjs theme --theme theme3 --yes
496
+ tempjs brand --yes --name "Mi Plaza" --base-url "https://miplaza.com"
497
+ tempjs init-db --yes --db-host localhost --db-name my_db --skip-db-push
43
498
  tempjs real-estate --force # overwrite existing files
499
+ tempjs doctor # readiness check (generated projects)
500
+ tempjs add-module list # optional core modules available
501
+ tempjs add-module seo,gallery,reviews # add modules to existing project
44
502
  tempjs --help # show help
45
503
  ```
46
504
 
47
- ### Options
505
+ ### Optional core modules (client projects)
506
+
507
+ After `tempjs hotel`, add cross-vertical features without re-copying the template:
508
+
509
+ ```bash
510
+ tempjs add-module list
511
+ tempjs add-module seo,gallery,reviews
512
+ pnpm prisma db push && pnpm dev
513
+ ```
514
+
515
+ Modules: `enquiry-modal`, `footer`, `hero-simple`, `seo`, `gallery`, `reviews`, `legal-pages`. See `packages/core/modules.json` and docsite → Developers → Optional modules.
48
516
 
49
- | Option | Description |
50
- |---------------|-------------|
51
- | `--config` | Prompt for full configuration (theme, font, brand, db) during template initialization |
52
- | `--force` | Overwrite files in the current directory without prompting |
53
- | `--remote` | Fetch from GitHub even when a local template copy exists |
54
- | `--init-git` | Run `git init` after copying (optional) |
55
- | `--help` | Show help |
517
+ Shipped **hotel** and **real-estate** templates already include vertical features and adopted core modules where they overlapped bespoke code.
518
+
519
+ ### Maintainer commands (monorepo root)
520
+
521
+ ```bash
522
+ pnpm new-template bakery --name "Bakery" --modules enquiry-modal,footer,hero-simple,seo
523
+ pnpm template:add-module hotel gallery,reviews
524
+ pnpm template:assemble hotel # vertical modules → template root
525
+ pnpm template:extract-modules hotel # template root → modules/
526
+ pnpm sync-templates
527
+ pnpm dev:hotel
528
+ tempjs version check # unreleased CLI/template changes?
529
+ tempjs version inc patch cli
530
+ tempjs version inc minor hotel
531
+ ```
532
+
533
+ See [VERSIONING.md](./VERSIONING.md).
534
+
535
+ ### Options (summary)
536
+
537
+ | Option | Description |
538
+ |--------|-------------|
539
+ | `--config` | Run full setup (theme, font, brand, db) after copying |
540
+ | `--yes`, `-y`, `--no-prompt` | Skip all prompts; use defaults or flag values |
541
+ | `--force`, `-f` | Overwrite files without prompting |
542
+ | `--theme`, `--font` | Theme/font id (see CLI reference above) |
543
+ | `--name`, `--base-url`, `--email`, … | Brand/contact fields (non-interactive) |
544
+ | `--db-host`, `--db-name`, `--admin-user`, … | Database and admin credentials |
545
+ | `--db-push` / `--skip-db-push` | Control `prisma db push` with `--yes` |
546
+ | `--remote` | Fetch from GitHub even when local templates exist |
547
+ | `--init-git` | Run `git init` after copying |
548
+
549
+ See **CLI reference** above for full flag tables, theme/font ids, and examples.
56
550
 
57
551
  The CLI copies template **contents** into the current directory — not a nested folder:
58
552
 
@@ -106,7 +600,9 @@ npm link
106
600
 
107
601
  ## Configuration
108
602
 
109
- All template mappings live in **`templates.json`** at the repository root:
603
+ All template mappings and metadata live in **`templates.json`** at the repository root. See **Manifest metadata (`templates.json`)** in the CLI reference for every field.
604
+
605
+ Minimal example:
110
606
 
111
607
  ```json
112
608
  {
@@ -126,6 +622,8 @@ All template mappings live in **`templates.json`** at the repository root:
126
622
  }
127
623
  ```
128
624
 
625
+ For `tempjs info` and richer `tempjs list`, add `version`, `stack`, `tags`, `features`, etc. (documented above).
626
+
129
627
  ### GitHub repository URL
130
628
 
131
629
  Configure in one place — `templates.json` or environment variables:
@@ -136,7 +634,7 @@ Configure in one place — `templates.json` or environment variables:
136
634
  | `TEMPLATES_REPO_OWNER` | GitHub username or org |
137
635
  | `TEMPLATES_REPO_REPO` | Repository name |
138
636
  | `TEMPLATES_REPO_BRANCH`| Branch (default: `main`) |
139
- | `GITHUB_TOKEN` | Optional token for higher API rate limits |
637
+ | `GITHUB_TOKEN` | Optional private repositories only |
140
638
 
141
639
  Example:
142
640
 
@@ -159,36 +657,303 @@ The archive contains the whole templates repo on the wire, but only the requeste
159
657
 
160
658
  ```
161
659
  templates/ # this repository root
162
- ├── README.md
163
- ├── package.json # CLI package (bin: tempjs)
164
- ├── templates.json # manifest + repo config
165
- ├── .gitignore # for THIS repo only (not copied to projects)
660
+ ├── ARCHITECTURE.md # copy-once core + standalone templates
661
+ ├── MAINTAINERS.md # maintainer handbook
662
+ ├── ROADMAP.md # planned improvements
663
+ ├── packages/
664
+ │ └── core/ # starter kit (copied once via new-template)
665
+ ├── templates/
666
+ │ ├── hotel-website-template/ # full hotel project (what tempjs copies)
667
+ │ └── real-estate-website-template/
668
+ ├── scripts/
669
+ │ ├── new-template.mjs
670
+ │ └── sync-templates.mjs # optional: propagate core fixes
671
+ ├── package.json # CLI package + maintainer scripts
672
+ ├── templates.json
166
673
  ├── cli/
167
- ├── index.js
168
- │ ├── config.js
169
- │ ├── copy.js
170
- │ └── fetch.js
171
- └── templates/
172
- ├── hotel-website-template/
173
- │ ├── .gitignore # copied to generated projects
174
- │ ├── package.json
175
- │ ├── app/
176
- │ └── ...
177
- └── real-estate-website-template/
178
- └── ...
674
+ └── ...
675
+ ```
676
+
677
+ ## Shared core starter kit (copy-once)
678
+
679
+ `packages/core/` is **generic boilerplate** copied once when you run `pnpm new-template`. After that, each template under `templates/<name>/` is a **standalone** Next.js project — edit it directly. Use `pnpm sync-templates` only when you intentionally propagate a fix from core into existing templates.
680
+
681
+ **Full design doc:** [ARCHITECTURE.md](./ARCHITECTURE.md) · **Maintainer guide:** [MAINTAINERS.md](./MAINTAINERS.md)
682
+
683
+ ### Quick maintainer commands
684
+
685
+ ```bash
686
+ # Create a new template (copies core + scaffold once)
687
+ pnpm new-template bakery bakery-website-template --name "Bakery Website"
688
+
689
+ # Daily dev (no sync)
690
+ pnpm dev:hotel
691
+
692
+ # Optional: after fixing packages/core, propagate to existing templates
693
+ pnpm sync-templates
694
+ pnpm sync-templates:check
179
695
  ```
180
696
 
697
+ ### What developers receive
698
+
699
+ A normal Next.js project with organized `lib/`:
700
+
701
+ - `lib/database/` — Prisma client
702
+ - `lib/features/leads/` — shared lead module
703
+ - `lib/storage/` — FTP uploads
704
+ - `lib/features/<domain>/` — template-specific modules (rooms, projects, …)
705
+ - `app/` — routes and UI
706
+
707
+ All source is on disk; no submodule, no `@tempjs/core` npm dependency in client projects.
708
+
709
+ ### Comparison (other approaches)
710
+
711
+ | Approach | User gets full source? | Maintained in this repo |
712
+ |----------|------------------------|-------------------------|
713
+ | **Copy-once core** (current) | Yes | `packages/core` starter + `templates/<name>/` |
714
+ | CLI merge at copy time | Yes | `packages/core` only in git |
715
+ | npm `@tempjs/core` package | Partial (core in node_modules) | Published package |
716
+
717
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for diagrams and adding new templates.
718
+
719
+ ---
720
+
721
+ ## Shared core package — design options (reference)
722
+
723
+ Hotel and real-estate templates share a large amount of code (auth, admin shell, leads, FTP, Prisma patterns). A **shared core** reduces duplicate maintenance, but you must decide how that core reaches the **generated project** when someone runs `tempjs hotel`.
724
+
725
+ Generated projects must remain **standalone** — no submodule, no link to the templates repo, no `npm install` required just to get source files from your monorepo layout.
726
+
727
+ Below are the main approaches and what each means for `tempjs` users.
728
+
729
+ ### The core question
730
+
731
+ | Where core lives (your repo) | What `tempjs hotel` must produce |
732
+ |------------------------------|----------------------------------|
733
+ | `packages/core/` (shared) | `hotel-client/` with **all** code needed to build and deploy |
734
+
735
+ The user never sees `packages/core/` as a separate install step unless you explicitly choose that design.
736
+
737
+ ---
738
+
739
+ ### Option 1: Pre-merge into each template (recommended for tempjs)
740
+
741
+ **How it works**
742
+
743
+ - You maintain shared code in `packages/core/` (or `shared/core/`) inside the templates monorepo.
744
+ - A **build/sync script** copies (or rsyncs) core files into each template before commit:
745
+
746
+ ```bash
747
+ pnpm run sync-templates
748
+ # merges packages/core → templates/hotel-website-template/
749
+ # merges packages/core → templates/real-estate-website-template/
750
+ ```
751
+
752
+ - What is **committed** under `templates/hotel-website-template/` already contains the merged code.
753
+ - `tempjs hotel` only extracts that folder — user gets one flat, complete project.
754
+
755
+ ```
756
+ YOUR REPO (maintenance view) WHAT USER GETS (tempjs hotel)
757
+ ───────────────────────── ─────────────────────────────
758
+ packages/core/ hotel-client/
759
+ lib/auth.ts ──sync──► lib/auth.ts
760
+ lib/leads.ts lib/leads.ts
761
+ templates/hotel-website-template/ app/ (hotel-specific)
762
+ app/ (hotel-specific) package.json
763
+ ```
764
+
765
+ **Pros**
766
+
767
+ - Simplest for CLI — no merge logic in `tempjs`
768
+ - User gets 100% source in their repo; easy to customize
769
+ - No extra npm dependency on `@you/template-core`
770
+ - Works with current tarball fetch
771
+
772
+ **Cons**
773
+
774
+ - Duplicated core **in git** across template folders (larger repo)
775
+ - Must run sync script when core changes (can be a CI check)
776
+
777
+ **Maintenance**
778
+
779
+ 1. Fix bug in `packages/core/`
780
+ 2. Run `pnpm sync-templates`
781
+ 3. Commit updated `templates/hotel-website-template/` and `templates/real-estate-website-template/`
782
+ 4. Push — users fetch updated template on next `tempjs hotel`
783
+
784
+ ---
785
+
786
+ ### Option 2: CLI merges core at copy time
787
+
788
+ **How it works**
789
+
790
+ - Core stays only in `packages/core/` (not duplicated in each template folder).
791
+ - `tempjs` downloads/extracts **two** paths from the tarball:
792
+ 1. `packages/core/`
793
+ 2. `templates/hotel-website-template/`
794
+ - CLI merges them into the user's directory (template files override core on conflict).
795
+
796
+ ```
797
+ tempjs fetch
798
+ ├── extract packages/core/ → temp/core/
799
+ └── extract templates/hotel/ → temp/hotel/
800
+ merge(core, hotel) → user's hotel-client/
801
+ ```
802
+
803
+ **Pros**
804
+
805
+ - Single source of core in git — no duplication in template folders
806
+ - User still gets a flat, standalone project (all files copied locally)
807
+
808
+ **Cons**
809
+
810
+ - More complex CLI (merge rules, conflict handling, ordering)
811
+ - Must define what overrides what (template wins over core)
812
+ - Harder to debug if merge goes wrong
813
+
814
+ **Maintenance**
815
+
816
+ - Edit `packages/core/` only
817
+ - Push — CLI merges on every `tempjs hotel` (no per-template sync commit)
818
+
819
+ ---
820
+
821
+ ### Option 3: Published npm package dependency
822
+
823
+ **How it works**
824
+
825
+ - Publish shared code as `@navneet_25/template-core` on npm.
826
+ - Each template's `package.json` includes:
827
+
828
+ ```json
829
+ "dependencies": {
830
+ "@navneet_25/template-core": "^1.0.0"
831
+ }
832
+ ```
833
+
834
+ - `tempjs hotel` copies only the **thin** template (pages, schema, config).
835
+ - User runs `pnpm install` → core lands in `node_modules/@navneet_25/template-core`.
836
+
837
+ **What the user gets**
838
+
839
+ ```
840
+ hotel-client/
841
+ ├── app/ # from template (hotel-specific)
842
+ ├── package.json # lists @navneet_25/template-core
843
+ └── node_modules/
844
+ └── @navneet_25/template-core/ # shared code HERE, not in src/
845
+ ```
846
+
847
+ **Pros**
848
+
849
+ - Clean separation; one core package versioned independently
850
+ - Template folders stay small in the templates repo
851
+
852
+ **Cons**
853
+
854
+ - **Not ideal for agency white-label work** — clients customize by editing `node_modules` or you need a build step anyway
855
+ - Requires publishing and versioning core on every fix
856
+ - Generated project depends on your npm package forever (or until they eject)
857
+ - `tempjs` only transfers template files; **core is not in the tarball path** unless user runs install
858
+
859
+ **When to use**
860
+
861
+ - Internal products where you control upgrades
862
+ - Not ideal if every client project must be fully forkable and editable as plain source
863
+
864
+ ---
865
+
866
+ ### Option 4: pnpm workspace (dev only) + publish flattened templates
867
+
868
+ **How it works**
869
+
870
+ - Monorepo:
871
+
872
+ ```
873
+ packages/core/
874
+ packages/hotel-app/ # imports from @local/core via workspace
875
+ packages/real-estate-app/
876
+ ```
877
+
878
+ - Dev with `workspace:*` references.
879
+ - **Release pipeline** builds each app and outputs a **flattened** tree into `templates/hotel-website-template/` for the CLI (bundle or copy with a tool like `tsup` / custom script).
880
+
881
+ Same end result as Option 1 for users; workspace only helps local dev.
882
+
883
+ ---
884
+
885
+ ### Comparison
886
+
887
+ | Approach | User gets full source? | Core in git once? | CLI complexity | Client customization |
888
+ |----------|------------------------|-------------------|----------------|----------------------|
889
+ | **1. Pre-merge sync** | Yes | No (duplicated in templates) | Low | Easy |
890
+ | **2. CLI merge** | Yes | Yes | High | Easy |
891
+ | **3. npm package** | Partial (core in node_modules) | Yes | Low | Harder |
892
+ | **4. Workspace + flatten** | Yes | Yes (in packages/) | Medium (build step) | Easy |
893
+
894
+ ---
895
+
896
+ ### Recommendation for your project
897
+
898
+ **Start with Option 1 (pre-merge sync script)** unless the repo size or sync friction becomes painful.
899
+
900
+ Reasons:
901
+
902
+ 1. Matches your current `tempjs` design (single folder extract, flat copy).
903
+ 2. Agencies and clients get **all** code in `app/`, `lib/`, etc. — no hidden package.
904
+ 3. No change to tarball fetch or rate limits.
905
+ 4. You can add a GitHub Action: `on push to packages/core → run sync-templates → fail if templates out of date`.
906
+
907
+ **Sketch of a sync script**
908
+
909
+ ```bash
910
+ # scripts/sync-core-to-templates.sh
911
+ CORE=packages/core
912
+ for tpl in hotel-website-template real-estate-website-template; do
913
+ rsync -a --delete "$CORE/" "templates/$tpl/" \
914
+ --exclude template-specific paths if needed
915
+ done
916
+ ```
917
+
918
+ Hotel-specific files stay only in the hotel template; only truly shared files live in core. Template-specific overrides stay in the template folder and are not overwritten if you rsync with care (e.g. sync only `lib/`, `app/components/admin/`, etc.).
919
+
920
+ **When to move to Option 2**
921
+
922
+ - Many templates (5+) and core duplication in git becomes unwieldy.
923
+ - You want a single `packages/core/` commit without touching every template folder.
924
+
925
+ **Avoid Option 3** if your main users are developers who fork, rename, and heavily customize each client site.
926
+
927
+ ---
928
+
929
+ ### What does *not* work well with tempjs
930
+
931
+ | Pattern | Problem |
932
+ |---------|---------|
933
+ | Git submodule in generated project | User gets submodule reference, not standalone repo |
934
+ | `workspace:*` in published template | Broken after copy — no monorepo parent |
935
+ | Copy only template without core | Incomplete project unless core is npm dependency |
936
+
937
+ The rule: **everything required to `pnpm install && pnpm build` must either be in the copied folder or in declared npm dependencies.**
938
+
181
939
  ## Adding a new template
182
940
 
183
941
  1. Add a directory under `templates/`, e.g. `templates/restaurant-website-template/`.
184
942
  2. Include a template-specific `.gitignore` for that stack (Next.js, Vite, etc.).
185
- 3. Add one entry to `templates.json`:
943
+ 3. Add metadata to `templates.json` (recommended):
186
944
 
187
945
  ```json
188
946
  "restaurant": {
189
947
  "directory": "restaurant-website-template",
190
948
  "name": "Restaurant Website",
191
- "description": "Restaurant website with menu and reservations"
949
+ "description": "Restaurant website with menu and reservations",
950
+ "version": "1.0.0",
951
+ "stack": ["Next.js 16", "React 19", "TypeScript", "Tailwind CSS 4"],
952
+ "packageManager": "pnpm",
953
+ "node": ">=20",
954
+ "tags": ["admin", "menu", "reservations"],
955
+ "features": ["Menu management", "Reservation leads"],
956
+ "docs": "DEVELOPER_GUIDE.md"
192
957
  }
193
958
  ```
194
959