trinity-method-sdk 2.0.9 → 2.2.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 (147) hide show
  1. package/CHANGELOG.md +702 -267
  2. package/README.md +550 -540
  3. package/dist/cli/commands/deploy/agents.js +1 -1
  4. package/dist/cli/commands/deploy/ci-cd.d.ts +4 -3
  5. package/dist/cli/commands/deploy/ci-cd.js +10 -9
  6. package/dist/cli/commands/deploy/claude-setup.js +28 -35
  7. package/dist/cli/commands/deploy/configuration.js +10 -11
  8. package/dist/cli/commands/deploy/directories.js +13 -14
  9. package/dist/cli/commands/deploy/gitignore.js +3 -5
  10. package/dist/cli/commands/deploy/index.d.ts +1 -1
  11. package/dist/cli/commands/deploy/index.js +7 -3
  12. package/dist/cli/commands/deploy/knowledge-base.js +3 -3
  13. package/dist/cli/commands/deploy/pre-flight.js +1 -1
  14. package/dist/cli/commands/deploy/root-files.js +3 -18
  15. package/dist/cli/commands/deploy/sdk-install.js +1 -1
  16. package/dist/cli/commands/deploy/summary.js +3 -3
  17. package/dist/cli/commands/deploy/templates.js +33 -20
  18. package/dist/cli/commands/update/agents.js +1 -1
  19. package/dist/cli/commands/update/backup.js +6 -12
  20. package/dist/cli/commands/update/commands.d.ts +1 -0
  21. package/dist/cli/commands/update/commands.js +18 -45
  22. package/dist/cli/commands/update/knowledge-base.js +2 -2
  23. package/dist/cli/commands/update/pre-flight.js +11 -11
  24. package/dist/cli/commands/update/summary.js +5 -5
  25. package/dist/cli/commands/update/templates.js +35 -13
  26. package/dist/cli/commands/update/verification.js +5 -5
  27. package/dist/cli/commands/update/version.js +1 -1
  28. package/dist/cli/utils/deploy-ci.d.ts +3 -2
  29. package/dist/cli/utils/deploy-ci.js +24 -24
  30. package/dist/cli/utils/deploy-linting.js +101 -6
  31. package/dist/cli/utils/error-classes.d.ts +2 -2
  32. package/dist/cli/utils/linting-tools.js +14 -6
  33. package/dist/cli/utils/template-processor.js +2 -4
  34. package/dist/templates/{claude → .claude}/EMPLOYEE-DIRECTORY.md.template +16 -22
  35. package/dist/templates/{agents → .claude/agents}/aj-team/apo-documentation-specialist.md.template +10 -10
  36. package/dist/templates/{agents → .claude/agents}/aj-team/bas-quality-gate.md.template +13 -15
  37. package/dist/templates/{agents → .claude/agents}/aj-team/bon-dependency-manager.md.template +4 -4
  38. package/dist/templates/{agents → .claude/agents}/aj-team/cap-configuration-specialist.md.template +3 -3
  39. package/dist/templates/{agents → .claude/agents}/aj-team/dra-code-reviewer.md.template +8 -10
  40. package/dist/templates/{agents → .claude/agents}/aj-team/kil-task-executor.md.template +11 -13
  41. package/dist/templates/{agents → .claude/agents}/aj-team/uro-refactoring-specialist.md.template +3 -3
  42. package/dist/templates/{agents → .claude/agents}/audit/juno-auditor.md.template +46 -42
  43. package/dist/templates/{agents → .claude/agents}/deployment/ein-cicd.md.template +59 -164
  44. package/dist/templates/{agents → .claude/agents}/deployment/ino-context.md.template +25 -22
  45. package/dist/templates/{agents → .claude/agents}/deployment/tan-structure.md.template +32 -30
  46. package/dist/templates/{agents → .claude/agents}/deployment/zen-knowledge.md.template +28 -23
  47. package/dist/templates/{agents → .claude/agents}/leadership/aj-maestro.md.template +10 -6
  48. package/dist/templates/{agents → .claude/agents}/leadership/aly-cto.md.template +22 -19
  49. package/dist/templates/{agents → .claude/agents}/planning/eus-decomposer.md.template +8 -4
  50. package/dist/templates/{agents → .claude/agents}/planning/mon-requirements.md.template +8 -4
  51. package/dist/templates/{agents → .claude/agents}/planning/ror-design.md.template +8 -4
  52. package/dist/templates/{agents → .claude/agents}/planning/tra-planner.md.template +10 -4
  53. package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-audit.md.template +15 -15
  54. package/dist/templates/.claude/commands/execution/trinity-breakdown.md.template +535 -0
  55. package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-orchestrate.md.template +48 -48
  56. package/dist/templates/{shared/claude-commands → .claude/commands/infrastructure}/trinity-init.md.template +32 -54
  57. package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-create-investigation.md.template +13 -7
  58. package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-investigate-templates.md.template +19 -15
  59. package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-plan-investigation.md.template +12 -6
  60. package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-changelog.md.template +9 -8
  61. package/dist/templates/.claude/commands/maintenance/trinity-docs-update.md.template +279 -0
  62. package/dist/templates/.claude/commands/maintenance/trinity-docs.md.template +2828 -0
  63. package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-readme.md.template +21 -20
  64. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-decompose.md.template +6 -4
  65. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-design.md.template +6 -4
  66. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-plan.md.template +7 -5
  67. package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-requirements.md.template +6 -4
  68. package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-continue.md.template +30 -24
  69. package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-end.md.template +403 -397
  70. package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-start.md.template +9 -4
  71. package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-agents.md.template +11 -8
  72. package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-verify.md.template +56 -57
  73. package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-workorder.md.template +13 -9
  74. package/dist/templates/ci/ci.yml.template +2 -2
  75. package/dist/templates/root/CLAUDE.md.template +9 -9
  76. package/dist/templates/root/linting/nodejs/.husky-pre-commit.template +5 -0
  77. package/dist/templates/source/base-CLAUDE.md.template +310 -310
  78. package/dist/templates/source/flutter-CLAUDE.md.template +593 -593
  79. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -531
  80. package/dist/templates/source/python-CLAUDE.md.template +510 -510
  81. package/dist/templates/source/react-CLAUDE.md.template +513 -513
  82. package/dist/templates/source/rust-CLAUDE.md.template +653 -653
  83. package/dist/templates/trinity/CLAUDE.md.template +14 -14
  84. package/dist/templates/{knowledge-base → trinity/knowledge-base}/AI-DEVELOPMENT-GUIDE.md.template +1 -1
  85. package/dist/templates/{knowledge-base → trinity/knowledge-base}/ARCHITECTURE.md.template +5 -5
  86. package/dist/templates/{knowledge-base → trinity/knowledge-base}/CODING-PRINCIPLES.md.template +1 -1
  87. package/dist/templates/{knowledge-base → trinity/knowledge-base}/DOCUMENTATION-CRITERIA.md.template +1 -1
  88. package/dist/templates/{knowledge-base → trinity/knowledge-base}/ISSUES.md.template +9 -9
  89. package/dist/templates/{knowledge-base → trinity/knowledge-base}/TESTING-PRINCIPLES.md.template +1 -1
  90. package/dist/templates/{knowledge-base → trinity/knowledge-base}/Technical-Debt.md.template +2 -4
  91. package/dist/templates/{knowledge-base → trinity/knowledge-base}/To-do.md.template +2 -2
  92. package/dist/templates/{knowledge-base → trinity/knowledge-base}/Trinity.md.template +6 -6
  93. package/dist/templates/trinity/templates/documentation/api-docs/README.md.template +218 -0
  94. package/dist/templates/trinity/templates/documentation/configuration/documentation-structure.md.template +71 -0
  95. package/dist/templates/trinity/templates/documentation/configuration/env-example-generator.md.template +387 -0
  96. package/dist/templates/trinity/templates/documentation/discovery/api-endpoint-scanner.md.template +343 -0
  97. package/dist/templates/trinity/templates/documentation/discovery/component-discovery.md.template +254 -0
  98. package/dist/templates/trinity/templates/documentation/discovery/env-variable-extraction.md.template +316 -0
  99. package/dist/templates/trinity/templates/documentation/discovery/framework-detection.md.template +205 -0
  100. package/dist/templates/trinity/templates/documentation/guides/api-development.md.template +375 -0
  101. package/dist/templates/trinity/templates/documentation/guides/contributing.md.template +488 -0
  102. package/dist/templates/trinity/templates/documentation/guides/deployment.md.template +565 -0
  103. package/dist/templates/trinity/templates/documentation/guides/getting-started.md.template +118 -0
  104. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/api-endpoint-map.md.template +56 -0
  105. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/component-hierarchy.md.template +60 -0
  106. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/database-er.md.template +49 -0
  107. package/dist/templates/trinity/templates/documentation/mermaid-diagrams/mvc-flow.md.template +41 -0
  108. package/dist/templates/trinity/templates/documentation/processes/error-handling-protocol.md.template +166 -0
  109. package/dist/templates/trinity/templates/documentation/processes/fallback-mechanism.md.template +88 -0
  110. package/dist/templates/trinity/templates/documentation/reports/apo-docs-update-checklist.md.template +343 -0
  111. package/dist/templates/trinity/templates/documentation/reports/juno-docs-update-checklist.md.template +1337 -0
  112. package/dist/templates/trinity/templates/documentation/reports/juno-final-report.md.template +237 -0
  113. package/dist/templates/trinity/templates/documentation/reports/juno-internal-report.md.template +461 -0
  114. package/dist/templates/trinity/templates/documentation/validation/documentation-verification-rules.md.template +379 -0
  115. package/dist/templates/trinity/templates/documentation/validation/juno-quality-gates.md.template +282 -0
  116. package/dist/templates/{investigations → trinity/templates/investigations}/bug.md.template +14 -14
  117. package/dist/templates/{investigations → trinity/templates/investigations}/feature.md.template +14 -14
  118. package/dist/templates/{investigations → trinity/templates/investigations}/performance.md.template +14 -14
  119. package/dist/templates/{investigations → trinity/templates/investigations}/security.md.template +14 -14
  120. package/dist/templates/{investigations → trinity/templates/investigations}/technical.md.template +14 -14
  121. package/dist/templates/{work-orders → trinity/templates/work-orders}/ANALYSIS-TEMPLATE.md.template +10 -13
  122. package/dist/templates/{work-orders → trinity/templates/work-orders}/AUDIT-TEMPLATE.md.template +10 -26
  123. package/dist/templates/{work-orders → trinity/templates/work-orders}/IMPLEMENTATION-TEMPLATE.md.template +10 -26
  124. package/dist/templates/{work-orders → trinity/templates/work-orders}/INVESTIGATION-TEMPLATE.md.template +10 -25
  125. package/dist/templates/{work-orders → trinity/templates/work-orders}/PATTERN-TEMPLATE.md.template +10 -26
  126. package/dist/templates/{work-orders → trinity/templates/work-orders}/VERIFICATION-TEMPLATE.md.template +10 -26
  127. package/package.json +99 -94
  128. package/dist/templates/agents/leadership/aj-cc.md.template +0 -462
  129. package/dist/templates/ci/cd.yml.template +0 -175
  130. package/dist/templates/ci/github-actions.yml +0 -86
  131. package/dist/templates/root/TRINITY.md.template +0 -52
  132. package/dist/templates/shared/claude-commands/trinity-docs.md.template +0 -2577
  133. /package/dist/templates/{linting → root/linting}/flutter/.pre-commit-config.yaml.template +0 -0
  134. /package/dist/templates/{linting → root/linting}/flutter/analysis_options.yaml.template +0 -0
  135. /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-commonjs.json.template +0 -0
  136. /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-esm.json.template +0 -0
  137. /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-typescript.json.template +0 -0
  138. /package/dist/templates/{linting → root/linting}/nodejs/.pre-commit-config.yaml.template +0 -0
  139. /package/dist/templates/{linting → root/linting}/nodejs/.prettierrc.json.template +0 -0
  140. /package/dist/templates/{linting → root/linting}/python/.flake8.template +0 -0
  141. /package/dist/templates/{linting → root/linting}/python/.pre-commit-config.yaml.template +0 -0
  142. /package/dist/templates/{linting → root/linting}/python/pyproject.toml.template +0 -0
  143. /package/dist/templates/{linting → root/linting}/rust/.pre-commit-config.yaml.template +0 -0
  144. /package/dist/templates/{linting → root/linting}/rust/clippy.toml.template +0 -0
  145. /package/dist/templates/{linting → root/linting}/rust/rustfmt.toml.template +0 -0
  146. /package/dist/templates/{documentation → trinity/templates/documentation}/ROOT-README.md.template +0 -0
  147. /package/dist/templates/{documentation → trinity/templates/documentation}/SUBDIRECTORY-README.md.template +0 -0
@@ -0,0 +1,565 @@
1
+ # Deployment Guide
2
+
3
+ This guide covers deploying {{PROJECT_NAME}} to various platforms and environments.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ Before deploying, ensure:
10
+
11
+ - ✅ All tests pass: `{{TEST_COMMAND}}`
12
+ - ✅ Build succeeds: `{{BUILD_COMMAND}}`
13
+ - ✅ Environment variables configured
14
+ - ✅ Database migrations ready
15
+ - ✅ Production dependencies installed
16
+
17
+ ---
18
+
19
+ ## Environment Configuration
20
+
21
+ ### Required Environment Variables
22
+
23
+ {{ENV_VARS_LIST}}
24
+
25
+ ### Environment Files
26
+
27
+ **Development:** `.env.development`
28
+ **Staging:** `.env.staging`
29
+ **Production:** `.env.production`
30
+
31
+ ---
32
+
33
+ ## Build Process
34
+
35
+ ### 1. Install Production Dependencies
36
+
37
+ ```bash
38
+ {{PACKAGE_MANAGER}} install --production
39
+ ```
40
+
41
+ ### 2. Run Build
42
+
43
+ ```bash
44
+ {{BUILD_COMMAND}}
45
+ ```
46
+
47
+ Build output location: `{{BUILD_OUTPUT_DIRECTORY}}`
48
+
49
+ ### 3. Verify Build
50
+
51
+ ```bash
52
+ {{BUILD_VERIFICATION_COMMAND}}
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Database Migrations
58
+
59
+ {{DATABASE_MIGRATIONS}}
60
+
61
+ ---
62
+
63
+ ## Deployment Platforms
64
+
65
+ ### Option 1: Heroku
66
+
67
+ #### Setup
68
+
69
+ 1. Install Heroku CLI:
70
+ ```bash
71
+ curl https://cli-assets.heroku.com/install.sh | sh
72
+ ```
73
+
74
+ 2. Login to Heroku:
75
+ ```bash
76
+ heroku login
77
+ ```
78
+
79
+ 3. Create Heroku app:
80
+ ```bash
81
+ heroku create {{PROJECT_NAME}}-production
82
+ ```
83
+
84
+ #### Configure Environment Variables
85
+
86
+ ```bash
87
+ {{HEROKU_ENV_VARS}}
88
+ ```
89
+
90
+ #### Deploy
91
+
92
+ ```bash
93
+ git push heroku main
94
+ ```
95
+
96
+ #### Database Setup
97
+
98
+ ```bash
99
+ {{HEROKU_DATABASE_SETUP}}
100
+ ```
101
+
102
+ #### View Logs
103
+
104
+ ```bash
105
+ heroku logs --tail
106
+ ```
107
+
108
+ ---
109
+
110
+ ### Option 2: Vercel
111
+
112
+ #### Setup
113
+
114
+ 1. Install Vercel CLI:
115
+ ```bash
116
+ npm install -g vercel
117
+ ```
118
+
119
+ 2. Login to Vercel:
120
+ ```bash
121
+ vercel login
122
+ ```
123
+
124
+ #### Deploy
125
+
126
+ ```bash
127
+ vercel --prod
128
+ ```
129
+
130
+ #### Configuration
131
+
132
+ Create `vercel.json`:
133
+
134
+ ```json
135
+ {
136
+ "version": 2,
137
+ "builds": [
138
+ {
139
+ "src": "{{MAIN_SERVER_FILE}}",
140
+ "use": "@vercel/node"
141
+ }
142
+ ],
143
+ "routes": [
144
+ {
145
+ "src": "/(.*)",
146
+ "dest": "{{MAIN_SERVER_FILE}}"
147
+ }
148
+ ],
149
+ "env": {{VERCEL_ENV_VARS}}
150
+ }
151
+ ```
152
+
153
+ ---
154
+
155
+ ### Option 3: Docker
156
+
157
+ #### Dockerfile
158
+
159
+ ```dockerfile
160
+ FROM node:{{NODE_VERSION}}-alpine
161
+
162
+ WORKDIR /app
163
+
164
+ # Copy package files
165
+ COPY package*.json ./
166
+
167
+ # Install dependencies
168
+ RUN {{PACKAGE_MANAGER}} install --production
169
+
170
+ # Copy application code
171
+ COPY . .
172
+
173
+ # Build application
174
+ RUN {{BUILD_COMMAND}}
175
+
176
+ # Expose port
177
+ EXPOSE {{PORT}}
178
+
179
+ # Start application
180
+ CMD ["{{START_COMMAND}}"]
181
+ ```
182
+
183
+ #### docker-compose.yml
184
+
185
+ ```yaml
186
+ version: '3.8'
187
+
188
+ services:
189
+ app:
190
+ build: .
191
+ ports:
192
+ - "{{PORT}}:{{PORT}}"
193
+ environment:
194
+ {{DOCKER_ENV_VARS}}
195
+ depends_on:
196
+ - {{DATABASE_SERVICE}}
197
+
198
+ {{DATABASE_SERVICE_CONFIG}}
199
+ ```
200
+
201
+ #### Build and Run
202
+
203
+ ```bash
204
+ # Build image
205
+ docker build -t {{PROJECT_NAME}} .
206
+
207
+ # Run container
208
+ docker run -p {{PORT}}:{{PORT}} {{PROJECT_NAME}}
209
+
210
+ # Or use docker-compose
211
+ docker-compose up -d
212
+ ```
213
+
214
+ ---
215
+
216
+ ### Option 4: AWS (EC2)
217
+
218
+ #### Setup
219
+
220
+ 1. Launch EC2 instance (Ubuntu 20.04 LTS)
221
+ 2. Configure security group (allow port {{PORT}})
222
+ 3. SSH into instance
223
+
224
+ #### Install Dependencies
225
+
226
+ ```bash
227
+ # Update system
228
+ sudo apt update && sudo apt upgrade -y
229
+
230
+ # Install Node.js
231
+ curl -fsSL https://deb.nodesource.com/setup_{{NODE_VERSION}}.x | sudo -E bash -
232
+ sudo apt install -y nodejs
233
+
234
+ # Install {{PACKAGE_MANAGER}}
235
+ {{PACKAGE_MANAGER_INSTALL_COMMAND}}
236
+
237
+ # Install PM2 (process manager)
238
+ sudo npm install -g pm2
239
+ ```
240
+
241
+ #### Deploy Application
242
+
243
+ ```bash
244
+ # Clone repository
245
+ git clone <repository-url>
246
+ cd {{PROJECT_NAME}}
247
+
248
+ # Install dependencies
249
+ {{PACKAGE_MANAGER}} install --production
250
+
251
+ # Build application
252
+ {{BUILD_COMMAND}}
253
+
254
+ # Configure environment
255
+ cp .env.example .env
256
+ nano .env # Edit environment variables
257
+
258
+ # Start with PM2
259
+ pm2 start {{START_SCRIPT}} --name {{PROJECT_NAME}}
260
+ pm2 save
261
+ pm2 startup
262
+ ```
263
+
264
+ #### Nginx Configuration
265
+
266
+ ```nginx
267
+ server {
268
+ listen 80;
269
+ server_name {{DOMAIN_NAME}};
270
+
271
+ location / {
272
+ proxy_pass http://localhost:{{PORT}};
273
+ proxy_http_version 1.1;
274
+ proxy_set_header Upgrade $http_upgrade;
275
+ proxy_set_header Connection 'upgrade';
276
+ proxy_set_header Host $host;
277
+ proxy_cache_bypass $http_upgrade;
278
+ }
279
+ }
280
+ ```
281
+
282
+ ---
283
+
284
+ ### Option 5: DigitalOcean App Platform
285
+
286
+ #### Setup
287
+
288
+ 1. Create DigitalOcean account
289
+ 2. Navigate to App Platform
290
+ 3. Connect GitHub repository
291
+
292
+ #### Configuration
293
+
294
+ **App Spec (`.do/app.yaml`):**
295
+
296
+ ```yaml
297
+ name: {{PROJECT_NAME}}
298
+ services:
299
+ - name: api
300
+ github:
301
+ repo: <username>/{{PROJECT_NAME}}
302
+ branch: main
303
+ build_command: {{BUILD_COMMAND}}
304
+ run_command: {{START_COMMAND}}
305
+ http_port: {{PORT}}
306
+ environment_slug: node-js
307
+ envs:
308
+ {{DIGITALOCEAN_ENV_VARS}}
309
+
310
+ databases:
311
+ {{DIGITALOCEAN_DATABASE_CONFIG}}
312
+ ```
313
+
314
+ #### Deploy
315
+
316
+ Push to main branch to trigger automatic deployment.
317
+
318
+ ---
319
+
320
+ ## SSL/TLS Configuration
321
+
322
+ ### Let's Encrypt (Free SSL)
323
+
324
+ ```bash
325
+ # Install certbot
326
+ sudo apt install certbot python3-certbot-nginx
327
+
328
+ # Obtain certificate
329
+ sudo certbot --nginx -d {{DOMAIN_NAME}}
330
+
331
+ # Auto-renewal (runs twice daily)
332
+ sudo systemctl enable certbot.timer
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Monitoring & Logging
338
+
339
+ ### Application Monitoring
340
+
341
+ {{MONITORING_SETUP}}
342
+
343
+ ### Error Tracking
344
+
345
+ {{ERROR_TRACKING_SETUP}}
346
+
347
+ ### Log Aggregation
348
+
349
+ {{LOG_AGGREGATION_SETUP}}
350
+
351
+ ---
352
+
353
+ ## Performance Optimization
354
+
355
+ ### Production Optimizations
356
+
357
+ 1. **Enable Compression:**
358
+ ```typescript
359
+ import compression from 'compression';
360
+ app.use(compression());
361
+ ```
362
+
363
+ 2. **Enable Caching:**
364
+ ```typescript
365
+ app.use((req, res, next) => {
366
+ res.set('Cache-Control', 'public, max-age=300');
367
+ next();
368
+ });
369
+ ```
370
+
371
+ 3. **Connection Pooling:**
372
+ {{CONNECTION_POOLING_CONFIG}}
373
+
374
+ 4. **Rate Limiting:**
375
+ ```typescript
376
+ import rateLimit from 'express-rate-limit';
377
+
378
+ const limiter = rateLimit({
379
+ windowMs: 15 * 60 * 1000, // 15 minutes
380
+ max: 100 // limit each IP to 100 requests per windowMs
381
+ });
382
+
383
+ app.use('/api/', limiter);
384
+ ```
385
+
386
+ ---
387
+
388
+ ## Health Checks
389
+
390
+ ### Health Check Endpoint
391
+
392
+ ```typescript
393
+ app.get('/health', (req, res) => {
394
+ res.json({
395
+ status: 'healthy',
396
+ timestamp: new Date().toISOString(),
397
+ uptime: process.uptime(),
398
+ database: await checkDatabaseConnection()
399
+ });
400
+ });
401
+ ```
402
+
403
+ ### Readiness Check
404
+
405
+ ```typescript
406
+ app.get('/ready', async (req, res) => {
407
+ const checks = {
408
+ database: await checkDatabaseConnection(),
409
+ dependencies: await checkDependencies()
410
+ };
411
+
412
+ const ready = Object.values(checks).every(check => check === true);
413
+ res.status(ready ? 200 : 503).json(checks);
414
+ });
415
+ ```
416
+
417
+ ---
418
+
419
+ ## Backup & Recovery
420
+
421
+ ### Database Backups
422
+
423
+ {{DATABASE_BACKUP_INSTRUCTIONS}}
424
+
425
+ ### Application Backup
426
+
427
+ ```bash
428
+ # Backup application files
429
+ tar -czf {{PROJECT_NAME}}-backup-$(date +%Y%m%d).tar.gz /path/to/app
430
+
431
+ # Upload to S3 (optional)
432
+ aws s3 cp {{PROJECT_NAME}}-backup-$(date +%Y%m%d).tar.gz s3://backups/
433
+ ```
434
+
435
+ ---
436
+
437
+ ## Rollback Strategy
438
+
439
+ ### Quick Rollback
440
+
441
+ **Heroku:**
442
+ ```bash
443
+ heroku rollback
444
+ ```
445
+
446
+ **Docker:**
447
+ ```bash
448
+ docker-compose down
449
+ docker-compose up -d <previous-image-tag>
450
+ ```
451
+
452
+ **PM2:**
453
+ ```bash
454
+ pm2 stop {{PROJECT_NAME}}
455
+ git checkout <previous-commit>
456
+ {{PACKAGE_MANAGER}} install
457
+ {{BUILD_COMMAND}}
458
+ pm2 restart {{PROJECT_NAME}}
459
+ ```
460
+
461
+ ---
462
+
463
+ ## CI/CD Pipeline
464
+
465
+ ### GitHub Actions
466
+
467
+ **File:** `.github/workflows/deploy.yml`
468
+
469
+ ```yaml
470
+ name: Deploy
471
+
472
+ on:
473
+ push:
474
+ branches: [main]
475
+
476
+ jobs:
477
+ deploy:
478
+ runs-on: ubuntu-latest
479
+ steps:
480
+ - uses: actions/checkout@v2
481
+
482
+ - name: Setup Node.js
483
+ uses: actions/setup-node@v2
484
+ with:
485
+ node-version: '{{NODE_VERSION}}'
486
+
487
+ - name: Install dependencies
488
+ run: {{PACKAGE_MANAGER}} install
489
+
490
+ - name: Run tests
491
+ run: {{TEST_COMMAND}}
492
+
493
+ - name: Build
494
+ run: {{BUILD_COMMAND}}
495
+
496
+ - name: Deploy
497
+ run: |
498
+ # Deployment script
499
+ {{CI_DEPLOY_SCRIPT}}
500
+ ```
501
+
502
+ ---
503
+
504
+ ## Post-Deployment Checklist
505
+
506
+ - [ ] Application is accessible at production URL
507
+ - [ ] Health check endpoint returns 200
508
+ - [ ] Database connection successful
509
+ - [ ] Environment variables configured correctly
510
+ - [ ] SSL certificate installed and valid
511
+ - [ ] Logs are being collected
512
+ - [ ] Monitoring alerts configured
513
+ - [ ] Backup schedule verified
514
+ - [ ] Performance metrics within acceptable range
515
+
516
+ ---
517
+
518
+ ## Troubleshooting
519
+
520
+ ### Application Won't Start
521
+
522
+ 1. Check logs: `{{LOG_COMMAND}}`
523
+ 2. Verify environment variables
524
+ 3. Confirm database connection
525
+ 4. Check port availability
526
+
527
+ ### Database Connection Fails
528
+
529
+ 1. Verify database credentials
530
+ 2. Check network connectivity
531
+ 3. Confirm database is running
532
+ 4. Review firewall rules
533
+
534
+ ### Performance Issues
535
+
536
+ 1. Check application metrics
537
+ 2. Review database query performance
538
+ 3. Analyze resource utilization (CPU, memory)
539
+ 4. Check for memory leaks
540
+
541
+ ---
542
+
543
+ ## Security Checklist
544
+
545
+ - [ ] All secrets in environment variables (not in code)
546
+ - [ ] HTTPS enabled
547
+ - [ ] Security headers configured
548
+ - [ ] Rate limiting enabled
549
+ - [ ] Input validation implemented
550
+ - [ ] SQL injection protection
551
+ - [ ] XSS protection
552
+ - [ ] CSRF protection
553
+ - [ ] Dependency vulnerabilities checked
554
+
555
+ ---
556
+
557
+ ## Related Documentation
558
+
559
+ - [Getting Started](./getting-started.md) - Local development setup
560
+ - [API Development](./api-development.md) - API development guide
561
+ - [Contributing](../CONTRIBUTING.md) - Code standards
562
+
563
+ ---
564
+
565
+ *Last updated: {{GENERATION_DATE}}*
@@ -0,0 +1,118 @@
1
+ # Getting Started with {{PROJECT_NAME}}
2
+
3
+ Welcome to {{PROJECT_NAME}}! This guide will help you get the project running on your local machine for development.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ Before you begin, ensure you have the following installed:
10
+
11
+ - **Node.js** (version 14.x or higher)
12
+ - **{{PACKAGE_MANAGER}}** ({{PACKAGE_MANAGER_VERSION}})
13
+ - **{{DATABASE}}** (if applicable)
14
+ - **Git** for version control
15
+
16
+ ---
17
+
18
+ ## Installation
19
+
20
+ ### 1. Clone the Repository
21
+
22
+ ```bash
23
+ git clone <repository-url>
24
+ cd {{PROJECT_NAME}}
25
+ ```
26
+
27
+ ### 2. Install Dependencies
28
+
29
+ {{INSTALL_STEPS}}
30
+
31
+ ### 3. Environment Configuration
32
+
33
+ {{ENV_SETUP_INSTRUCTIONS}}
34
+
35
+ ---
36
+
37
+ ## Running the Application
38
+
39
+ ### Development Mode
40
+
41
+ Start the development server:
42
+
43
+ ```bash
44
+ {{RUN_COMMAND}}
45
+ ```
46
+
47
+ The application will be available at: **{{DEV_SERVER_URL}}**
48
+
49
+ ### Running Tests
50
+
51
+ {{TEST_INSTRUCTIONS}}
52
+
53
+ ```bash
54
+ {{TEST_COMMAND}}
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Project Structure
60
+
61
+ ```
62
+ {{PROJECT_NAME}}/
63
+ ├── {{SOURCE_DIRECTORY}}/ # Application source code
64
+ ├── {{TEST_DIRECTORY}}/ # Test files
65
+ ├── {{CONFIG_DIRECTORY}}/ # Configuration files
66
+ └── {{DOCS_DIRECTORY}}/ # Documentation
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Database Setup
72
+
73
+ {{DATABASE_SETUP_INSTRUCTIONS}}
74
+
75
+ ---
76
+
77
+ ## Verification
78
+
79
+ After completing the setup, verify everything works:
80
+
81
+ 1. **Application starts:** {{RUN_COMMAND}} runs without errors
82
+ 2. **Tests pass:** {{TEST_COMMAND}} shows all tests passing
83
+ 3. **Database connected:** {{DATABASE_VERIFICATION}}
84
+
85
+ ---
86
+
87
+ ## Troubleshooting
88
+
89
+ ### Common Issues
90
+
91
+ **Issue:** Dependencies fail to install
92
+ - **Solution:** Clear cache with `{{PACKAGE_MANAGER}} cache clean` and retry
93
+
94
+ **Issue:** Database connection fails
95
+ - **Solution:** Verify {{DATABASE}} is running and credentials in `.env` are correct
96
+
97
+ **Issue:** Port already in use
98
+ - **Solution:** Check if another process is using the port, or change port in `.env`
99
+
100
+ ---
101
+
102
+ ## Next Steps
103
+
104
+ - Read the [API Documentation](../api/README.md) to understand available endpoints
105
+ - Review [API Development Guide](./api-development.md) to learn how to add new features
106
+ - Check [Contributing Guidelines](../CONTRIBUTING.md) for code standards
107
+
108
+ ---
109
+
110
+ ## Need Help?
111
+
112
+ - **Documentation:** [Full documentation](../README.md)
113
+ - **Issues:** Report bugs via the issue tracker
114
+ - **Questions:** Contact the development team
115
+
116
+ ---
117
+
118
+ *Last updated: {{GENERATION_DATE}}*
@@ -0,0 +1,56 @@
1
+ # API Endpoint Map Diagram Template
2
+
3
+ <!--
4
+ This template generates a Mermaid flowchart showing API resource hierarchy.
5
+
6
+ Variables:
7
+ - {{RESOURCES}}: Resource definitions with endpoints
8
+ - {{BASE_PATH}}: API base path (e.g., "/api/v1", "/api")
9
+
10
+ Usage: Replace variables with actual API structure before writing to docs/images/
11
+
12
+ Example RESOURCES format (Mermaid flowchart syntax):
13
+ API[{{BASE_PATH}}]
14
+ Users[Users]
15
+ Auth[Authentication]
16
+ Orders[Orders]
17
+
18
+ API --> Users
19
+
20
+ API --> Auth
21
+ API --> Orders
22
+
23
+ Users --> GetUsers[GET /users]
24
+ Users --> CreateUser[POST /users]
25
+ Users --> GetUser[GET /users/:id]
26
+
27
+ Auth --> Login[POST /auth/login]
28
+ Auth --> Logout[POST /auth/logout]
29
+
30
+ -->
31
+
32
+ ```mermaid
33
+ flowchart TD
34
+ {{RESOURCES}}
35
+ ```
36
+
37
+ ## Description
38
+
39
+ This API endpoint map provides a visual overview of the application's REST API structure:
40
+
41
+ - **Base Path**: {{BASE_PATH}}
42
+ - **Resource Groups**: Logical groupings of related endpoints
43
+ - **HTTP Methods**: GET (retrieve), POST (create), PUT/PATCH (update), DELETE (remove)
44
+
45
+ **Benefits:**
46
+
47
+ - Quickly understand available API resources
48
+ - Identify endpoint patterns and conventions
49
+ - Plan new endpoint additions
50
+ - Visualize API surface area for documentation
51
+
52
+ **Navigation:**
53
+
54
+ - Top level shows the base API path
55
+ - Second level shows resource categories
56
+ - Third level shows individual endpoints with HTTP methods