@odvi/create-dtt-framework 0.1.3 → 0.1.5

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 (111) hide show
  1. package/dist/commands/create.d.ts.map +1 -1
  2. package/dist/commands/create.js +16 -13
  3. package/dist/commands/create.js.map +1 -1
  4. package/package.json +3 -2
  5. package/template/.env.example +103 -0
  6. package/template/components.json +22 -0
  7. package/template/docs/framework/01-overview.md +289 -0
  8. package/template/docs/framework/02-techstack.md +503 -0
  9. package/template/docs/framework/api-layer.md +681 -0
  10. package/template/docs/framework/clerk-authentication.md +649 -0
  11. package/template/docs/framework/cli-installation.md +564 -0
  12. package/template/docs/framework/deployment/ci-cd.md +907 -0
  13. package/template/docs/framework/deployment/digitalocean.md +991 -0
  14. package/template/docs/framework/deployment/domain-setup.md +972 -0
  15. package/template/docs/framework/deployment/environment-variables.md +863 -0
  16. package/template/docs/framework/deployment/monitoring.md +927 -0
  17. package/template/docs/framework/deployment/production-checklist.md +649 -0
  18. package/template/docs/framework/deployment/vercel.md +791 -0
  19. package/template/docs/framework/environment-variables.md +658 -0
  20. package/template/docs/framework/health-check-system.md +582 -0
  21. package/template/docs/framework/implementation.md +559 -0
  22. package/template/docs/framework/snowflake-integration.md +591 -0
  23. package/template/docs/framework/state-management.md +615 -0
  24. package/template/docs/framework/supabase-integration.md +581 -0
  25. package/template/docs/framework/testing-guide.md +544 -0
  26. package/template/docs/framework/what-did-i-miss.md +526 -0
  27. package/template/drizzle.config.ts +12 -0
  28. package/template/next.config.js +21 -0
  29. package/template/postcss.config.js +5 -0
  30. package/template/prettier.config.js +4 -0
  31. package/template/public/favicon.ico +0 -0
  32. package/template/src/app/(auth)/layout.tsx +4 -0
  33. package/template/src/app/(auth)/sign-in/[[...sign-in]]/page.tsx +10 -0
  34. package/template/src/app/(auth)/sign-up/[[...sign-up]]/page.tsx +10 -0
  35. package/template/src/app/(dashboard)/dashboard/page.tsx +8 -0
  36. package/template/src/app/(dashboard)/health/page.tsx +16 -0
  37. package/template/src/app/(dashboard)/layout.tsx +17 -0
  38. package/template/src/app/api/[[...route]]/route.ts +11 -0
  39. package/template/src/app/api/debug-files/route.ts +33 -0
  40. package/template/src/app/api/webhooks/clerk/route.ts +112 -0
  41. package/template/src/app/layout.tsx +28 -0
  42. package/template/src/app/page.tsx +12 -0
  43. package/template/src/app/providers.tsx +20 -0
  44. package/template/src/components/layouts/navbar.tsx +14 -0
  45. package/template/src/components/shared/loading-spinner.tsx +6 -0
  46. package/template/src/components/ui/badge.tsx +46 -0
  47. package/template/src/components/ui/button.tsx +62 -0
  48. package/template/src/components/ui/card.tsx +92 -0
  49. package/template/src/components/ui/collapsible.tsx +33 -0
  50. package/template/src/components/ui/scroll-area.tsx +58 -0
  51. package/template/src/components/ui/sheet.tsx +139 -0
  52. package/template/src/config/__tests__/env.test.ts +166 -0
  53. package/template/src/config/__tests__/site.test.ts +46 -0
  54. package/template/src/config/env.ts +36 -0
  55. package/template/src/config/site.ts +10 -0
  56. package/template/src/env.js +44 -0
  57. package/template/src/features/__tests__/health-check-config.test.ts +142 -0
  58. package/template/src/features/__tests__/health-check-types.test.ts +201 -0
  59. package/template/src/features/documentation/components/doc-sidebar.tsx +109 -0
  60. package/template/src/features/documentation/components/doc-viewer.tsx +70 -0
  61. package/template/src/features/documentation/index.tsx +92 -0
  62. package/template/src/features/documentation/utils/doc-loader.ts +177 -0
  63. package/template/src/features/health-check/components/health-dashboard.tsx +363 -0
  64. package/template/src/features/health-check/config.ts +72 -0
  65. package/template/src/features/health-check/index.ts +4 -0
  66. package/template/src/features/health-check/stores/health-store.ts +14 -0
  67. package/template/src/features/health-check/types.ts +18 -0
  68. package/template/src/hooks/__tests__/use-debounce.test.tsx +28 -0
  69. package/template/src/hooks/queries/use-health-checks.ts +16 -0
  70. package/template/src/hooks/utils/use-debounce.ts +20 -0
  71. package/template/src/lib/__tests__/utils.test.ts +52 -0
  72. package/template/src/lib/__tests__/validators.test.ts +114 -0
  73. package/template/src/lib/nextbank/client.ts +37 -0
  74. package/template/src/lib/snowflake/client.ts +53 -0
  75. package/template/src/lib/supabase/admin.ts +7 -0
  76. package/template/src/lib/supabase/client.ts +7 -0
  77. package/template/src/lib/supabase/server.ts +23 -0
  78. package/template/src/lib/utils.ts +6 -0
  79. package/template/src/lib/validators.ts +9 -0
  80. package/template/src/middleware.ts +22 -0
  81. package/template/src/server/api/index.ts +22 -0
  82. package/template/src/server/api/middleware/auth.ts +19 -0
  83. package/template/src/server/api/middleware/logger.ts +4 -0
  84. package/template/src/server/api/routes/health/clerk.ts +214 -0
  85. package/template/src/server/api/routes/health/database.ts +117 -0
  86. package/template/src/server/api/routes/health/edge-functions.ts +75 -0
  87. package/template/src/server/api/routes/health/framework.ts +45 -0
  88. package/template/src/server/api/routes/health/index.ts +102 -0
  89. package/template/src/server/api/routes/health/nextbank.ts +67 -0
  90. package/template/src/server/api/routes/health/snowflake.ts +83 -0
  91. package/template/src/server/api/routes/health/storage.ts +163 -0
  92. package/template/src/server/api/routes/users.ts +95 -0
  93. package/template/src/server/db/index.ts +17 -0
  94. package/template/src/server/db/queries/users.ts +8 -0
  95. package/template/src/server/db/schema/__tests__/health-checks.test.ts +31 -0
  96. package/template/src/server/db/schema/__tests__/users.test.ts +46 -0
  97. package/template/src/server/db/schema/health-checks.ts +11 -0
  98. package/template/src/server/db/schema/index.ts +2 -0
  99. package/template/src/server/db/schema/users.ts +16 -0
  100. package/template/src/server/db/schema.ts +26 -0
  101. package/template/src/stores/__tests__/ui-store.test.ts +87 -0
  102. package/template/src/stores/ui-store.ts +14 -0
  103. package/template/src/styles/globals.css +129 -0
  104. package/template/src/test/mocks/clerk.ts +35 -0
  105. package/template/src/test/mocks/snowflake.ts +28 -0
  106. package/template/src/test/mocks/supabase.ts +37 -0
  107. package/template/src/test/setup.ts +69 -0
  108. package/template/src/test/utils/test-helpers.ts +158 -0
  109. package/template/src/types/index.ts +14 -0
  110. package/template/tsconfig.json +43 -0
  111. package/template/vitest.config.ts +44 -0
@@ -0,0 +1,564 @@
1
+ # DTT Framework - CLI Installation
2
+
3
+ ## Overview
4
+
5
+ The DTT Framework can be quickly scaffolded using the CLI command. This guide covers installation, updating, and available commands.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ### Prerequisites
12
+
13
+ Before installing, ensure you have:
14
+
15
+ - **Node.js**: Version 18 or higher
16
+ - **pnpm**: Version 10 or higher (recommended package manager)
17
+ - **Git**: For version control
18
+
19
+ ### Install via CLI
20
+
21
+ The framework can be installed using:
22
+
23
+ ```bash
24
+ pnpm create dtt-framework@latest my-app
25
+ ```
26
+
27
+ Replace `my-app` with your desired project name.
28
+
29
+ ### Installation Options
30
+
31
+ The CLI supports various options:
32
+
33
+ ```bash
34
+ pnpm create dtt-framework@latest my-app --template default --use-npm
35
+ ```
36
+
37
+ **Available Options:**
38
+
39
+ | Option | Description | Default |
40
+ |---------|-------------|----------|
41
+ | `-t, --template <template>` | Template to use (default, minimal, full) | `default` |
42
+ | `--use-npm` | Use npm instead of pnpm | `false` |
43
+ | `--use-yarn` | Use yarn instead of pnpm | `false` |
44
+ | `--no-git` | Skip git initialization | `false` |
45
+ | `--no-install` | Skip dependency installation | `false` |
46
+
47
+ ### Interactive Installation
48
+
49
+ For an interactive installation experience:
50
+
51
+ ```bash
52
+ pnpm create dtt-framework@latest
53
+ ```
54
+
55
+ This will prompt you for each option:
56
+
57
+ ```
58
+ ? What is your project name? my-app
59
+ ? Which package manager would you like to use? pnpm
60
+ ? Which template would you like to use? Default - Full framework with all features
61
+ ```
62
+
63
+ ### Templates
64
+
65
+ The CLI provides three templates:
66
+
67
+ 1. **Default** - Full framework with all features (recommended)
68
+ - Clerk authentication
69
+ - Supabase integration
70
+ - Snowflake integration
71
+ - Health check system
72
+ - All UI components
73
+
74
+ 2. **Minimal** - Core framework only
75
+ - Basic Next.js setup
76
+ - Tailwind CSS
77
+ - Core utilities
78
+ - No external integrations
79
+
80
+ 3. **Full** - With additional integrations
81
+ - All default features
82
+ - Extended component library
83
+ - Advanced configurations
84
+
85
+ ---
86
+
87
+ ## Post-Installation Steps
88
+
89
+ ### 1. Navigate to Project Directory
90
+
91
+ ```bash
92
+ cd my-app
93
+ ```
94
+
95
+ ### 2. Install Dependencies (if skipped during installation)
96
+
97
+ ```bash
98
+ pnpm install
99
+ # or
100
+ npm install
101
+ # or
102
+ yarn install
103
+ ```
104
+
105
+ ### 3. Configure Environment Variables
106
+
107
+ Copy the example environment file:
108
+
109
+ ```bash
110
+ cp .env.example .env
111
+ ```
112
+
113
+ Edit `.env` with your credentials:
114
+
115
+ ```bash
116
+ # Clerk
117
+ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxx
118
+ CLERK_SECRET_KEY=sk_test_xxx
119
+ CLERK_WEBHOOK_SECRET=whsec_xxx
120
+
121
+ # Supabase
122
+ NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
123
+ NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJxxx
124
+ SUPABASE_SERVICE_ROLE_KEY=eyJxxx
125
+ DATABASE_URL=postgresql://postgres.[ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres
126
+
127
+ # Snowflake (optional)
128
+ SNOWFLAKE_ACCOUNT=xxx.us-east-1
129
+ SNOWFLAKE_USERNAME=xxx
130
+ SNOWFLAKE_PASSWORD=xxx
131
+ SNOWFLAKE_WAREHOUSE=COMPUTE_WH
132
+ SNOWFLAKE_DATABASE=ANALYTICS
133
+ SNOWFLAKE_SCHEMA=PUBLIC
134
+ SNOWFLAKE_ROLE=ANALYST
135
+ ```
136
+
137
+ See [Environment Variables](./environment-variables.md) for complete reference.
138
+
139
+ ### 4. Set Up Database
140
+
141
+ Generate and push database schema:
142
+
143
+ ```bash
144
+ pnpm db:generate
145
+ pnpm db:push
146
+ ```
147
+
148
+ ### 5. Start Development Server
149
+
150
+ ```bash
151
+ pnpm dev
152
+ ```
153
+
154
+ The application will be available at `http://localhost:3000`
155
+
156
+ ### 6. Verify Health Checks
157
+
158
+ Navigate to the health check dashboard:
159
+
160
+ ```
161
+ http://localhost:3000/health
162
+ ```
163
+
164
+ This will verify all services are properly configured.
165
+
166
+ ---
167
+
168
+ ## CLI Commands Reference
169
+
170
+ ### Development Commands
171
+
172
+ | Command | Description |
173
+ |----------|-------------|
174
+ | `pnpm dev` | Start development server with hot reload |
175
+ | `pnpm build` | Build for production |
176
+ | `pnpm start` | Start production server |
177
+ | `pnpm preview` | Preview production build |
178
+
179
+ ### Database Commands
180
+
181
+ | Command | Description |
182
+ |----------|-------------|
183
+ | `pnpm db:generate` | Generate migration files from schema |
184
+ | `pnpm db:migrate` | Run pending migrations |
185
+ | `pnpm db:push` | Push schema directly to database (dev only) |
186
+ | `pnpm db:studio` | Open Drizzle Studio for database management |
187
+
188
+ ### Code Quality Commands
189
+
190
+ | Command | Description |
191
+ |----------|-------------|
192
+ | `pnpm lint` | Run ESLint |
193
+ | `pnpm lint:fix` | Fix ESLint issues automatically |
194
+ | `pnpm format:check` | Check code formatting with Prettier |
195
+ | `pnpm format:write` | Format code with Prettier |
196
+ | `pnpm check` | Run type check and lint |
197
+ | `pnpm typecheck` | Run TypeScript type check only |
198
+
199
+ ### Test Commands
200
+
201
+ | Command | Description |
202
+ |----------|-------------|
203
+ | `pnpm test` | Run tests once |
204
+ | `pnpm test:watch` | Run tests in watch mode |
205
+ | `pnpm test:ui` | Run tests with UI |
206
+ | `pnpm test:coverage` | Run tests with coverage report |
207
+
208
+ ---
209
+
210
+ ## Updating the Framework
211
+
212
+ ### Check for Updates
213
+
214
+ To check if a new version is available:
215
+
216
+ ```bash
217
+ pnpm outdated dtt-framework
218
+ ```
219
+
220
+ ### Update to Latest Version
221
+
222
+ To update to the latest version:
223
+
224
+ ```bash
225
+ pnpm update dtt-framework@latest
226
+ ```
227
+
228
+ ### Using the Update Command
229
+
230
+ The framework includes an update command that simplifies the process:
231
+
232
+ ```bash
233
+ npx dtt-framework update
234
+ ```
235
+
236
+ **Update Options:**
237
+
238
+ | Option | Description |
239
+ |--------|-------------|
240
+ | `--check-only` | Only check for updates without installing |
241
+ | `--force` | Force update even if already on latest version |
242
+
243
+ ### Update Process
244
+
245
+ When you run the update command:
246
+
247
+ 1. It checks your current version
248
+ 2. It queries npm for the latest version
249
+ 3. If a new version is available, it updates the package
250
+ 4. It displays the version change
251
+ 5. It provides a link to the changelog
252
+
253
+ ### Manual Update
254
+
255
+ For manual updates, you can:
256
+
257
+ 1. Check the [GitHub repository](https://github.com/your-org/dtt-framework) for the latest version
258
+ 2. Update the version in `package.json`:
259
+ ```json
260
+ {
261
+ "name": "my-app",
262
+ "version": "0.1.0",
263
+ "dependencies": {
264
+ "dtt-framework": "0.2.0"
265
+ }
266
+ }
267
+ ```
268
+ 3. Run `pnpm install` to install the updated version
269
+
270
+ ### Migration Guide
271
+
272
+ When updating to a new major version, check for breaking changes:
273
+
274
+ 1. Read the release notes
275
+ 2. Check for migration guides
276
+ 3. Update configuration files as needed
277
+ 4. Update dependencies
278
+ 5. Run tests to verify compatibility
279
+
280
+ ---
281
+
282
+ ## Troubleshooting
283
+
284
+ ### Installation Issues
285
+
286
+ **Issue: "pnpm: command not found"**
287
+
288
+ **Solution:** Install pnpm globally:
289
+
290
+ ```bash
291
+ npm install -g pnpm
292
+ ```
293
+
294
+ **Issue: "Node version not supported"**
295
+
296
+ **Solution:** Update Node.js to version 18 or higher:
297
+
298
+ ```bash
299
+ # Using nvm (recommended)
300
+ nvm install 18
301
+ nvm use 18
302
+
303
+ # Or download from nodejs.org
304
+ ```
305
+
306
+ **Issue: "Permission denied"**
307
+
308
+ **Solution:** Check file permissions:
309
+
310
+ ```bash
311
+ # On Unix-based systems
312
+ chmod +x node_modules/.bin/*
313
+ ```
314
+
315
+ **Issue: "Template not found"**
316
+
317
+ **Solution:** Ensure you're using the latest version of the CLI:
318
+
319
+ ```bash
320
+ pnpm create dtt-framework@latest my-app
321
+ ```
322
+
323
+ ### Post-Installation Issues
324
+
325
+ **Issue: "Environment variable not found"**
326
+
327
+ **Solution:** Ensure `.env` file exists and is configured:
328
+
329
+ ```bash
330
+ # Check if .env exists
331
+ ls -la .env
332
+
333
+ # Copy from example if missing
334
+ cp .env.example .env
335
+
336
+ # Verify .env is in .gitignore
337
+ cat .gitignore
338
+ ```
339
+
340
+ **Issue: "Database connection failed"**
341
+
342
+ **Solution:** Verify database URL is correct:
343
+
344
+ ```bash
345
+ # Test database connection
346
+ psql $DATABASE_URL
347
+
348
+ # Or check Supabase dashboard for connection details
349
+ ```
350
+
351
+ **Issue: "Port 3000 already in use"**
352
+
353
+ **Solution:** Use a different port:
354
+
355
+ ```bash
356
+ # Set PORT environment variable
357
+ PORT=3001 pnpm dev
358
+
359
+ # Or kill the process using port 3000
360
+ # On Unix
361
+ lsof -ti:3000 | xargs kill -9
362
+
363
+ # On Windows
364
+ netstat -ano | findstr :3000
365
+ taskkill /PID <PID> /F
366
+ ```
367
+
368
+ **Issue: "Update failed"**
369
+
370
+ **Solution:** Try updating manually:
371
+
372
+ ```bash
373
+ # Remove lock file
374
+ rm pnpm-lock.yaml
375
+
376
+ # Update dependencies
377
+ pnpm install
378
+
379
+ # Update framework
380
+ pnpm update dtt-framework@latest
381
+ ```
382
+
383
+ ---
384
+
385
+ ## Project Structure After Installation
386
+
387
+ After installation, your project will have this structure:
388
+
389
+ ```
390
+ my-app/
391
+ ├── docs/
392
+ │ └── framework/ # Framework documentation
393
+ ├── public/ # Static assets
394
+ ├── src/
395
+ │ ├── app/ # Next.js App Router
396
+ │ ├── components/ # React components
397
+ │ ├── features/ # Feature modules
398
+ │ ├── hooks/ # React hooks
399
+ │ ├── lib/ # Utilities and clients
400
+ │ ├── server/ # Server-side code
401
+ │ ├── stores/ # Zustand stores
402
+ │ ├── types/ # TypeScript types
403
+ │ └── config/ # Configuration files
404
+ ├── .env.example # Environment variables template
405
+ ├── .gitignore # Git ignore rules
406
+ ├── drizzle.config.ts # Drizzle ORM config
407
+ ├── next.config.js # Next.js config
408
+ ├── package.json # Dependencies
409
+ ├── pnpm-lock.yaml # Lock file
410
+ ├── tsconfig.json # TypeScript config
411
+ └── README.md # Project documentation
412
+ ```
413
+
414
+ ---
415
+
416
+ ## Publishing to npm
417
+
418
+ ### Prerequisites
419
+
420
+ Before publishing, ensure you have:
421
+
422
+ 1. An npm account (create one at [npmjs.com](https://www.npmjs.com))
423
+ 2. Logged in to npm: `npm login`
424
+
425
+ ### Build the CLI
426
+
427
+ ```bash
428
+ pnpm build:cli
429
+ ```
430
+
431
+ ### Publish the Package
432
+
433
+ ```bash
434
+ npm publish
435
+ ```
436
+
437
+ ### Publish the CLI Package
438
+
439
+ The CLI package (`create-dtt-framework`) should be published separately:
440
+
441
+ ```bash
442
+ cd cli
443
+ npm publish
444
+ ```
445
+
446
+ ### Verify Publication
447
+
448
+ After publishing, verify the package is available:
449
+
450
+ ```bash
451
+ npm view dtt-framework
452
+ npm view create-dtt-framework
453
+ ```
454
+
455
+ ### Test Installation
456
+
457
+ Test the CLI installation:
458
+
459
+ ```bash
460
+ pnpm create dtt-framework@latest test-app
461
+ ```
462
+
463
+ ---
464
+
465
+ ## Getting Help
466
+
467
+ ### Documentation
468
+
469
+ - [Overview](./01-overview.md) - Framework introduction
470
+ - [Tech Stack](./02-techstack.md) - Technology breakdown
471
+ - [Environment Variables](./environment-variables.md) - Configuration guide
472
+
473
+ ### Community
474
+
475
+ - **GitHub Issues**: Report bugs and request features
476
+ - **Discord**: Join the community for support
477
+ - **Discussions**: Ask questions and share knowledge
478
+
479
+ ### Support
480
+
481
+ For enterprise support, contact the maintainers directly.
482
+
483
+ ---
484
+
485
+ ## Best Practices
486
+
487
+ ### 1. Version Control
488
+
489
+ Always initialize Git after installation:
490
+
491
+ ```bash
492
+ git init
493
+ git add .
494
+ git commit -m "Initial commit from DTT Framework"
495
+ ```
496
+
497
+ ### 2. Environment Management
498
+
499
+ Use different environment files for different environments:
500
+
501
+ ```bash
502
+ # Development
503
+ .env.development
504
+
505
+ # Staging
506
+ .env.staging
507
+
508
+ # Production
509
+ .env.production
510
+ ```
511
+
512
+ ### 3. Dependency Management
513
+
514
+ Keep dependencies up to date:
515
+
516
+ ```bash
517
+ # Check for outdated packages
518
+ pnpm outdated
519
+
520
+ # Update all packages
521
+ pnpm update
522
+
523
+ # Update specific package
524
+ pnpm update package-name
525
+ ```
526
+
527
+ ### 4. Code Quality
528
+
529
+ Run quality checks before committing:
530
+
531
+ ```bash
532
+ # Run type check
533
+ pnpm typecheck
534
+
535
+ # Run lint
536
+ pnpm lint
537
+
538
+ # Fix lint issues
539
+ pnpm lint:fix
540
+
541
+ # Format code
542
+ pnpm format:write
543
+ ```
544
+
545
+ ### 5. Testing
546
+
547
+ Always run tests before deploying:
548
+
549
+ ```bash
550
+ # Run all tests
551
+ pnpm test
552
+
553
+ # Run tests with coverage
554
+ pnpm test:coverage
555
+ ```
556
+
557
+ ---
558
+
559
+ ## Related Documentation
560
+
561
+ - [Overview](./01-overview.md) - Framework introduction
562
+ - [Environment Variables](./environment-variables.md) - Configuration guide
563
+ - [Implementation](./implementation.md) - How framework was built
564
+ - [Health Check System](./health-check-system.md) - Health monitoring guide