vibedoc 1.0.0 → 1.0.2
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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +23 -18
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/board/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/docs/page.js +1 -1
- package/.next/server/app/(app)/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/memory/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/setup/page.js +2 -1
- package/.next/server/app/(app)/setup/page.js.nft.json +1 -1
- package/.next/server/app/(app)/setup/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/activity.html +1 -1
- package/.next/server/app/activity.rsc +2 -2
- package/.next/server/app/api/mcp/route.js +10 -100
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/generate/route.js +23 -84
- package/.next/server/app/api/setup/generate/route.js.nft.json +1 -1
- package/.next/server/app/board.html +1 -1
- package/.next/server/app/board.rsc +2 -2
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +3 -3
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/app/memory.html +1 -1
- package/.next/server/app/memory.rsc +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +2 -2
- package/.next/server/app/setup.html +1 -1
- package/.next/server/app/setup.rsc +3 -3
- package/.next/server/app-paths-manifest.json +9 -9
- package/.next/server/chunks/118.js +2107 -0
- package/.next/server/chunks/191.js +2107 -91
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/2401-65366c9431a3dcca.js +16 -0
- package/.next/static/chunks/5179-76391417caead0bc.js +1 -0
- package/.next/static/chunks/6441-8a1066f99fe4fead.js +1 -0
- package/.next/static/chunks/app/(app)/docs/{page-17670ed46c3594e6.js → page-f5615cefbd3d1c64.js} +1 -1
- package/.next/static/chunks/app/(app)/{layout-34b4046ccf919d3f.js → layout-ef459e6f184dba6b.js} +1 -1
- package/.next/static/chunks/app/(app)/setup/page-a47e3a9a44666f50.js +1 -0
- package/.next/static/css/48c54dd7bfa2411e.css +5 -0
- package/README.md +33 -26
- package/bin/vibedoc.js +66 -39
- package/package.json +1 -1
- package/.next/static/chunks/845-0e3438196b5ef62c.js +0 -1
- package/.next/static/chunks/app/(app)/setup/page-9fd82b10016eca64.js +0 -16
- package/.next/static/css/615004f0fff77145.css +0 -5
- /package/.next/static/{r-2w-yCd6mM7TOOETgGaA → SozubT4AiNYJ3ynkRV0zo}/_buildManifest.js +0 -0
- /package/.next/static/{r-2w-yCd6mM7TOOETgGaA → SozubT4AiNYJ3ynkRV0zo}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,2107 @@
|
|
|
1
|
+
"use strict";exports.id=118,exports.ids=[118],exports.modules={7118:(e,t,i)=>{i.d(t,{x:()=>a});let n=[{id:"claude-md",name:"CLAUDE.md",description:"AI agent instructions for Claude Code",defaultPath:"CLAUDE.md",category:"ai-agent",content:`# {{PROJECT_NAME}} — Agent Instructions
|
|
2
|
+
|
|
3
|
+
## What this is
|
|
4
|
+
{{DESCRIPTION}}
|
|
5
|
+
|
|
6
|
+
## Stack
|
|
7
|
+
{{TECH_STACK}}
|
|
8
|
+
|
|
9
|
+
## Project type
|
|
10
|
+
{{PROJECT_TYPE}}
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
\`\`\`bash
|
|
14
|
+
# Install dependencies
|
|
15
|
+
{{PACKAGE_MANAGER}} install
|
|
16
|
+
|
|
17
|
+
# Start development
|
|
18
|
+
npm run dev
|
|
19
|
+
|
|
20
|
+
# Build for production
|
|
21
|
+
npm run build
|
|
22
|
+
|
|
23
|
+
# Run tests
|
|
24
|
+
npm test
|
|
25
|
+
\`\`\`
|
|
26
|
+
|
|
27
|
+
## Architecture
|
|
28
|
+
- Primary language: {{PRIMARY_LANGUAGE}}
|
|
29
|
+
- Deployment: {{DEPLOYMENT_PLATFORM}}
|
|
30
|
+
- Key directories: \`src/\`, \`docs/\`, \`tests/\`
|
|
31
|
+
- See \`docs/architecture/overview.md\` for full details
|
|
32
|
+
|
|
33
|
+
## Read before coding
|
|
34
|
+
- @docs/architecture/overview.md
|
|
35
|
+
- @CONTRIBUTING.md
|
|
36
|
+
|
|
37
|
+
## Key conventions
|
|
38
|
+
{{CONVENTIONS}}
|
|
39
|
+
|
|
40
|
+
## Key features
|
|
41
|
+
{{KEY_FEATURES}}
|
|
42
|
+
|
|
43
|
+
## Non-negotiables
|
|
44
|
+
- Always run \`npm run build\` before marking a task done — build must pass
|
|
45
|
+
- Never use localStorage — causes SSR/client mismatch
|
|
46
|
+
- Never commit secrets or credentials
|
|
47
|
+
- Maintain test coverage
|
|
48
|
+
- Follow security best practices
|
|
49
|
+
|
|
50
|
+
## Code style
|
|
51
|
+
- Follow existing patterns before introducing new abstractions
|
|
52
|
+
- Keep modules small and focused
|
|
53
|
+
- Write tests for business logic
|
|
54
|
+
- Prefer explicit over implicit
|
|
55
|
+
`},{id:"agents-md",name:"AGENTS.md",description:"AI agent instructions (multi-agent / OpenAI)",defaultPath:"AGENTS.md",category:"ai-agent",content:`# {{PROJECT_NAME}} — Agent Instructions
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
{{DESCRIPTION}}
|
|
59
|
+
|
|
60
|
+
## Stack
|
|
61
|
+
{{TECH_STACK}}
|
|
62
|
+
|
|
63
|
+
## Commands
|
|
64
|
+
\`\`\`bash
|
|
65
|
+
npm install
|
|
66
|
+
npm run dev
|
|
67
|
+
npm run build
|
|
68
|
+
npm test
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
## Key conventions
|
|
72
|
+
{{CONVENTIONS}}
|
|
73
|
+
|
|
74
|
+
## Non-negotiables
|
|
75
|
+
- Follow existing code patterns
|
|
76
|
+
- Write tests for new features
|
|
77
|
+
- Never commit secrets or credentials
|
|
78
|
+
`},{id:"gemini-md",name:"GEMINI.md",description:"AI agent instructions for Gemini CLI",defaultPath:"GEMINI.md",category:"ai-agent",content:`# {{PROJECT_NAME}} — Gemini Agent Instructions
|
|
79
|
+
|
|
80
|
+
## What this is
|
|
81
|
+
{{DESCRIPTION}}
|
|
82
|
+
|
|
83
|
+
## Stack
|
|
84
|
+
{{TECH_STACK}}
|
|
85
|
+
|
|
86
|
+
## Commands
|
|
87
|
+
\`\`\`bash
|
|
88
|
+
# Install dependencies
|
|
89
|
+
npm install
|
|
90
|
+
|
|
91
|
+
# Start development
|
|
92
|
+
npm run dev
|
|
93
|
+
|
|
94
|
+
# Build for production
|
|
95
|
+
npm run build
|
|
96
|
+
|
|
97
|
+
# Run tests
|
|
98
|
+
npm test
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
## Key conventions
|
|
102
|
+
{{CONVENTIONS}}
|
|
103
|
+
|
|
104
|
+
## Non-negotiables
|
|
105
|
+
- Follow existing code patterns
|
|
106
|
+
- Write tests for new features
|
|
107
|
+
- Never commit secrets or credentials
|
|
108
|
+
`},{id:"cursorrules",name:".cursorrules",description:"Cursor IDE rules for AI assistance",defaultPath:".cursorrules",category:"ai-agent",content:`# {{PROJECT_NAME}} — Cursor Rules
|
|
109
|
+
|
|
110
|
+
## Project overview
|
|
111
|
+
{{DESCRIPTION}}
|
|
112
|
+
|
|
113
|
+
## Tech stack
|
|
114
|
+
{{TECH_STACK}}
|
|
115
|
+
|
|
116
|
+
## Code style
|
|
117
|
+
- Use {{TECH_STACK}} conventions
|
|
118
|
+
- Follow existing patterns in the codebase
|
|
119
|
+
- Prefer explicit over implicit
|
|
120
|
+
- Keep functions small and focused
|
|
121
|
+
|
|
122
|
+
## Conventions
|
|
123
|
+
{{CONVENTIONS}}
|
|
124
|
+
|
|
125
|
+
## What NOT to do
|
|
126
|
+
- Don't introduce new dependencies without discussion
|
|
127
|
+
- Don't break existing tests
|
|
128
|
+
- Don't commit secrets or credentials
|
|
129
|
+
- Don't over-engineer simple solutions
|
|
130
|
+
`},{id:"windsurfrules",name:".windsurfrules",description:"Windsurf IDE rules for AI assistance",defaultPath:".windsurfrules",category:"ai-agent",content:`# {{PROJECT_NAME}} — Windsurf Rules
|
|
131
|
+
|
|
132
|
+
## Project overview
|
|
133
|
+
{{DESCRIPTION}}
|
|
134
|
+
|
|
135
|
+
## Tech stack
|
|
136
|
+
{{TECH_STACK}}
|
|
137
|
+
|
|
138
|
+
## Code style
|
|
139
|
+
- Follow existing patterns in the codebase
|
|
140
|
+
- Prefer explicit over implicit
|
|
141
|
+
- Keep functions small and focused
|
|
142
|
+
|
|
143
|
+
## Conventions
|
|
144
|
+
{{CONVENTIONS}}
|
|
145
|
+
|
|
146
|
+
## Non-negotiables
|
|
147
|
+
- Don't introduce breaking changes
|
|
148
|
+
- Don't commit secrets or credentials
|
|
149
|
+
- Maintain test coverage
|
|
150
|
+
`},{id:"copilot-instructions",name:"Copilot Instructions",description:"GitHub Copilot custom instructions",defaultPath:".github/copilot-instructions.md",category:"ai-agent",content:`# GitHub Copilot Instructions — {{PROJECT_NAME}}
|
|
151
|
+
|
|
152
|
+
## Project overview
|
|
153
|
+
{{DESCRIPTION}}
|
|
154
|
+
|
|
155
|
+
## Tech stack
|
|
156
|
+
{{TECH_STACK}}
|
|
157
|
+
|
|
158
|
+
## Coding conventions
|
|
159
|
+
{{CONVENTIONS}}
|
|
160
|
+
|
|
161
|
+
## Key features
|
|
162
|
+
{{KEY_FEATURES}}
|
|
163
|
+
|
|
164
|
+
## Style guidelines
|
|
165
|
+
- Follow existing patterns before creating new abstractions
|
|
166
|
+
- Write descriptive variable and function names
|
|
167
|
+
- Add comments for non-obvious logic only
|
|
168
|
+
- Keep functions focused on a single responsibility
|
|
169
|
+
|
|
170
|
+
## Testing
|
|
171
|
+
- Write tests for all new functionality
|
|
172
|
+
- Maintain existing test coverage
|
|
173
|
+
- Use the project's established testing patterns
|
|
174
|
+
`}],o=[{id:"contributing",name:"CONTRIBUTING.md",description:"Contribution guidelines",defaultPath:"CONTRIBUTING.md",category:"github",content:`# Contributing to {{PROJECT_NAME}}
|
|
175
|
+
|
|
176
|
+
Thank you for your interest in contributing!
|
|
177
|
+
|
|
178
|
+
## Getting started
|
|
179
|
+
|
|
180
|
+
1. Fork the repository
|
|
181
|
+
2. Clone your fork: \`git clone {{REPO_URL}}\`
|
|
182
|
+
3. Create a feature branch: \`git checkout -b feat/your-feature\`
|
|
183
|
+
4. Make your changes
|
|
184
|
+
5. Submit a pull request
|
|
185
|
+
|
|
186
|
+
## Branch naming
|
|
187
|
+
|
|
188
|
+
| Type | Pattern | Example |
|
|
189
|
+
|------|---------|---------|
|
|
190
|
+
| Feature | \`feat/<description>\` | \`feat/user-auth\` |
|
|
191
|
+
| Fix | \`fix/<description>\` | \`fix/login-crash\` |
|
|
192
|
+
| Chore | \`chore/<description>\` | \`chore/update-deps\` |
|
|
193
|
+
| Docs | \`docs/<description>\` | \`docs/api-guide\` |
|
|
194
|
+
| Refactor | \`refactor/<description>\` | \`refactor/auth-module\` |
|
|
195
|
+
| Release | \`release/<version>\` | \`release/v1.2.0\` |
|
|
196
|
+
|
|
197
|
+
## Commit conventions
|
|
198
|
+
|
|
199
|
+
We use [Conventional Commits](https://conventionalcommits.org):
|
|
200
|
+
|
|
201
|
+
| Type | When to use |
|
|
202
|
+
|------|------------|
|
|
203
|
+
| \`feat\` | New feature |
|
|
204
|
+
| \`fix\` | Bug fix |
|
|
205
|
+
| \`docs\` | Documentation only |
|
|
206
|
+
| \`refactor\` | Code change that's neither fix nor feature |
|
|
207
|
+
| \`test\` | Adding or updating tests |
|
|
208
|
+
| \`chore\` | Build process, dependencies, tooling |
|
|
209
|
+
| \`perf\` | Performance improvement |
|
|
210
|
+
| \`ci\` | CI/CD changes |
|
|
211
|
+
|
|
212
|
+
Examples:
|
|
213
|
+
\`\`\`
|
|
214
|
+
feat: add user authentication
|
|
215
|
+
fix: resolve login redirect issue
|
|
216
|
+
docs: update API reference
|
|
217
|
+
chore: upgrade dependencies
|
|
218
|
+
feat!: redesign auth API (breaking change — note the !)
|
|
219
|
+
\`\`\`
|
|
220
|
+
|
|
221
|
+
## PR size guidance
|
|
222
|
+
|
|
223
|
+
| Size | Lines changed | Guidance |
|
|
224
|
+
|------|--------------|---------|
|
|
225
|
+
| Small | < 400 lines | Ideal — fast to review |
|
|
226
|
+
| Medium | 400–800 lines | Acceptable — add extra context in description |
|
|
227
|
+
| Large | > 800 lines | Needs discussion before opening — split if possible |
|
|
228
|
+
|
|
229
|
+
Large PRs slow down the team and increase the chance of missed issues. When in doubt, split.
|
|
230
|
+
|
|
231
|
+
## Pull request process
|
|
232
|
+
|
|
233
|
+
1. Fill out the PR template completely
|
|
234
|
+
2. Ensure all CI checks pass
|
|
235
|
+
3. Request review from at least one maintainer
|
|
236
|
+
4. Address all review comments
|
|
237
|
+
5. Squash commits before merge
|
|
238
|
+
|
|
239
|
+
## Code review checklist
|
|
240
|
+
|
|
241
|
+
**Author:**
|
|
242
|
+
- [ ] Self-reviewed the diff before requesting review
|
|
243
|
+
- [ ] PR description explains the "why", not just the "what"
|
|
244
|
+
- [ ] Tests added/updated and passing
|
|
245
|
+
- [ ] No secrets or credentials in code
|
|
246
|
+
- [ ] Breaking changes noted in PR description
|
|
247
|
+
|
|
248
|
+
**Reviewer:**
|
|
249
|
+
- [ ] Code is correct and handles edge cases
|
|
250
|
+
- [ ] No obvious performance issues
|
|
251
|
+
- [ ] Tests are meaningful (not just coverage padding)
|
|
252
|
+
- [ ] Naming is clear and consistent with the codebase
|
|
253
|
+
- [ ] Documentation updated if public API changed
|
|
254
|
+
|
|
255
|
+
## Code style
|
|
256
|
+
{{CONVENTIONS}}
|
|
257
|
+
|
|
258
|
+
## Reporting bugs
|
|
259
|
+
|
|
260
|
+
Open an issue with:
|
|
261
|
+
- Description of the bug
|
|
262
|
+
- Steps to reproduce
|
|
263
|
+
- Expected vs actual behavior
|
|
264
|
+
- Environment details
|
|
265
|
+
`},{id:"security",name:"SECURITY.md",description:"Security policy and vulnerability reporting",defaultPath:"SECURITY.md",category:"github",content:`# Security Policy — {{PROJECT_NAME}}
|
|
266
|
+
|
|
267
|
+
## Supported versions
|
|
268
|
+
|
|
269
|
+
| Version | Supported |
|
|
270
|
+
|---------|-----------|
|
|
271
|
+
| latest | ✅ |
|
|
272
|
+
| < 1.0 | ❌ |
|
|
273
|
+
|
|
274
|
+
## Reporting a vulnerability
|
|
275
|
+
|
|
276
|
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
277
|
+
|
|
278
|
+
To report a security issue, email: **security@example.com**
|
|
279
|
+
|
|
280
|
+
You may optionally encrypt your report using our PGP key (key ID: \`0x00000000\`, available on keys.openpgp.org).
|
|
281
|
+
|
|
282
|
+
Include:
|
|
283
|
+
- Description of the vulnerability
|
|
284
|
+
- Steps to reproduce
|
|
285
|
+
- Potential impact
|
|
286
|
+
- Any suggested mitigations
|
|
287
|
+
|
|
288
|
+
You will receive a response within **48 hours**. We will:
|
|
289
|
+
1. Confirm receipt of your report
|
|
290
|
+
2. Investigate and assess the issue
|
|
291
|
+
3. Release a fix or mitigation
|
|
292
|
+
4. Credit you in the release notes (unless you prefer anonymity)
|
|
293
|
+
|
|
294
|
+
## Vulnerability SLAs
|
|
295
|
+
|
|
296
|
+
| Severity | Fix SLA |
|
|
297
|
+
|----------|---------|
|
|
298
|
+
| Critical | 48 hours |
|
|
299
|
+
| High | 7 days |
|
|
300
|
+
| Medium | 30 days |
|
|
301
|
+
| Low | 90 days |
|
|
302
|
+
|
|
303
|
+
Dependabot alerts for **critical** vulnerabilities must be resolved within 48 hours. Run \`npm audit\` in CI on every PR.
|
|
304
|
+
|
|
305
|
+
## Secrets rotation schedule
|
|
306
|
+
|
|
307
|
+
| Secret | Rotation | Owner |
|
|
308
|
+
|--------|----------|-------|
|
|
309
|
+
| JWT signing key | Every 90 days | Platform team |
|
|
310
|
+
| Database passwords | Every 180 days | Platform team |
|
|
311
|
+
| API keys (third-party) | On staff change | Security team |
|
|
312
|
+
| Deploy tokens | Every 90 days | DevOps |
|
|
313
|
+
|
|
314
|
+
## OWASP Top 10 checklist
|
|
315
|
+
|
|
316
|
+
- [ ] **A01 Broken Access Control** — Enforce authorization on every endpoint; deny by default
|
|
317
|
+
- [ ] **A02 Cryptographic Failures** — Use TLS everywhere; never store plaintext secrets; use bcrypt/argon2 for passwords
|
|
318
|
+
- [ ] **A03 Injection** — Use parameterized queries; validate and sanitize all input
|
|
319
|
+
- [ ] **A04 Insecure Design** — Threat model new features; use principle of least privilege
|
|
320
|
+
- [ ] **A05 Security Misconfiguration** — Harden defaults; disable unused features; set security headers
|
|
321
|
+
- [ ] **A06 Vulnerable Components** — Run \`npm audit\` in CI; automate with Dependabot
|
|
322
|
+
- [ ] **A07 Auth Failures** — Implement MFA; lock accounts after failed attempts; use secure session management
|
|
323
|
+
- [ ] **A08 Software Integrity Failures** — Verify checksums; use lockfiles; pin CI action versions
|
|
324
|
+
- [ ] **A09 Logging Failures** — Log auth events, access failures; never log secrets or PII
|
|
325
|
+
- [ ] **A10 SSRF** — Validate and allowlist URLs for any server-side requests
|
|
326
|
+
|
|
327
|
+
## Security best practices
|
|
328
|
+
|
|
329
|
+
When contributing to this project:
|
|
330
|
+
- Never commit secrets, tokens, or credentials
|
|
331
|
+
- Use environment variables for all sensitive configuration
|
|
332
|
+
- Validate and sanitize all user input
|
|
333
|
+
- Follow the principle of least privilege
|
|
334
|
+
- Keep dependencies up to date
|
|
335
|
+
`},{id:"pr-template",name:"PR Template",description:"Pull request template",defaultPath:".github/pull_request_template.md",category:"github",content:`## Description
|
|
336
|
+
|
|
337
|
+
<!-- Briefly describe the changes and why they were made -->
|
|
338
|
+
|
|
339
|
+
## Type of change
|
|
340
|
+
|
|
341
|
+
- [ ] Bug fix (non-breaking change that fixes an issue)
|
|
342
|
+
- [ ] New feature (non-breaking change that adds functionality)
|
|
343
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
344
|
+
- [ ] Documentation update
|
|
345
|
+
- [ ] Refactor / code cleanup
|
|
346
|
+
- [ ] Dependency update
|
|
347
|
+
|
|
348
|
+
## Related issues
|
|
349
|
+
|
|
350
|
+
Closes #
|
|
351
|
+
|
|
352
|
+
## How to test
|
|
353
|
+
|
|
354
|
+
1.
|
|
355
|
+
2.
|
|
356
|
+
3.
|
|
357
|
+
|
|
358
|
+
## Screenshots / recordings
|
|
359
|
+
|
|
360
|
+
<!-- If applicable, add screenshots or screen recordings -->
|
|
361
|
+
|
|
362
|
+
## Checklist
|
|
363
|
+
|
|
364
|
+
- [ ] My code follows the project's style guidelines
|
|
365
|
+
- [ ] I have performed a self-review of my changes
|
|
366
|
+
- [ ] I have added tests that prove my fix or feature works
|
|
367
|
+
- [ ] New and existing unit tests pass locally
|
|
368
|
+
- [ ] I have updated documentation if needed
|
|
369
|
+
- [ ] No secrets or credentials are included
|
|
370
|
+
`},{id:"bug-report",name:"Bug Report Template",description:"GitHub issue template for bugs",defaultPath:".github/ISSUE_TEMPLATE/bug_report.md",category:"github",content:`---
|
|
371
|
+
name: Bug report
|
|
372
|
+
about: Create a report to help us improve
|
|
373
|
+
labels: bug
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Describe the bug
|
|
377
|
+
|
|
378
|
+
A clear and concise description of what the bug is.
|
|
379
|
+
|
|
380
|
+
## Steps to reproduce
|
|
381
|
+
|
|
382
|
+
1. Go to '...'
|
|
383
|
+
2. Click on '...'
|
|
384
|
+
3. See error
|
|
385
|
+
|
|
386
|
+
## Expected behavior
|
|
387
|
+
|
|
388
|
+
A clear and concise description of what you expected to happen.
|
|
389
|
+
|
|
390
|
+
## Actual behavior
|
|
391
|
+
|
|
392
|
+
What actually happened.
|
|
393
|
+
|
|
394
|
+
## Screenshots
|
|
395
|
+
|
|
396
|
+
If applicable, add screenshots to help explain your problem.
|
|
397
|
+
|
|
398
|
+
## Environment
|
|
399
|
+
|
|
400
|
+
- OS: [e.g. macOS 14]
|
|
401
|
+
- Browser: [e.g. Chrome 120]
|
|
402
|
+
- Version: [e.g. 1.2.3]
|
|
403
|
+
- Node.js: [e.g. 20.x]
|
|
404
|
+
|
|
405
|
+
## Additional context
|
|
406
|
+
|
|
407
|
+
Add any other context about the problem here.
|
|
408
|
+
`},{id:"feature-request",name:"Feature Request Template",description:"GitHub issue template for features",defaultPath:".github/ISSUE_TEMPLATE/feature_request.md",category:"github",content:`---
|
|
409
|
+
name: Feature request
|
|
410
|
+
about: Suggest an idea for this project
|
|
411
|
+
labels: enhancement
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Problem
|
|
415
|
+
|
|
416
|
+
Is your feature request related to a problem? Please describe.
|
|
417
|
+
A clear and concise description of what the problem is.
|
|
418
|
+
|
|
419
|
+
## Proposed solution
|
|
420
|
+
|
|
421
|
+
A clear and concise description of what you want to happen.
|
|
422
|
+
|
|
423
|
+
## Alternatives considered
|
|
424
|
+
|
|
425
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
426
|
+
|
|
427
|
+
## Implementation notes
|
|
428
|
+
|
|
429
|
+
Any thoughts on how this might be implemented?
|
|
430
|
+
|
|
431
|
+
## Additional context
|
|
432
|
+
|
|
433
|
+
Add any other context, mockups, or screenshots about the feature request here.
|
|
434
|
+
`}],s=[{id:"changelog",name:"CHANGELOG.md",description:"Keep a Changelog format",defaultPath:"CHANGELOG.md",category:"process",content:`# Changelog — {{PROJECT_NAME}}
|
|
435
|
+
|
|
436
|
+
All notable changes to this project will be documented in this file.
|
|
437
|
+
|
|
438
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
439
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
440
|
+
|
|
441
|
+
## [Unreleased]
|
|
442
|
+
|
|
443
|
+
### Added
|
|
444
|
+
-
|
|
445
|
+
|
|
446
|
+
### Changed
|
|
447
|
+
-
|
|
448
|
+
|
|
449
|
+
### Fixed
|
|
450
|
+
-
|
|
451
|
+
|
|
452
|
+
### Removed
|
|
453
|
+
-
|
|
454
|
+
|
|
455
|
+
## [1.0.0] — {{DATE}}
|
|
456
|
+
|
|
457
|
+
### Added
|
|
458
|
+
- Initial release
|
|
459
|
+
`},{id:"deployment",name:"DEPLOYMENT.md",description:"Deployment guide and procedures",defaultPath:"DEPLOYMENT.md",category:"process",content:`# Deployment Guide — {{PROJECT_NAME}}
|
|
460
|
+
|
|
461
|
+
**Last updated:** {{DATE}}
|
|
462
|
+
|
|
463
|
+
## Environments
|
|
464
|
+
|
|
465
|
+
| Environment | URL | Branch | Auto-deploy |
|
|
466
|
+
|-------------|-----|--------|-------------|
|
|
467
|
+
| Production | | \`main\` | No |
|
|
468
|
+
| Staging | | \`develop\` | Yes |
|
|
469
|
+
| Preview | | PRs | Yes |
|
|
470
|
+
|
|
471
|
+
## Prerequisites
|
|
472
|
+
|
|
473
|
+
- Access to deployment platform
|
|
474
|
+
- Environment variables configured (see \`.env.example\`)
|
|
475
|
+
- CI/CD pipeline passing
|
|
476
|
+
|
|
477
|
+
## Deploy to production
|
|
478
|
+
|
|
479
|
+
\`\`\`bash
|
|
480
|
+
# 1. Ensure tests pass
|
|
481
|
+
npm test
|
|
482
|
+
|
|
483
|
+
# 2. Build and verify
|
|
484
|
+
npm run build
|
|
485
|
+
|
|
486
|
+
# 3. Merge to main
|
|
487
|
+
git checkout main && git merge develop
|
|
488
|
+
|
|
489
|
+
# 4. Tag the release
|
|
490
|
+
git tag v1.x.x && git push --tags
|
|
491
|
+
\`\`\`
|
|
492
|
+
|
|
493
|
+
## Environment variables
|
|
494
|
+
|
|
495
|
+
| Variable | Required | Description |
|
|
496
|
+
|----------|----------|-------------|
|
|
497
|
+
| | Yes | |
|
|
498
|
+
|
|
499
|
+
## Rollback procedure
|
|
500
|
+
|
|
501
|
+
1. Identify the last stable release tag
|
|
502
|
+
2. \`git checkout <tag>\`
|
|
503
|
+
3. Redeploy the previous version
|
|
504
|
+
4. Verify the rollback with smoke tests
|
|
505
|
+
|
|
506
|
+
## Smoke tests
|
|
507
|
+
|
|
508
|
+
After every deploy, verify:
|
|
509
|
+
- [ ] App loads at production URL
|
|
510
|
+
- [ ] Auth flow works
|
|
511
|
+
- [ ] Core features functional
|
|
512
|
+
- [ ] No error spikes in monitoring
|
|
513
|
+
|
|
514
|
+
## Contacts
|
|
515
|
+
|
|
516
|
+
| Role | Contact |
|
|
517
|
+
|------|---------|
|
|
518
|
+
| On-call | |
|
|
519
|
+
| Release manager | |
|
|
520
|
+
`},{id:"testing",name:"TESTING.md",description:"Testing strategy and guide",defaultPath:"TESTING.md",category:"process",content:`# Testing Guide — {{PROJECT_NAME}}
|
|
521
|
+
|
|
522
|
+
**Last updated:** {{DATE}}
|
|
523
|
+
|
|
524
|
+
## Test pyramid
|
|
525
|
+
|
|
526
|
+
\`\`\`
|
|
527
|
+
/\\
|
|
528
|
+
/E2E\\ 10% — Critical user flows only
|
|
529
|
+
/------\\
|
|
530
|
+
/Integr. \\ 20% — API, DB, service boundaries
|
|
531
|
+
/----------\\
|
|
532
|
+
/ Unit \\ 70% — Functions, logic, utilities
|
|
533
|
+
/______________\\
|
|
534
|
+
\`\`\`
|
|
535
|
+
|
|
536
|
+
## Test strategy
|
|
537
|
+
|
|
538
|
+
| Layer | Type | Tool | Coverage target |
|
|
539
|
+
|-------|------|------|----------------|
|
|
540
|
+
| Unit | Functions/logic | {{TEST_FRAMEWORK}} | 80%+ |
|
|
541
|
+
| Integration | API/DB | {{TEST_FRAMEWORK}} | 70%+ |
|
|
542
|
+
| E2E | User flows | Playwright | Key paths |
|
|
543
|
+
|
|
544
|
+
## Coverage targets by directory
|
|
545
|
+
|
|
546
|
+
| Directory | Target | Rationale |
|
|
547
|
+
|-----------|--------|-----------|
|
|
548
|
+
| \`src/lib/\` | 90%+ | Core business logic |
|
|
549
|
+
| \`src/api/\` | 80%+ | API handlers |
|
|
550
|
+
| \`src/components/\` | 60%+ | UI — focus on logic, not rendering |
|
|
551
|
+
| \`src/utils/\` | 90%+ | Pure utility functions |
|
|
552
|
+
|
|
553
|
+
## Running tests
|
|
554
|
+
|
|
555
|
+
\`\`\`bash
|
|
556
|
+
# Run all tests
|
|
557
|
+
npm test
|
|
558
|
+
|
|
559
|
+
# Run with coverage
|
|
560
|
+
npm run test:coverage
|
|
561
|
+
|
|
562
|
+
# Run E2E tests
|
|
563
|
+
npm run test:e2e
|
|
564
|
+
|
|
565
|
+
# Watch mode
|
|
566
|
+
npm run test:watch
|
|
567
|
+
\`\`\`
|
|
568
|
+
|
|
569
|
+
## Writing tests
|
|
570
|
+
|
|
571
|
+
### Unit test example
|
|
572
|
+
|
|
573
|
+
\`\`\`typescript
|
|
574
|
+
describe('MyFunction', () => {
|
|
575
|
+
it('should return expected value', () => {
|
|
576
|
+
expect(myFunction(input)).toBe(expected)
|
|
577
|
+
})
|
|
578
|
+
})
|
|
579
|
+
\`\`\`
|
|
580
|
+
|
|
581
|
+
### Integration test guidelines
|
|
582
|
+
- Use a real database (not mocks) for DB tests
|
|
583
|
+
- Reset state between tests
|
|
584
|
+
- Test happy path and error cases
|
|
585
|
+
|
|
586
|
+
### E2E test guidelines
|
|
587
|
+
- Cover critical user journeys
|
|
588
|
+
- Use stable selectors (\`data-testid\`)
|
|
589
|
+
- Run against staging environment
|
|
590
|
+
|
|
591
|
+
### Playwright config example
|
|
592
|
+
|
|
593
|
+
\`\`\`typescript
|
|
594
|
+
// playwright.config.ts
|
|
595
|
+
import { defineConfig, devices } from '@playwright/test'
|
|
596
|
+
|
|
597
|
+
export default defineConfig({
|
|
598
|
+
testDir: './e2e',
|
|
599
|
+
fullyParallel: true,
|
|
600
|
+
forbidOnly: !!process.env.CI,
|
|
601
|
+
retries: process.env.CI ? 2 : 0,
|
|
602
|
+
reporter: 'html',
|
|
603
|
+
use: {
|
|
604
|
+
baseURL: process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:3000',
|
|
605
|
+
trace: 'on-first-retry',
|
|
606
|
+
},
|
|
607
|
+
projects: [
|
|
608
|
+
{name: 'chromium', use: {...devices['Desktop Chrome']}},
|
|
609
|
+
{name: 'Mobile Safari', use: {...devices['iPhone 13']}},
|
|
610
|
+
],
|
|
611
|
+
webServer: {
|
|
612
|
+
command: 'npm run dev',
|
|
613
|
+
url: 'http://localhost:3000',
|
|
614
|
+
reuseExistingServer: !process.env.CI,
|
|
615
|
+
},
|
|
616
|
+
})
|
|
617
|
+
\`\`\`
|
|
618
|
+
|
|
619
|
+
## Flaky test policy
|
|
620
|
+
|
|
621
|
+
1. **Quarantine immediately** — tag with \`@flaky\` and skip in CI (\`test.skip\`)
|
|
622
|
+
2. **Create a ticket** — track as a P2 bug with a 2-week SLA to fix
|
|
623
|
+
3. **Root cause** — common causes: timing issues, shared state, network calls
|
|
624
|
+
4. **Fix or delete** — flaky tests are worse than no tests (false confidence)
|
|
625
|
+
|
|
626
|
+
Quarantine example:
|
|
627
|
+
\`\`\`typescript
|
|
628
|
+
test.skip('flaky: timing issue with animation', async ({ page }) => {
|
|
629
|
+
// TODO: fix by waiting for animation end event instead of sleep
|
|
630
|
+
})
|
|
631
|
+
\`\`\`
|
|
632
|
+
|
|
633
|
+
## Test organization
|
|
634
|
+
|
|
635
|
+
\`\`\`
|
|
636
|
+
src/
|
|
637
|
+
__tests__/ # Unit tests
|
|
638
|
+
__integration__/ # Integration tests
|
|
639
|
+
e2e/ # E2E tests
|
|
640
|
+
\`\`\`
|
|
641
|
+
|
|
642
|
+
## CI/CD
|
|
643
|
+
|
|
644
|
+
Tests run automatically on every PR. PRs cannot merge with failing tests.
|
|
645
|
+
`},{id:"glossary",name:"Glossary",description:"Project terminology reference",defaultPath:"docs/glossary.md",category:"process",content:`# Glossary — {{PROJECT_NAME}}
|
|
646
|
+
|
|
647
|
+
**Last updated:** {{DATE}}
|
|
648
|
+
|
|
649
|
+
This document defines terms used throughout the project documentation and codebase.
|
|
650
|
+
|
|
651
|
+
## Terms
|
|
652
|
+
|
|
653
|
+
| Term | Definition |
|
|
654
|
+
|------|------------|
|
|
655
|
+
| | |
|
|
656
|
+
|
|
657
|
+
## Acronyms
|
|
658
|
+
|
|
659
|
+
| Acronym | Full form | Meaning |
|
|
660
|
+
|---------|-----------|---------|
|
|
661
|
+
| | | |
|
|
662
|
+
|
|
663
|
+
## Domain concepts
|
|
664
|
+
|
|
665
|
+
<!-- Add domain-specific concepts here -->
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
*Keep this document updated as new terminology is introduced.*
|
|
670
|
+
`}],r=new Date().toISOString().split("T")[0],a=[...n,...o,...s,{id:"prd",name:"PRD",description:"Product requirements document",defaultPath:"docs/prd.md",category:"technical",content:`# Product Requirements — {{PROJECT_NAME}}
|
|
671
|
+
|
|
672
|
+
**Status:** Draft
|
|
673
|
+
**Last updated:** {{DATE}}
|
|
674
|
+
**Author:**
|
|
675
|
+
**Stakeholders:**
|
|
676
|
+
|
|
677
|
+
## Problem statement
|
|
678
|
+
{{DESCRIPTION}}
|
|
679
|
+
|
|
680
|
+
## Goals
|
|
681
|
+
-
|
|
682
|
+
-
|
|
683
|
+
|
|
684
|
+
## Non-goals
|
|
685
|
+
-
|
|
686
|
+
-
|
|
687
|
+
|
|
688
|
+
## User stories
|
|
689
|
+
| As a... | I want to... | So that... |
|
|
690
|
+
|---------|--------------|------------|
|
|
691
|
+
| user | | |
|
|
692
|
+
|
|
693
|
+
## Requirements
|
|
694
|
+
|
|
695
|
+
### Functional
|
|
696
|
+
{{KEY_FEATURES}}
|
|
697
|
+
|
|
698
|
+
### Non-functional
|
|
699
|
+
- Performance:
|
|
700
|
+
- Security:
|
|
701
|
+
- Reliability:
|
|
702
|
+
- Scalability:
|
|
703
|
+
|
|
704
|
+
## Success metrics
|
|
705
|
+
| Metric | Current | Target |
|
|
706
|
+
|--------|---------|--------|
|
|
707
|
+
| | | |
|
|
708
|
+
|
|
709
|
+
## Timeline
|
|
710
|
+
| Milestone | Target date |
|
|
711
|
+
|-----------|-------------|
|
|
712
|
+
| | |
|
|
713
|
+
|
|
714
|
+
## Open questions
|
|
715
|
+
-
|
|
716
|
+
`},{id:"architecture-overview",name:"Architecture Overview",description:"System architecture doc",defaultPath:"docs/architecture/overview.md",category:"technical",content:`# Architecture Overview — {{PROJECT_NAME}}
|
|
717
|
+
|
|
718
|
+
**Last updated:** {{DATE}}
|
|
719
|
+
|
|
720
|
+
## Summary
|
|
721
|
+
{{DESCRIPTION}}
|
|
722
|
+
|
|
723
|
+
## Tech stack
|
|
724
|
+
{{TECH_STACK}}
|
|
725
|
+
|
|
726
|
+
## System diagram
|
|
727
|
+
|
|
728
|
+
### Context (C4 Level 1)
|
|
729
|
+
|
|
730
|
+
\`\`\`mermaid
|
|
731
|
+
graph TB
|
|
732
|
+
User["User"] --> System["{{PROJECT_NAME}}"]
|
|
733
|
+
System --> ExternalAPI["External APIs"]
|
|
734
|
+
System --> DB["Database"]
|
|
735
|
+
\`\`\`
|
|
736
|
+
|
|
737
|
+
### Container (C4 Level 2)
|
|
738
|
+
|
|
739
|
+
\`\`\`mermaid
|
|
740
|
+
graph TB
|
|
741
|
+
Client["Web Client<br/>(Browser)"] --> API["API Server<br/>(Node.js)"]
|
|
742
|
+
API --> DB["Database<br/>(PostgreSQL)"]
|
|
743
|
+
API --> Cache["Cache<br/>(Redis)"]
|
|
744
|
+
API --> Queue["Job Queue"]
|
|
745
|
+
\`\`\`
|
|
746
|
+
|
|
747
|
+
## Components
|
|
748
|
+
|
|
749
|
+
| Component | Responsibility | Tech |
|
|
750
|
+
|-----------|---------------|------|
|
|
751
|
+
| | | |
|
|
752
|
+
|
|
753
|
+
## Data flow
|
|
754
|
+
|
|
755
|
+
1.
|
|
756
|
+
2.
|
|
757
|
+
3.
|
|
758
|
+
|
|
759
|
+
## Key decisions
|
|
760
|
+
|
|
761
|
+
| Decision | Chosen | Alternative | Rationale |
|
|
762
|
+
|----------|--------|-------------|-----------|
|
|
763
|
+
| | | | |
|
|
764
|
+
|
|
765
|
+
## ADR log
|
|
766
|
+
|
|
767
|
+
| ADR | Title | Status | Date |
|
|
768
|
+
|-----|-------|--------|------|
|
|
769
|
+
| 001 | | Accepted | {{DATE}} |
|
|
770
|
+
|
|
771
|
+
## Non-goals
|
|
772
|
+
|
|
773
|
+
- <!-- What this system explicitly does NOT do -->
|
|
774
|
+
|
|
775
|
+
## Security considerations
|
|
776
|
+
- Authentication:
|
|
777
|
+
- Authorization:
|
|
778
|
+
- Data validation:
|
|
779
|
+
- Secrets management:
|
|
780
|
+
|
|
781
|
+
## Scalability notes
|
|
782
|
+
-
|
|
783
|
+
`},{id:"api-reference",name:"API Reference",description:"API endpoints reference",defaultPath:"docs/api-reference.md",category:"technical",content:`# API Reference — {{PROJECT_NAME}}
|
|
784
|
+
|
|
785
|
+
**Last updated:** {{DATE}}
|
|
786
|
+
|
|
787
|
+
## Base URL
|
|
788
|
+
|
|
789
|
+
\`\`\`
|
|
790
|
+
https://api.example.com/v1
|
|
791
|
+
\`\`\`
|
|
792
|
+
|
|
793
|
+
## Versioning
|
|
794
|
+
|
|
795
|
+
This API uses URL-based versioning (\`/v1/\`, \`/v2/\`, etc.).
|
|
796
|
+
|
|
797
|
+
- The current stable version is \`v1\`.
|
|
798
|
+
- Deprecated versions are supported for 12 months after a new version is released.
|
|
799
|
+
- Breaking changes always increment the major version.
|
|
800
|
+
|
|
801
|
+
## Authentication
|
|
802
|
+
|
|
803
|
+
All requests require a bearer token in the Authorization header:
|
|
804
|
+
|
|
805
|
+
\`\`\`
|
|
806
|
+
Authorization: Bearer <token>
|
|
807
|
+
\`\`\`
|
|
808
|
+
|
|
809
|
+
### Token refresh
|
|
810
|
+
|
|
811
|
+
Tokens expire after 1 hour. Refresh using:
|
|
812
|
+
|
|
813
|
+
\`\`\`
|
|
814
|
+
POST /auth/refresh
|
|
815
|
+
Content-Type: application/json
|
|
816
|
+
|
|
817
|
+
{"refreshToken": "<refresh_token>"}
|
|
818
|
+
\`\`\`
|
|
819
|
+
|
|
820
|
+
**Response:**
|
|
821
|
+
\`\`\`json
|
|
822
|
+
{"accessToken": "...", "refreshToken": "...", "expiresIn": 3600}
|
|
823
|
+
\`\`\`
|
|
824
|
+
|
|
825
|
+
## Rate limiting
|
|
826
|
+
|
|
827
|
+
- **Limit:** 1000 requests/hour per API key
|
|
828
|
+
- **Headers:** \`X-RateLimit-Limit\`, \`X-RateLimit-Remaining\`, \`X-RateLimit-Reset\`
|
|
829
|
+
|
|
830
|
+
## Pagination
|
|
831
|
+
|
|
832
|
+
List endpoints support cursor-based pagination:
|
|
833
|
+
|
|
834
|
+
\`\`\`
|
|
835
|
+
GET /resources?cursor=<cursor>&limit=20
|
|
836
|
+
\`\`\`
|
|
837
|
+
|
|
838
|
+
## Error format
|
|
839
|
+
|
|
840
|
+
All errors follow a standard envelope:
|
|
841
|
+
|
|
842
|
+
\`\`\`json
|
|
843
|
+
{
|
|
844
|
+
"code": "VALIDATION_ERROR",
|
|
845
|
+
"message": "Human-readable description",
|
|
846
|
+
"details": [{"field": "email", "issue": "invalid format"}]
|
|
847
|
+
}
|
|
848
|
+
\`\`\`
|
|
849
|
+
|
|
850
|
+
## Error codes
|
|
851
|
+
|
|
852
|
+
| Code | Meaning |
|
|
853
|
+
|------|---------|
|
|
854
|
+
| 400 | Bad request — invalid parameters |
|
|
855
|
+
| 401 | Unauthorized — missing or invalid token |
|
|
856
|
+
| 403 | Forbidden — insufficient permissions |
|
|
857
|
+
| 404 | Not found |
|
|
858
|
+
| 422 | Unprocessable entity — validation error |
|
|
859
|
+
| 429 | Too many requests |
|
|
860
|
+
| 500 | Internal server error |
|
|
861
|
+
|
|
862
|
+
## Webhooks
|
|
863
|
+
|
|
864
|
+
### Signature verification
|
|
865
|
+
|
|
866
|
+
All webhook payloads are signed with HMAC-SHA256. Verify the signature:
|
|
867
|
+
|
|
868
|
+
\`\`\`
|
|
869
|
+
X-Webhook-Signature: sha256=<hmac_hex>
|
|
870
|
+
\`\`\`
|
|
871
|
+
|
|
872
|
+
\`\`\`typescript
|
|
873
|
+
import crypto from 'crypto'
|
|
874
|
+
|
|
875
|
+
function verifyWebhook(payload: string, signature: string, secret: string): boolean {
|
|
876
|
+
const expected = crypto
|
|
877
|
+
.createHmac('sha256', secret)
|
|
878
|
+
.update(payload)
|
|
879
|
+
.digest('hex')
|
|
880
|
+
return crypto.timingSafeEqual(
|
|
881
|
+
Buffer.from(\`sha256=\${expected}\`),
|
|
882
|
+
Buffer.from(signature)
|
|
883
|
+
)
|
|
884
|
+
}
|
|
885
|
+
\`\`\`
|
|
886
|
+
|
|
887
|
+
## Endpoints
|
|
888
|
+
|
|
889
|
+
### GET /resource
|
|
890
|
+
|
|
891
|
+
**Description:** List resources
|
|
892
|
+
|
|
893
|
+
**Query parameters:**
|
|
894
|
+
- \`limit\` (integer, default 20) — items per page
|
|
895
|
+
- \`cursor\` (string) — pagination cursor
|
|
896
|
+
|
|
897
|
+
**Response:**
|
|
898
|
+
\`\`\`json
|
|
899
|
+
{
|
|
900
|
+
"data": [],
|
|
901
|
+
"cursor": null,
|
|
902
|
+
"total": 0
|
|
903
|
+
}
|
|
904
|
+
\`\`\`
|
|
905
|
+
|
|
906
|
+
### POST /resource
|
|
907
|
+
|
|
908
|
+
**Description:** Create a resource
|
|
909
|
+
|
|
910
|
+
**Request body:**
|
|
911
|
+
\`\`\`json
|
|
912
|
+
{}
|
|
913
|
+
\`\`\`
|
|
914
|
+
|
|
915
|
+
**Response:**
|
|
916
|
+
\`\`\`json
|
|
917
|
+
{}
|
|
918
|
+
\`\`\`
|
|
919
|
+
`},{id:"runbook",name:"Runbook",description:"Operational runbook",defaultPath:"docs/runbook.md",category:"technical",content:`# Runbook — {{PROJECT_NAME}}
|
|
920
|
+
|
|
921
|
+
**Last updated:** {{DATE}}
|
|
922
|
+
|
|
923
|
+
## Overview
|
|
924
|
+
{{DESCRIPTION}}
|
|
925
|
+
|
|
926
|
+
## SLOs
|
|
927
|
+
|
|
928
|
+
| Metric | Target |
|
|
929
|
+
|--------|--------|
|
|
930
|
+
| Availability | 99.9% |
|
|
931
|
+
| P95 latency | < 500ms |
|
|
932
|
+
| Error rate | < 0.1% |
|
|
933
|
+
|
|
934
|
+
## Environments
|
|
935
|
+
|
|
936
|
+
| Env | URL | Purpose |
|
|
937
|
+
|-----|-----|---------|
|
|
938
|
+
| Production | | Live traffic |
|
|
939
|
+
| Staging | | Pre-release testing |
|
|
940
|
+
| Development | | Local dev |
|
|
941
|
+
|
|
942
|
+
## Alerting
|
|
943
|
+
|
|
944
|
+
| Alert | Threshold | Severity | Action |
|
|
945
|
+
|-------|-----------|----------|--------|
|
|
946
|
+
| | | | |
|
|
947
|
+
|
|
948
|
+
## On-call contacts
|
|
949
|
+
|
|
950
|
+
| Role | Name | Contact |
|
|
951
|
+
|------|------|---------|
|
|
952
|
+
| Primary | | |
|
|
953
|
+
| Secondary | | |
|
|
954
|
+
|
|
955
|
+
## Escalation matrix
|
|
956
|
+
|
|
957
|
+
| Time since incident | Contact | Method |
|
|
958
|
+
|--------------------|---------|--------|
|
|
959
|
+
| 0–15 min | On-call engineer | PagerDuty / phone |
|
|
960
|
+
| 15–30 min | Team lead | Slack + phone |
|
|
961
|
+
| 30+ min | Engineering manager | Phone + email |
|
|
962
|
+
|
|
963
|
+
## Procedures
|
|
964
|
+
|
|
965
|
+
### Deploy
|
|
966
|
+
|
|
967
|
+
1.
|
|
968
|
+
2.
|
|
969
|
+
3.
|
|
970
|
+
|
|
971
|
+
### Rollback
|
|
972
|
+
|
|
973
|
+
**When to rollback:**
|
|
974
|
+
|
|
975
|
+
| Signal | Action |
|
|
976
|
+
|--------|--------|
|
|
977
|
+
| Error rate > 1% after deploy | Immediate rollback |
|
|
978
|
+
| P95 latency doubled | Rollback if no fix in 15 min |
|
|
979
|
+
| Health check failing | Immediate rollback |
|
|
980
|
+
| Critical bug reported | Rollback within 30 min |
|
|
981
|
+
|
|
982
|
+
**Rollback steps:**
|
|
983
|
+
|
|
984
|
+
\`\`\`bash
|
|
985
|
+
# 1. Identify last stable release
|
|
986
|
+
git log --oneline --tags --simplify-by-decoration | head -5
|
|
987
|
+
|
|
988
|
+
# 2. Deploy previous version
|
|
989
|
+
git checkout <previous-tag>
|
|
990
|
+
npm run build && npm run deploy
|
|
991
|
+
|
|
992
|
+
# 3. Verify rollback
|
|
993
|
+
curl -f https://your-app.com/health
|
|
994
|
+
\`\`\`
|
|
995
|
+
|
|
996
|
+
### Troubleshooting
|
|
997
|
+
|
|
998
|
+
#### High error rate
|
|
999
|
+
\`\`\`bash
|
|
1000
|
+
# Check recent application logs
|
|
1001
|
+
tail -f /var/log/app/error.log
|
|
1002
|
+
|
|
1003
|
+
# Check error counts by endpoint
|
|
1004
|
+
grep "ERROR" /var/log/app/app.log | awk '{print $5}' | sort | uniq -c | sort -rn | head -10
|
|
1005
|
+
|
|
1006
|
+
# Review recent deploys
|
|
1007
|
+
git log --oneline -10
|
|
1008
|
+
\`\`\`
|
|
1009
|
+
|
|
1010
|
+
1. Check application logs for exception traces
|
|
1011
|
+
2. Check downstream dependencies (database, cache, external APIs)
|
|
1012
|
+
3. Review recent deploys — consider rollback if deploy-correlated
|
|
1013
|
+
|
|
1014
|
+
#### High latency
|
|
1015
|
+
\`\`\`bash
|
|
1016
|
+
# Check database slow query log
|
|
1017
|
+
psql $DATABASE_URL -c "SELECT query, calls, mean_exec_time FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10;"
|
|
1018
|
+
|
|
1019
|
+
# Check cache hit rate
|
|
1020
|
+
redis-cli info stats | grep hit_rate
|
|
1021
|
+
|
|
1022
|
+
# Check CPU/memory
|
|
1023
|
+
top -b -n 1 | head -20
|
|
1024
|
+
\`\`\`
|
|
1025
|
+
|
|
1026
|
+
1. Check database query times (slow query log)
|
|
1027
|
+
2. Check cache hit rates
|
|
1028
|
+
3. Review resource utilization (CPU, memory, connections)
|
|
1029
|
+
|
|
1030
|
+
#### Service won't start
|
|
1031
|
+
\`\`\`bash
|
|
1032
|
+
# Check environment variables
|
|
1033
|
+
env | grep -E "DATABASE|REDIS|PORT"
|
|
1034
|
+
|
|
1035
|
+
# Test database connectivity
|
|
1036
|
+
psql $DATABASE_URL -c "SELECT 1"
|
|
1037
|
+
|
|
1038
|
+
# Check port availability
|
|
1039
|
+
lsof -i :3000
|
|
1040
|
+
\`\`\`
|
|
1041
|
+
|
|
1042
|
+
#### Database connection issues
|
|
1043
|
+
\`\`\`bash
|
|
1044
|
+
# Check connection pool status
|
|
1045
|
+
psql $DATABASE_URL -c "SELECT count(*), state FROM pg_stat_activity GROUP BY state;"
|
|
1046
|
+
|
|
1047
|
+
# Check max connections
|
|
1048
|
+
psql $DATABASE_URL -c "SHOW max_connections;"
|
|
1049
|
+
\`\`\`
|
|
1050
|
+
|
|
1051
|
+
#### Memory leak suspected
|
|
1052
|
+
\`\`\`bash
|
|
1053
|
+
# Monitor memory over time
|
|
1054
|
+
watch -n 5 'ps aux --sort=-%mem | head -5'
|
|
1055
|
+
|
|
1056
|
+
# Capture heap snapshot (Node.js)
|
|
1057
|
+
kill -USR2 <pid>
|
|
1058
|
+
\`\`\`
|
|
1059
|
+
`},{id:"adr",name:"Architecture Decision",description:"Architecture Decision Record",defaultPath:"docs/architecture/decisions/ADR-001.md",category:"technical",content:`# ADR-001: Title
|
|
1060
|
+
|
|
1061
|
+
**Status:** Proposed
|
|
1062
|
+
**Date:** {{DATE}}
|
|
1063
|
+
**Deciders:**
|
|
1064
|
+
|
|
1065
|
+
## Context
|
|
1066
|
+
What is the issue that we're seeing that is motivating this decision or change?
|
|
1067
|
+
|
|
1068
|
+
## Decision
|
|
1069
|
+
What is the change that we're proposing and/or doing?
|
|
1070
|
+
|
|
1071
|
+
## Rationale
|
|
1072
|
+
Why did we choose this option?
|
|
1073
|
+
|
|
1074
|
+
## Alternatives considered
|
|
1075
|
+
- **Option A:** Description — pros/cons
|
|
1076
|
+
- **Option B:** Description — pros/cons
|
|
1077
|
+
|
|
1078
|
+
## Consequences
|
|
1079
|
+
|
|
1080
|
+
### Positive
|
|
1081
|
+
-
|
|
1082
|
+
|
|
1083
|
+
### Negative
|
|
1084
|
+
-
|
|
1085
|
+
|
|
1086
|
+
### Neutral
|
|
1087
|
+
-
|
|
1088
|
+
`},{id:"onboarding",name:"Onboarding Guide",description:"Developer onboarding guide",defaultPath:"docs/onboarding.md",category:"technical",content:`# Developer Onboarding — {{PROJECT_NAME}}
|
|
1089
|
+
|
|
1090
|
+
**Last updated:** {{DATE}}
|
|
1091
|
+
|
|
1092
|
+
## Overview
|
|
1093
|
+
{{DESCRIPTION}}
|
|
1094
|
+
|
|
1095
|
+
## Prerequisites
|
|
1096
|
+
- [ ] Access to repository ({{REPO_URL}})
|
|
1097
|
+
- [ ] Access to staging environment
|
|
1098
|
+
- [ ] Accounts: (list required accounts/services)
|
|
1099
|
+
|
|
1100
|
+
## Day 1: Get running
|
|
1101
|
+
|
|
1102
|
+
- [ ] Clone the repository and set up local environment
|
|
1103
|
+
- [ ] Run the app locally and verify it works
|
|
1104
|
+
- [ ] Read the architecture overview (\`docs/architecture/overview.md\`)
|
|
1105
|
+
- [ ] Meet your team lead and get a tour of the codebase
|
|
1106
|
+
|
|
1107
|
+
\`\`\`bash
|
|
1108
|
+
# Clone
|
|
1109
|
+
git clone {{REPO_URL}}
|
|
1110
|
+
cd {{PROJECT_NAME}}
|
|
1111
|
+
|
|
1112
|
+
# Install dependencies
|
|
1113
|
+
npm install
|
|
1114
|
+
|
|
1115
|
+
# Copy environment variables
|
|
1116
|
+
cp .env.example .env.local
|
|
1117
|
+
# Edit .env.local with real values (ask your team lead)
|
|
1118
|
+
|
|
1119
|
+
# Start development server
|
|
1120
|
+
npm run dev
|
|
1121
|
+
\`\`\`
|
|
1122
|
+
|
|
1123
|
+
## Week 1: Get productive
|
|
1124
|
+
|
|
1125
|
+
- [ ] Complete the environment setup checklist below
|
|
1126
|
+
- [ ] Read \`CONTRIBUTING.md\` and understand the PR process
|
|
1127
|
+
- [ ] Submit your first PR (even a small doc fix counts)
|
|
1128
|
+
- [ ] Attend team standup and sprint planning
|
|
1129
|
+
- [ ] Review 2–3 recent merged PRs to understand code patterns
|
|
1130
|
+
- [ ] Shadow a code review
|
|
1131
|
+
|
|
1132
|
+
## Month 1: Get comfortable
|
|
1133
|
+
|
|
1134
|
+
- [ ] Deliver your first feature end-to-end
|
|
1135
|
+
- [ ] Lead a code review
|
|
1136
|
+
- [ ] Identify one piece of tech debt and create a ticket
|
|
1137
|
+
- [ ] Update this onboarding doc with anything that was unclear
|
|
1138
|
+
|
|
1139
|
+
## Environment setup
|
|
1140
|
+
|
|
1141
|
+
\`\`\`bash
|
|
1142
|
+
# Install dependencies
|
|
1143
|
+
npm install
|
|
1144
|
+
|
|
1145
|
+
# Copy environment variables
|
|
1146
|
+
cp .env.example .env.local
|
|
1147
|
+
|
|
1148
|
+
# Start development server
|
|
1149
|
+
npm run dev
|
|
1150
|
+
\`\`\`
|
|
1151
|
+
|
|
1152
|
+
## Tech stack
|
|
1153
|
+
{{TECH_STACK}}
|
|
1154
|
+
|
|
1155
|
+
## IDE setup
|
|
1156
|
+
- Recommended: VS Code or Cursor
|
|
1157
|
+
- Install recommended extensions (see \`.vscode/extensions.json\`)
|
|
1158
|
+
- Enable format on save
|
|
1159
|
+
|
|
1160
|
+
## Project structure
|
|
1161
|
+
|
|
1162
|
+
\`\`\`
|
|
1163
|
+
(describe key directories here)
|
|
1164
|
+
\`\`\`
|
|
1165
|
+
|
|
1166
|
+
## Key concepts
|
|
1167
|
+
-
|
|
1168
|
+
|
|
1169
|
+
## Common tasks
|
|
1170
|
+
|
|
1171
|
+
### Running tests
|
|
1172
|
+
\`\`\`bash
|
|
1173
|
+
npm test
|
|
1174
|
+
\`\`\`
|
|
1175
|
+
|
|
1176
|
+
### Building for production
|
|
1177
|
+
\`\`\`bash
|
|
1178
|
+
npm run build
|
|
1179
|
+
\`\`\`
|
|
1180
|
+
|
|
1181
|
+
## Common pitfalls
|
|
1182
|
+
|
|
1183
|
+
1. **Forgetting to copy .env.local** — the app won't start without required env vars. Copy from \`.env.example\` and fill in real values.
|
|
1184
|
+
2. **Running \`npm install\` instead of the project's package manager** — check \`package.json\` for the \`packageManager\` field or look for a lock file (\`pnpm-lock.yaml\`, \`yarn.lock\`).
|
|
1185
|
+
3. **Committing to \`main\` directly** — always branch and open a PR. Direct pushes to \`main\` are blocked.
|
|
1186
|
+
4. **Skipping tests** — CI will catch you, but it's faster to run \`npm test\` locally before pushing.
|
|
1187
|
+
5. **Not reading existing patterns** — before adding a new abstraction, search the codebase for how similar problems are solved.
|
|
1188
|
+
|
|
1189
|
+
## Your first PR
|
|
1190
|
+
|
|
1191
|
+
1. Pick a small, well-defined issue labelled \`good first issue\`
|
|
1192
|
+
2. Create a branch: \`git checkout -b feat/your-name-first-pr\`
|
|
1193
|
+
3. Make the change and add a test
|
|
1194
|
+
4. Open a PR with the PR template filled out
|
|
1195
|
+
5. Ask for a review in the team Slack channel
|
|
1196
|
+
|
|
1197
|
+
## Key contacts
|
|
1198
|
+
|
|
1199
|
+
| Role | Name | Contact |
|
|
1200
|
+
|------|------|---------|
|
|
1201
|
+
| | | |
|
|
1202
|
+
|
|
1203
|
+
## Resources
|
|
1204
|
+
- Architecture overview: \`docs/architecture/overview.md\`
|
|
1205
|
+
- API reference: \`docs/api-reference.md\`
|
|
1206
|
+
- Runbook: \`docs/runbook.md\`
|
|
1207
|
+
- Contributing guide: \`CONTRIBUTING.md\`
|
|
1208
|
+
`},{id:"database",name:"Database Docs",description:"Database schema and design reference",defaultPath:"docs/DATABASE.md",category:"technical",content:`# Database Documentation — {{PROJECT_NAME}}
|
|
1209
|
+
|
|
1210
|
+
**Last updated:** {{DATE}}
|
|
1211
|
+
|
|
1212
|
+
## Overview
|
|
1213
|
+
|
|
1214
|
+
<!-- Brief description of the database design -->
|
|
1215
|
+
|
|
1216
|
+
## Entity Relationship Diagram
|
|
1217
|
+
|
|
1218
|
+
\`\`\`mermaid
|
|
1219
|
+
erDiagram
|
|
1220
|
+
USERS {
|
|
1221
|
+
uuid id PK
|
|
1222
|
+
string email
|
|
1223
|
+
timestamp created_at
|
|
1224
|
+
}
|
|
1225
|
+
\`\`\`
|
|
1226
|
+
|
|
1227
|
+
## Tables
|
|
1228
|
+
|
|
1229
|
+
### users
|
|
1230
|
+
|
|
1231
|
+
| Column | Type | Nullable | Description |
|
|
1232
|
+
|--------|------|----------|-------------|
|
|
1233
|
+
| id | uuid | No | Primary key |
|
|
1234
|
+
| email | varchar | No | Unique email |
|
|
1235
|
+
| created_at | timestamp | No | Creation time |
|
|
1236
|
+
|
|
1237
|
+
## Indexes
|
|
1238
|
+
|
|
1239
|
+
| Table | Columns | Type | Purpose |
|
|
1240
|
+
|-------|---------|------|---------|
|
|
1241
|
+
| | | | |
|
|
1242
|
+
|
|
1243
|
+
## Migrations
|
|
1244
|
+
|
|
1245
|
+
Migrations live in \`db/migrations/\`. Run with:
|
|
1246
|
+
|
|
1247
|
+
\`\`\`bash
|
|
1248
|
+
npm run db:migrate
|
|
1249
|
+
\`\`\`
|
|
1250
|
+
|
|
1251
|
+
## Connection
|
|
1252
|
+
|
|
1253
|
+
\`\`\`
|
|
1254
|
+
DATABASE_URL=postgresql://user:password@host:5432/dbname
|
|
1255
|
+
\`\`\`
|
|
1256
|
+
|
|
1257
|
+
## Backup & restore
|
|
1258
|
+
|
|
1259
|
+
\`\`\`bash
|
|
1260
|
+
# Backup
|
|
1261
|
+
pg_dump $DATABASE_URL > backup.sql
|
|
1262
|
+
|
|
1263
|
+
# Restore
|
|
1264
|
+
psql $DATABASE_URL < backup.sql
|
|
1265
|
+
\`\`\`
|
|
1266
|
+
|
|
1267
|
+
## Performance notes
|
|
1268
|
+
|
|
1269
|
+
-
|
|
1270
|
+
`},{id:"openapi",name:"OpenAPI Spec",description:"OpenAPI 3.0 API specification scaffold",defaultPath:"docs/api-spec.yaml",category:"technical",content:`openapi: 3.0.3
|
|
1271
|
+
info:
|
|
1272
|
+
title: {{PROJECT_NAME}} API
|
|
1273
|
+
description: |
|
|
1274
|
+
{{DESCRIPTION}}
|
|
1275
|
+
version: 1.0.0
|
|
1276
|
+
contact:
|
|
1277
|
+
email: team@example.com
|
|
1278
|
+
|
|
1279
|
+
servers:
|
|
1280
|
+
- url: https://api.example.com/v1
|
|
1281
|
+
description: Production
|
|
1282
|
+
- url: https://staging-api.example.com/v1
|
|
1283
|
+
description: Staging
|
|
1284
|
+
|
|
1285
|
+
security:
|
|
1286
|
+
- bearerAuth: []
|
|
1287
|
+
|
|
1288
|
+
paths:
|
|
1289
|
+
/health:
|
|
1290
|
+
get:
|
|
1291
|
+
summary: Health check
|
|
1292
|
+
operationId: healthCheck
|
|
1293
|
+
security: []
|
|
1294
|
+
responses:
|
|
1295
|
+
'200':
|
|
1296
|
+
description: OK
|
|
1297
|
+
content:
|
|
1298
|
+
application/json:
|
|
1299
|
+
schema:
|
|
1300
|
+
type: object
|
|
1301
|
+
properties:
|
|
1302
|
+
status:
|
|
1303
|
+
type: string
|
|
1304
|
+
example: ok
|
|
1305
|
+
|
|
1306
|
+
/resources:
|
|
1307
|
+
get:
|
|
1308
|
+
summary: List resources
|
|
1309
|
+
operationId: listResources
|
|
1310
|
+
parameters:
|
|
1311
|
+
- name: limit
|
|
1312
|
+
in: query
|
|
1313
|
+
schema:
|
|
1314
|
+
type: integer
|
|
1315
|
+
default: 20
|
|
1316
|
+
- name: cursor
|
|
1317
|
+
in: query
|
|
1318
|
+
schema:
|
|
1319
|
+
type: string
|
|
1320
|
+
responses:
|
|
1321
|
+
'200':
|
|
1322
|
+
description: Success
|
|
1323
|
+
content:
|
|
1324
|
+
application/json:
|
|
1325
|
+
schema:
|
|
1326
|
+
$ref: '#/components/schemas/ResourceList'
|
|
1327
|
+
'401':
|
|
1328
|
+
$ref: '#/components/responses/Unauthorized'
|
|
1329
|
+
|
|
1330
|
+
components:
|
|
1331
|
+
securitySchemes:
|
|
1332
|
+
bearerAuth:
|
|
1333
|
+
type: http
|
|
1334
|
+
scheme: bearer
|
|
1335
|
+
bearerFormat: JWT
|
|
1336
|
+
|
|
1337
|
+
schemas:
|
|
1338
|
+
Resource:
|
|
1339
|
+
type: object
|
|
1340
|
+
properties:
|
|
1341
|
+
id:
|
|
1342
|
+
type: string
|
|
1343
|
+
format: uuid
|
|
1344
|
+
createdAt:
|
|
1345
|
+
type: string
|
|
1346
|
+
format: date-time
|
|
1347
|
+
|
|
1348
|
+
ResourceList:
|
|
1349
|
+
type: object
|
|
1350
|
+
properties:
|
|
1351
|
+
data:
|
|
1352
|
+
type: array
|
|
1353
|
+
items:
|
|
1354
|
+
$ref: '#/components/schemas/Resource'
|
|
1355
|
+
cursor:
|
|
1356
|
+
type: string
|
|
1357
|
+
nullable: true
|
|
1358
|
+
total:
|
|
1359
|
+
type: integer
|
|
1360
|
+
|
|
1361
|
+
Error:
|
|
1362
|
+
type: object
|
|
1363
|
+
properties:
|
|
1364
|
+
error:
|
|
1365
|
+
type: string
|
|
1366
|
+
message:
|
|
1367
|
+
type: string
|
|
1368
|
+
|
|
1369
|
+
responses:
|
|
1370
|
+
Unauthorized:
|
|
1371
|
+
description: Unauthorized
|
|
1372
|
+
content:
|
|
1373
|
+
application/json:
|
|
1374
|
+
schema:
|
|
1375
|
+
$ref: '#/components/schemas/Error'
|
|
1376
|
+
`},{id:"meeting-notes",name:"Meeting Notes",description:"Meeting notes template",defaultPath:`docs/meetings/${r}.md`,category:"technical",content:`# Meeting Notes — ${r}
|
|
1377
|
+
|
|
1378
|
+
**Attendees:**
|
|
1379
|
+
**Facilitator:**
|
|
1380
|
+
|
|
1381
|
+
## Agenda
|
|
1382
|
+
|
|
1383
|
+
1.
|
|
1384
|
+
2.
|
|
1385
|
+
|
|
1386
|
+
## Notes
|
|
1387
|
+
|
|
1388
|
+
## Decisions
|
|
1389
|
+
|
|
1390
|
+
## Action items
|
|
1391
|
+
|
|
1392
|
+
| Action | Owner | Due |
|
|
1393
|
+
|--------|-------|-----|
|
|
1394
|
+
| | | |
|
|
1395
|
+
|
|
1396
|
+
## Next meeting
|
|
1397
|
+
`},{id:"blank",name:"Blank Document",description:"Empty markdown file",defaultPath:"docs/untitled.md",category:"technical",content:"# Untitled\n\n"},{id:"dockerfile",name:"Dockerfile",description:"Multi-stage Docker build with health check",defaultPath:"Dockerfile",category:"infrastructure",content:`# Stage 1: Install dependencies
|
|
1398
|
+
FROM node:20-alpine AS deps
|
|
1399
|
+
RUN apk add --no-cache libc6-compat
|
|
1400
|
+
WORKDIR /app
|
|
1401
|
+
COPY package*.json ./
|
|
1402
|
+
RUN npm ci --only=production
|
|
1403
|
+
|
|
1404
|
+
# Stage 2: Build
|
|
1405
|
+
FROM node:20-alpine AS builder
|
|
1406
|
+
WORKDIR /app
|
|
1407
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
1408
|
+
COPY . .
|
|
1409
|
+
RUN npm run build
|
|
1410
|
+
|
|
1411
|
+
# Stage 3: Run
|
|
1412
|
+
FROM node:20-alpine AS runner
|
|
1413
|
+
WORKDIR /app
|
|
1414
|
+
ENV NODE_ENV=production
|
|
1415
|
+
RUN addgroup --system --gid 1001 nodejs
|
|
1416
|
+
RUN adduser --system --uid 1001 appuser
|
|
1417
|
+
COPY --from=builder /app/dist ./dist
|
|
1418
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
1419
|
+
COPY package*.json ./
|
|
1420
|
+
USER appuser
|
|
1421
|
+
EXPOSE 3000
|
|
1422
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
|
|
1423
|
+
CMD wget -qO- http://localhost:3000/health || exit 1
|
|
1424
|
+
CMD ["node", "dist/index.js"]
|
|
1425
|
+
`},{id:"docker-compose",name:"docker-compose.yml",description:"Docker Compose with app, Postgres, and Redis",defaultPath:"docker-compose.yml",category:"infrastructure",content:`# Docker Compose V2+ (no version key needed)
|
|
1426
|
+
services:
|
|
1427
|
+
app:
|
|
1428
|
+
build: .
|
|
1429
|
+
ports:
|
|
1430
|
+
- "3000:3000"
|
|
1431
|
+
environment:
|
|
1432
|
+
DATABASE_URL: postgresql://postgres:password@db:5432/{{PROJECT_NAME}}
|
|
1433
|
+
REDIS_URL: redis://redis:6379
|
|
1434
|
+
depends_on:
|
|
1435
|
+
db:
|
|
1436
|
+
condition: service_healthy
|
|
1437
|
+
redis:
|
|
1438
|
+
condition: service_healthy
|
|
1439
|
+
|
|
1440
|
+
db:
|
|
1441
|
+
image: postgres:16-alpine
|
|
1442
|
+
environment:
|
|
1443
|
+
POSTGRES_PASSWORD: password
|
|
1444
|
+
POSTGRES_DB: {{PROJECT_NAME}}
|
|
1445
|
+
healthcheck:
|
|
1446
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
1447
|
+
interval: 10s
|
|
1448
|
+
timeout: 5s
|
|
1449
|
+
retries: 5
|
|
1450
|
+
volumes:
|
|
1451
|
+
- postgres_data:/var/lib/postgresql/data
|
|
1452
|
+
|
|
1453
|
+
redis:
|
|
1454
|
+
image: redis:7-alpine
|
|
1455
|
+
healthcheck:
|
|
1456
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
1457
|
+
interval: 10s
|
|
1458
|
+
timeout: 5s
|
|
1459
|
+
retries: 5
|
|
1460
|
+
volumes:
|
|
1461
|
+
- redis_data:/data
|
|
1462
|
+
|
|
1463
|
+
volumes:
|
|
1464
|
+
postgres_data:
|
|
1465
|
+
redis_data:
|
|
1466
|
+
`},{id:"dockerignore",name:".dockerignore",description:"Docker build context exclusions",defaultPath:".dockerignore",category:"infrastructure",content:`node_modules
|
|
1467
|
+
npm-debug.log*
|
|
1468
|
+
.git
|
|
1469
|
+
.gitignore
|
|
1470
|
+
.env*
|
|
1471
|
+
!.env.example
|
|
1472
|
+
dist
|
|
1473
|
+
build
|
|
1474
|
+
coverage
|
|
1475
|
+
.nyc_output
|
|
1476
|
+
*.test.*
|
|
1477
|
+
*.spec.*
|
|
1478
|
+
__tests__
|
|
1479
|
+
e2e
|
|
1480
|
+
.github
|
|
1481
|
+
docs
|
|
1482
|
+
README.md
|
|
1483
|
+
CHANGELOG.md
|
|
1484
|
+
`},{id:"makefile",name:"Makefile",description:"Makefile with common dev/build/deploy targets",defaultPath:"Makefile",category:"infrastructure",content:`.PHONY: help dev build test lint docker-up docker-down migrate clean
|
|
1485
|
+
|
|
1486
|
+
help: ## Show this help
|
|
1487
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\\033[36m%-20s\\033[0m %s\\n", $$1, $$2}'
|
|
1488
|
+
|
|
1489
|
+
dev: ## Start development server
|
|
1490
|
+
npm run dev
|
|
1491
|
+
|
|
1492
|
+
build: ## Build for production
|
|
1493
|
+
npm run build
|
|
1494
|
+
|
|
1495
|
+
test: ## Run all tests
|
|
1496
|
+
npm test
|
|
1497
|
+
|
|
1498
|
+
lint: ## Run linter
|
|
1499
|
+
npm run lint
|
|
1500
|
+
|
|
1501
|
+
docker-up: ## Start Docker services
|
|
1502
|
+
docker compose up -d
|
|
1503
|
+
|
|
1504
|
+
docker-down: ## Stop Docker services
|
|
1505
|
+
docker compose down
|
|
1506
|
+
|
|
1507
|
+
migrate: ## Run database migrations
|
|
1508
|
+
npm run db:migrate
|
|
1509
|
+
|
|
1510
|
+
clean: ## Remove build artifacts
|
|
1511
|
+
rm -rf dist build .next coverage node_modules/.cache
|
|
1512
|
+
`},{id:"env-example",name:".env.example",description:"Annotated environment variables template",defaultPath:".env.example",category:"infrastructure",content:`# App Config
|
|
1513
|
+
NODE_ENV=development
|
|
1514
|
+
PORT=3000
|
|
1515
|
+
APP_URL=http://localhost:3000
|
|
1516
|
+
LOG_LEVEL=info
|
|
1517
|
+
|
|
1518
|
+
# Database
|
|
1519
|
+
DATABASE_URL=postgresql://user:password@localhost:5432/{{PROJECT_NAME}}_dev
|
|
1520
|
+
|
|
1521
|
+
# Auth
|
|
1522
|
+
JWT_SECRET=your-super-secret-jwt-key-change-in-production
|
|
1523
|
+
JWT_EXPIRES_IN=7d
|
|
1524
|
+
SESSION_SECRET=your-session-secret-change-in-production
|
|
1525
|
+
|
|
1526
|
+
# External Services
|
|
1527
|
+
# STRIPE_SECRET_KEY=sk_test_...
|
|
1528
|
+
# SENDGRID_API_KEY=SG....
|
|
1529
|
+
# AWS_ACCESS_KEY_ID=
|
|
1530
|
+
# AWS_SECRET_ACCESS_KEY=
|
|
1531
|
+
# AWS_REGION=us-east-1
|
|
1532
|
+
# AWS_S3_BUCKET=
|
|
1533
|
+
|
|
1534
|
+
# Observability
|
|
1535
|
+
# SENTRY_DSN=https://...@sentry.io/...
|
|
1536
|
+
# DATADOG_API_KEY=
|
|
1537
|
+
# NEW_RELIC_LICENSE_KEY=
|
|
1538
|
+
`},{id:"nginx-conf",name:"nginx.conf",description:"Nginx reverse proxy with gzip, security headers, rate limiting",defaultPath:"nginx/nginx.conf",category:"infrastructure",content:`events {
|
|
1539
|
+
worker_connections 1024;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
http {
|
|
1543
|
+
gzip on;
|
|
1544
|
+
gzip_types text/plain text/css application/json application/javascript text/xml;
|
|
1545
|
+
gzip_min_length 1000;
|
|
1546
|
+
|
|
1547
|
+
# Rate limiting
|
|
1548
|
+
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
|
|
1549
|
+
|
|
1550
|
+
server {
|
|
1551
|
+
listen 80;
|
|
1552
|
+
server_name _;
|
|
1553
|
+
|
|
1554
|
+
# Security headers
|
|
1555
|
+
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
1556
|
+
add_header X-Content-Type-Options "nosniff" always;
|
|
1557
|
+
add_header X-XSS-Protection "1; mode=block" always;
|
|
1558
|
+
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
1559
|
+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
1560
|
+
|
|
1561
|
+
location /api/ {
|
|
1562
|
+
limit_req zone=api burst=20 nodelay;
|
|
1563
|
+
proxy_pass http://app:3000;
|
|
1564
|
+
proxy_http_version 1.1;
|
|
1565
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
1566
|
+
proxy_set_header Connection 'upgrade';
|
|
1567
|
+
proxy_set_header Host $host;
|
|
1568
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
1569
|
+
proxy_cache_bypass $http_upgrade;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
location / {
|
|
1573
|
+
proxy_pass http://app:3000;
|
|
1574
|
+
proxy_http_version 1.1;
|
|
1575
|
+
proxy_set_header Host $host;
|
|
1576
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
`},{id:"ci-workflow",name:"CI Workflow",description:"GitHub Actions CI: lint, typecheck, test matrix, coverage",defaultPath:".github/workflows/ci.yml",category:"github-actions",content:`name: CI
|
|
1581
|
+
on:
|
|
1582
|
+
push:
|
|
1583
|
+
branches: [main, develop]
|
|
1584
|
+
pull_request:
|
|
1585
|
+
branches: [main, develop]
|
|
1586
|
+
|
|
1587
|
+
jobs:
|
|
1588
|
+
lint:
|
|
1589
|
+
runs-on: ubuntu-latest
|
|
1590
|
+
steps:
|
|
1591
|
+
- uses: actions/checkout@v4
|
|
1592
|
+
- uses: actions/setup-node@v4
|
|
1593
|
+
with: {node-version: '20', cache: 'npm'}
|
|
1594
|
+
- run: npm ci
|
|
1595
|
+
- run: npm run lint
|
|
1596
|
+
- run: npm run typecheck
|
|
1597
|
+
|
|
1598
|
+
test:
|
|
1599
|
+
runs-on: ubuntu-latest
|
|
1600
|
+
strategy:
|
|
1601
|
+
matrix:
|
|
1602
|
+
node-version: ['20', '22']
|
|
1603
|
+
steps:
|
|
1604
|
+
- uses: actions/checkout@v4
|
|
1605
|
+
- uses: actions/setup-node@v4
|
|
1606
|
+
with: {node-version: '\${{ matrix.node-version }}', cache: 'npm'}
|
|
1607
|
+
- run: npm ci
|
|
1608
|
+
- run: npm run test:coverage
|
|
1609
|
+
- uses: codecov/codecov-action@v4
|
|
1610
|
+
if: matrix.node-version == '20'
|
|
1611
|
+
|
|
1612
|
+
build:
|
|
1613
|
+
runs-on: ubuntu-latest
|
|
1614
|
+
needs: [lint, test]
|
|
1615
|
+
steps:
|
|
1616
|
+
- uses: actions/checkout@v4
|
|
1617
|
+
- uses: actions/setup-node@v4
|
|
1618
|
+
with: {node-version: '20', cache: 'npm'}
|
|
1619
|
+
- run: npm ci
|
|
1620
|
+
- run: npm run build
|
|
1621
|
+
`},{id:"cd-workflow",name:"CD Workflow",description:"GitHub Actions CD: deploy to production with health check",defaultPath:".github/workflows/cd.yml",category:"github-actions",content:`name: CD
|
|
1622
|
+
on:
|
|
1623
|
+
push:
|
|
1624
|
+
branches: [main]
|
|
1625
|
+
|
|
1626
|
+
jobs:
|
|
1627
|
+
deploy:
|
|
1628
|
+
runs-on: ubuntu-latest
|
|
1629
|
+
# needs: [ci] # Uncomment if using a reusable CI workflow
|
|
1630
|
+
environment: production
|
|
1631
|
+
steps:
|
|
1632
|
+
- uses: actions/checkout@v4
|
|
1633
|
+
- uses: actions/setup-node@v4
|
|
1634
|
+
with: {node-version: '20', cache: 'npm'}
|
|
1635
|
+
- run: npm ci
|
|
1636
|
+
- run: npm run build
|
|
1637
|
+
- name: Deploy
|
|
1638
|
+
env:
|
|
1639
|
+
DEPLOY_TOKEN: \${{ secrets.DEPLOY_TOKEN }}
|
|
1640
|
+
DEPLOY_URL: \${{ secrets.DEPLOY_URL }}
|
|
1641
|
+
run: |
|
|
1642
|
+
# Add your deployment command here
|
|
1643
|
+
# e.g.: npx railway deploy, vercel deploy --prod, etc.
|
|
1644
|
+
echo "Deploy to production"
|
|
1645
|
+
- name: Health check
|
|
1646
|
+
run: |
|
|
1647
|
+
sleep 30
|
|
1648
|
+
curl -f \${{ secrets.APP_URL }}/health || exit 1
|
|
1649
|
+
`},{id:"security-scan",name:"Security Scan",description:"GitHub Actions security: npm audit + CodeQL analysis",defaultPath:".github/workflows/security.yml",category:"github-actions",content:`name: Security
|
|
1650
|
+
on:
|
|
1651
|
+
push:
|
|
1652
|
+
branches: [main]
|
|
1653
|
+
schedule:
|
|
1654
|
+
- cron: '0 0 * * 1' # Weekly on Monday
|
|
1655
|
+
|
|
1656
|
+
jobs:
|
|
1657
|
+
audit:
|
|
1658
|
+
runs-on: ubuntu-latest
|
|
1659
|
+
steps:
|
|
1660
|
+
- uses: actions/checkout@v4
|
|
1661
|
+
- uses: actions/setup-node@v4
|
|
1662
|
+
with: {node-version: '20', cache: 'npm'}
|
|
1663
|
+
- run: npm ci
|
|
1664
|
+
- run: npm audit --audit-level=high
|
|
1665
|
+
|
|
1666
|
+
codeql:
|
|
1667
|
+
runs-on: ubuntu-latest
|
|
1668
|
+
permissions:
|
|
1669
|
+
actions: read
|
|
1670
|
+
contents: read
|
|
1671
|
+
security-events: write
|
|
1672
|
+
steps:
|
|
1673
|
+
- uses: actions/checkout@v4
|
|
1674
|
+
- uses: github/codeql-action/init@v3
|
|
1675
|
+
with: {languages: javascript}
|
|
1676
|
+
- uses: github/codeql-action/autobuild@v3
|
|
1677
|
+
- uses: github/codeql-action/analyze@v3
|
|
1678
|
+
`},{id:"dependabot-config",name:"Dependabot Config",description:"Dependabot config: npm + GitHub Actions weekly updates",defaultPath:".github/dependabot.yml",category:"github-actions",content:`version: 2
|
|
1679
|
+
updates:
|
|
1680
|
+
- package-ecosystem: npm
|
|
1681
|
+
directory: "/"
|
|
1682
|
+
schedule:
|
|
1683
|
+
interval: weekly
|
|
1684
|
+
day: monday
|
|
1685
|
+
groups:
|
|
1686
|
+
minor-and-patch:
|
|
1687
|
+
update-types: ["minor", "patch"]
|
|
1688
|
+
ignore:
|
|
1689
|
+
- dependency-name: "*"
|
|
1690
|
+
update-types: ["version-update:semver-major"]
|
|
1691
|
+
|
|
1692
|
+
- package-ecosystem: github-actions
|
|
1693
|
+
directory: "/"
|
|
1694
|
+
schedule:
|
|
1695
|
+
interval: weekly
|
|
1696
|
+
day: monday
|
|
1697
|
+
`},{id:"release-workflow",name:"Release Workflow",description:"GitHub Actions release: GitHub Release + Docker image to GHCR",defaultPath:".github/workflows/release.yml",category:"github-actions",content:`name: Release
|
|
1698
|
+
on:
|
|
1699
|
+
push:
|
|
1700
|
+
tags: ['v*']
|
|
1701
|
+
|
|
1702
|
+
jobs:
|
|
1703
|
+
release:
|
|
1704
|
+
runs-on: ubuntu-latest
|
|
1705
|
+
permissions:
|
|
1706
|
+
contents: write
|
|
1707
|
+
packages: write
|
|
1708
|
+
steps:
|
|
1709
|
+
- uses: actions/checkout@v4
|
|
1710
|
+
- name: Create GitHub Release
|
|
1711
|
+
uses: softprops/action-gh-release@v2
|
|
1712
|
+
with:
|
|
1713
|
+
generate_release_notes: true
|
|
1714
|
+
- name: Log in to GHCR
|
|
1715
|
+
uses: docker/login-action@v3
|
|
1716
|
+
with:
|
|
1717
|
+
registry: ghcr.io
|
|
1718
|
+
username: \${{ github.actor }}
|
|
1719
|
+
password: \${{ secrets.GITHUB_TOKEN }}
|
|
1720
|
+
- name: Build and push Docker image
|
|
1721
|
+
uses: docker/build-push-action@v5
|
|
1722
|
+
with:
|
|
1723
|
+
context: .
|
|
1724
|
+
push: true
|
|
1725
|
+
tags: |
|
|
1726
|
+
ghcr.io/\${{ github.repository }}:\${{ github.ref_name }}
|
|
1727
|
+
ghcr.io/\${{ github.repository }}:latest
|
|
1728
|
+
`},{id:"codeowners",name:"CODEOWNERS",description:"GitHub CODEOWNERS file for review assignments",defaultPath:".github/CODEOWNERS",category:"github",content:`# IMPORTANT: Replace {{PROJECT_NAME}} below with your GitHub organization name
|
|
1729
|
+
# (org name and project name are often different)
|
|
1730
|
+
# Format: @org-name/team-slug
|
|
1731
|
+
|
|
1732
|
+
# Global owners - review all changes
|
|
1733
|
+
* @{{PROJECT_NAME}}/maintainers
|
|
1734
|
+
|
|
1735
|
+
# Documentation
|
|
1736
|
+
docs/ @{{PROJECT_NAME}}/docs
|
|
1737
|
+
*.md @{{PROJECT_NAME}}/docs
|
|
1738
|
+
|
|
1739
|
+
# CI/CD config
|
|
1740
|
+
.github/ @{{PROJECT_NAME}}/devops
|
|
1741
|
+
Dockerfile @{{PROJECT_NAME}}/devops
|
|
1742
|
+
docker-compose*.yml @{{PROJECT_NAME}}/devops
|
|
1743
|
+
|
|
1744
|
+
# Security-sensitive files
|
|
1745
|
+
**/auth/ @{{PROJECT_NAME}}/security
|
|
1746
|
+
**/security/ @{{PROJECT_NAME}}/security
|
|
1747
|
+
SECURITY.md @{{PROJECT_NAME}}/security
|
|
1748
|
+
`},{id:"eslintrc",name:"ESLint Config",description:"ESLint config with TypeScript strict rules",defaultPath:".eslintrc.json",category:"code-quality",content:`{
|
|
1749
|
+
"extends": [
|
|
1750
|
+
"eslint:recommended",
|
|
1751
|
+
"plugin:@typescript-eslint/recommended",
|
|
1752
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
|
1753
|
+
],
|
|
1754
|
+
"parser": "@typescript-eslint/parser",
|
|
1755
|
+
"parserOptions": {
|
|
1756
|
+
"project": true,
|
|
1757
|
+
"tsconfigRootDir": "."
|
|
1758
|
+
},
|
|
1759
|
+
"plugins": ["@typescript-eslint"],
|
|
1760
|
+
"rules": {
|
|
1761
|
+
"no-console": "warn",
|
|
1762
|
+
"no-unused-vars": "off",
|
|
1763
|
+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
|
1764
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
1765
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
1766
|
+
"@typescript-eslint/no-floating-promises": "error"
|
|
1767
|
+
},
|
|
1768
|
+
"ignorePatterns": ["dist/", "build/", "node_modules/", "*.config.js"]
|
|
1769
|
+
}
|
|
1770
|
+
`},{id:"prettierrc",name:"Prettier Config",description:"Prettier formatting config",defaultPath:".prettierrc",category:"code-quality",content:`{
|
|
1771
|
+
"semi": false,
|
|
1772
|
+
"singleQuote": true,
|
|
1773
|
+
"trailingComma": "es5",
|
|
1774
|
+
"printWidth": 100,
|
|
1775
|
+
"tabWidth": 2,
|
|
1776
|
+
"useTabs": false,
|
|
1777
|
+
"bracketSpacing": true,
|
|
1778
|
+
"arrowParens": "avoid"
|
|
1779
|
+
}
|
|
1780
|
+
`},{id:"tsconfig-strict",name:"tsconfig (strict)",description:"TypeScript config with strict settings for Node/ESM",defaultPath:"tsconfig.json",category:"code-quality",content:`{
|
|
1781
|
+
"compilerOptions": {
|
|
1782
|
+
"target": "ES2022",
|
|
1783
|
+
"lib": ["ES2022"],
|
|
1784
|
+
"module": "NodeNext",
|
|
1785
|
+
"moduleResolution": "NodeNext",
|
|
1786
|
+
"outDir": "dist",
|
|
1787
|
+
"rootDir": "src",
|
|
1788
|
+
"strict": true,
|
|
1789
|
+
"noUncheckedIndexedAccess": true,
|
|
1790
|
+
"exactOptionalPropertyTypes": true,
|
|
1791
|
+
"noImplicitReturns": true,
|
|
1792
|
+
"noFallthroughCasesInSwitch": true,
|
|
1793
|
+
"noImplicitOverride": true,
|
|
1794
|
+
"esModuleInterop": true,
|
|
1795
|
+
"skipLibCheck": true,
|
|
1796
|
+
"forceConsistentCasingInFileNames": true,
|
|
1797
|
+
"paths": {
|
|
1798
|
+
"@/*": ["./src/*"]
|
|
1799
|
+
}
|
|
1800
|
+
},
|
|
1801
|
+
"include": ["src/**/*"],
|
|
1802
|
+
"exclude": ["node_modules", "dist"]
|
|
1803
|
+
}
|
|
1804
|
+
`},{id:"editorconfig",name:".editorconfig",description:"EditorConfig for consistent editor settings",defaultPath:".editorconfig",category:"code-quality",content:`root = true
|
|
1805
|
+
|
|
1806
|
+
[*]
|
|
1807
|
+
indent_style = space
|
|
1808
|
+
indent_size = 2
|
|
1809
|
+
end_of_line = lf
|
|
1810
|
+
charset = utf-8
|
|
1811
|
+
trim_trailing_whitespace = true
|
|
1812
|
+
insert_final_newline = true
|
|
1813
|
+
|
|
1814
|
+
[*.md]
|
|
1815
|
+
trim_trailing_whitespace = false
|
|
1816
|
+
|
|
1817
|
+
[Makefile]
|
|
1818
|
+
indent_style = tab
|
|
1819
|
+
|
|
1820
|
+
[*.{yml,yaml}]
|
|
1821
|
+
indent_size = 2
|
|
1822
|
+
`},{id:"lint-staged",name:"lint-staged Config",description:"lint-staged config for pre-commit formatting and linting",defaultPath:".lintstagedrc.json",category:"code-quality",content:`{
|
|
1823
|
+
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
|
|
1824
|
+
"*.{js,jsx}": ["eslint --fix", "prettier --write"],
|
|
1825
|
+
"*.{json,md,yml,yaml}": ["prettier --write"],
|
|
1826
|
+
"*.{css,scss}": ["prettier --write"]
|
|
1827
|
+
}
|
|
1828
|
+
`},{id:"commitlint",name:"commitlint Config",description:"commitlint config enforcing Conventional Commits",defaultPath:"commitlint.config.js",category:"code-quality",content:`module.exports = {
|
|
1829
|
+
extends: ['@commitlint/config-conventional'],
|
|
1830
|
+
rules: {
|
|
1831
|
+
'type-enum': [2, 'always', [
|
|
1832
|
+
'feat', 'fix', 'docs', 'style', 'refactor',
|
|
1833
|
+
'perf', 'test', 'chore', 'revert', 'ci', 'build'
|
|
1834
|
+
]],
|
|
1835
|
+
'scope-case': [2, 'always', 'lower-case'],
|
|
1836
|
+
'subject-case': [2, 'always', 'lower-case'],
|
|
1837
|
+
'subject-max-length': [2, 'always', 100],
|
|
1838
|
+
'body-max-line-length': [2, 'always', 200],
|
|
1839
|
+
},
|
|
1840
|
+
}
|
|
1841
|
+
`},{id:"husky-setup",name:"Husky Setup Doc",description:"Documentation for Husky git hooks setup",defaultPath:".husky/README.md",category:"code-quality",content:`# Husky Git Hooks
|
|
1842
|
+
|
|
1843
|
+
This project uses [Husky](https://typicode.github.io/husky/) to enforce code quality at commit time.
|
|
1844
|
+
|
|
1845
|
+
## Setup
|
|
1846
|
+
|
|
1847
|
+
After cloning and running \`npm install\`, Husky hooks are auto-installed via the \`prepare\` script.
|
|
1848
|
+
|
|
1849
|
+
If hooks aren't running, install manually:
|
|
1850
|
+
|
|
1851
|
+
\`\`\`
|
|
1852
|
+
npx husky install
|
|
1853
|
+
\`\`\`
|
|
1854
|
+
|
|
1855
|
+
## Hooks
|
|
1856
|
+
|
|
1857
|
+
| Hook | Command | Purpose |
|
|
1858
|
+
|------|---------|---------|
|
|
1859
|
+
| pre-commit | \`lint-staged\` | Lint and format staged files |
|
|
1860
|
+
| commit-msg | \`commitlint\` | Validate commit message format |
|
|
1861
|
+
| pre-push | \`npm test\` | Run tests before pushing |
|
|
1862
|
+
|
|
1863
|
+
## Skip hooks (emergencies only)
|
|
1864
|
+
|
|
1865
|
+
\`\`\`
|
|
1866
|
+
git commit --no-verify -m "emergency fix"
|
|
1867
|
+
\`\`\`
|
|
1868
|
+
|
|
1869
|
+
Use sparingly. CI will still catch failures.
|
|
1870
|
+
`},{id:"vscode-settings",name:"VS Code Settings",description:"VS Code workspace settings for the project",defaultPath:".vscode/settings.json",category:"code-quality",content:`{
|
|
1871
|
+
"editor.formatOnSave": true,
|
|
1872
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
1873
|
+
"editor.codeActionsOnSave": {
|
|
1874
|
+
"source.fixAll.eslint": "explicit",
|
|
1875
|
+
"source.organizeImports": "explicit"
|
|
1876
|
+
},
|
|
1877
|
+
"typescript.preferences.importModuleSpecifier": "non-relative",
|
|
1878
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
1879
|
+
"files.eol": "\\n",
|
|
1880
|
+
"files.trimTrailingWhitespace": true,
|
|
1881
|
+
"files.insertFinalNewline": true,
|
|
1882
|
+
"[markdown]": {
|
|
1883
|
+
"editor.formatOnSave": false
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
`},{id:"vscode-extensions",name:"VS Code Extensions",description:"Recommended VS Code extensions for the project",defaultPath:".vscode/extensions.json",category:"code-quality",content:`{
|
|
1887
|
+
"recommendations": [
|
|
1888
|
+
"esbenp.prettier-vscode",
|
|
1889
|
+
"dbaeumer.vscode-eslint",
|
|
1890
|
+
"ms-vscode.vscode-typescript-next",
|
|
1891
|
+
"bradlc.vscode-tailwindcss",
|
|
1892
|
+
"eamodio.gitlens",
|
|
1893
|
+
"usernamehw.errorlens",
|
|
1894
|
+
"streetsidesoftware.code-spell-checker",
|
|
1895
|
+
"github.copilot",
|
|
1896
|
+
"christian-kohler.path-intellisense"
|
|
1897
|
+
]
|
|
1898
|
+
}
|
|
1899
|
+
`},{id:"health-check-doc",name:"Health Check Guide",description:"Health check endpoint documentation with Kubernetes config",defaultPath:"docs/health-checks.md",category:"monitoring",content:`# Health Checks — {{PROJECT_NAME}}
|
|
1900
|
+
|
|
1901
|
+
**Last updated:** {{DATE}}
|
|
1902
|
+
|
|
1903
|
+
## Overview
|
|
1904
|
+
|
|
1905
|
+
Health check endpoints allow load balancers and orchestrators to verify service status.
|
|
1906
|
+
|
|
1907
|
+
## Endpoints
|
|
1908
|
+
|
|
1909
|
+
| Endpoint | Purpose | Auth required |
|
|
1910
|
+
|----------|---------|---------------|
|
|
1911
|
+
| \`GET /health\` | Liveness probe — is the process running? | No |
|
|
1912
|
+
| \`GET /health/ready\` | Readiness probe — can the service handle traffic? | No |
|
|
1913
|
+
| \`GET /health/detailed\` | Full dependency status | Yes (internal) |
|
|
1914
|
+
|
|
1915
|
+
## Liveness Check (\`GET /health\`)
|
|
1916
|
+
|
|
1917
|
+
Returns 200 if the process is alive, regardless of dependency status.
|
|
1918
|
+
|
|
1919
|
+
\`\`\`json
|
|
1920
|
+
{"status": "ok", "uptime": 1234}
|
|
1921
|
+
\`\`\`
|
|
1922
|
+
|
|
1923
|
+
## Readiness Check (\`GET /health/ready\`)
|
|
1924
|
+
|
|
1925
|
+
Returns 200 only if all critical dependencies are healthy.
|
|
1926
|
+
|
|
1927
|
+
\`\`\`json
|
|
1928
|
+
{
|
|
1929
|
+
"status": "ready",
|
|
1930
|
+
"dependencies": {
|
|
1931
|
+
"database": "ok",
|
|
1932
|
+
"redis": "ok",
|
|
1933
|
+
"external_api": "degraded"
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
\`\`\`
|
|
1937
|
+
|
|
1938
|
+
Returns 503 if any critical dependency is unhealthy.
|
|
1939
|
+
|
|
1940
|
+
## Kubernetes Configuration
|
|
1941
|
+
|
|
1942
|
+
\`\`\`yaml
|
|
1943
|
+
livenessProbe:
|
|
1944
|
+
httpGet:
|
|
1945
|
+
path: /health
|
|
1946
|
+
port: 3000
|
|
1947
|
+
initialDelaySeconds: 30
|
|
1948
|
+
periodSeconds: 10
|
|
1949
|
+
readinessProbe:
|
|
1950
|
+
httpGet:
|
|
1951
|
+
path: /health/ready
|
|
1952
|
+
port: 3000
|
|
1953
|
+
initialDelaySeconds: 5
|
|
1954
|
+
periodSeconds: 5
|
|
1955
|
+
\`\`\`
|
|
1956
|
+
`},{id:"slo-doc",name:"SLO/SLA Document",description:"Service Level Objectives with error budget and burn rate alerts",defaultPath:"docs/slo.md",category:"monitoring",content:`# Service Level Objectives — {{PROJECT_NAME}}
|
|
1957
|
+
|
|
1958
|
+
**Last updated:** {{DATE}}
|
|
1959
|
+
**Owner:** Platform Team
|
|
1960
|
+
|
|
1961
|
+
## Availability SLO
|
|
1962
|
+
|
|
1963
|
+
| Metric | Target | Error Budget (30 days) |
|
|
1964
|
+
|--------|--------|----------------------|
|
|
1965
|
+
| Availability | 99.9% | 43.8 minutes |
|
|
1966
|
+
| Success rate | 99.5% | — |
|
|
1967
|
+
|
|
1968
|
+
## Latency SLO
|
|
1969
|
+
|
|
1970
|
+
| Percentile | Target |
|
|
1971
|
+
|------------|--------|
|
|
1972
|
+
| p50 | < 100ms |
|
|
1973
|
+
| p95 | < 500ms |
|
|
1974
|
+
| p99 | < 1000ms |
|
|
1975
|
+
|
|
1976
|
+
## Error Budget Policy
|
|
1977
|
+
|
|
1978
|
+
| Burn Rate | Alert Window | Severity | Action |
|
|
1979
|
+
|-----------|-------------|----------|--------|
|
|
1980
|
+
| > 14.4x | 1 hour | Critical | Page on-call immediately |
|
|
1981
|
+
| > 6x | 6 hours | High | Page on-call |
|
|
1982
|
+
| > 3x | 24 hours | Medium | Ticket + monitor |
|
|
1983
|
+
| > 1x | 72 hours | Low | Review in standup |
|
|
1984
|
+
|
|
1985
|
+
## Consequences of Exhausting Error Budget
|
|
1986
|
+
|
|
1987
|
+
- Feature freeze until budget replenishes
|
|
1988
|
+
- Reliability sprint prioritized over new features
|
|
1989
|
+
- Post-mortem required for any budget burn > 50%
|
|
1990
|
+
|
|
1991
|
+
## Measurement
|
|
1992
|
+
|
|
1993
|
+
- Uptime tracked via synthetic monitoring (Pingdom / UptimeRobot)
|
|
1994
|
+
- Latency tracked via APM (Datadog / New Relic)
|
|
1995
|
+
- Error rate from application logs + Sentry
|
|
1996
|
+
`},{id:"incident-runbook",name:"Incident Runbook",description:"Incident response runbook with severity levels and escalation",defaultPath:"docs/incident-runbook.md",category:"monitoring",content:`# Incident Runbook — {{PROJECT_NAME}}
|
|
1997
|
+
|
|
1998
|
+
**Last updated:** {{DATE}}
|
|
1999
|
+
|
|
2000
|
+
## Severity Levels
|
|
2001
|
+
|
|
2002
|
+
| Severity | Definition | Response Time | Example |
|
|
2003
|
+
|----------|-----------|---------------|---------|
|
|
2004
|
+
| P0 | Complete outage, all users affected | 15 minutes | Site down |
|
|
2005
|
+
| P1 | Major feature broken, >50% users affected | 30 minutes | Login broken |
|
|
2006
|
+
| P2 | Significant degradation, subset of users | 2 hours | Slow API |
|
|
2007
|
+
| P3 | Minor issue, workaround available | Next business day | Cosmetic bug |
|
|
2008
|
+
|
|
2009
|
+
## Roles
|
|
2010
|
+
|
|
2011
|
+
| Role | Responsibility |
|
|
2012
|
+
|------|---------------|
|
|
2013
|
+
| Incident Commander (IC) | Owns resolution, coordinates team, communicates status |
|
|
2014
|
+
| Tech Lead | Diagnoses root cause, coordinates fixes |
|
|
2015
|
+
| Comms Lead | Updates status page, notifies stakeholders |
|
|
2016
|
+
|
|
2017
|
+
## Response Process
|
|
2018
|
+
|
|
2019
|
+
### 0–15 minutes (Detect & Triage)
|
|
2020
|
+
1. Confirm the incident (not a false alarm)
|
|
2021
|
+
2. Assign Incident Commander
|
|
2022
|
+
3. Create incident Slack channel: \`#incident-YYYYMMDD-description\`
|
|
2023
|
+
4. Set severity level
|
|
2024
|
+
5. Start incident timeline document
|
|
2025
|
+
|
|
2026
|
+
### 15–60 minutes (Investigate)
|
|
2027
|
+
1. Identify scope: what's broken, who's affected
|
|
2028
|
+
2. Check recent deployments (\`git log\`, deployment history)
|
|
2029
|
+
3. Review error rates and logs
|
|
2030
|
+
4. Consider rollback if recent deploy is suspected
|
|
2031
|
+
|
|
2032
|
+
### Mitigation
|
|
2033
|
+
1. Apply fix or rollback
|
|
2034
|
+
2. Monitor for improvement
|
|
2035
|
+
3. Update status page
|
|
2036
|
+
4. Notify stakeholders
|
|
2037
|
+
|
|
2038
|
+
## Post-Incident Checklist
|
|
2039
|
+
|
|
2040
|
+
- [ ] Incident resolved and verified
|
|
2041
|
+
- [ ] Status page updated to "resolved"
|
|
2042
|
+
- [ ] Stakeholders notified
|
|
2043
|
+
- [ ] Timeline documented
|
|
2044
|
+
- [ ] Post-mortem scheduled (P0/P1) or ticket created (P2)
|
|
2045
|
+
- [ ] Action items created in project tracker
|
|
2046
|
+
`},{id:"postmortem",name:"Postmortem Template",description:"Blameless postmortem template with five-whys and action items",defaultPath:"docs/postmortem-template.md",category:"monitoring",content:`# Postmortem: [Title]
|
|
2047
|
+
|
|
2048
|
+
**Date:** {{DATE}}
|
|
2049
|
+
**Severity:** P[0-3]
|
|
2050
|
+
**Duration:**
|
|
2051
|
+
**Author:**
|
|
2052
|
+
**Reviewers:**
|
|
2053
|
+
|
|
2054
|
+
> This postmortem follows a blameless culture. We focus on systems and processes, not individuals.
|
|
2055
|
+
|
|
2056
|
+
## Summary
|
|
2057
|
+
|
|
2058
|
+
<!-- 2-3 sentence summary: what happened, why it matters, what we're doing about it -->
|
|
2059
|
+
|
|
2060
|
+
## Impact
|
|
2061
|
+
|
|
2062
|
+
- **Users affected:**
|
|
2063
|
+
- **Duration:**
|
|
2064
|
+
- **Revenue impact:**
|
|
2065
|
+
- **Data loss:**
|
|
2066
|
+
|
|
2067
|
+
## Timeline
|
|
2068
|
+
|
|
2069
|
+
| Time (UTC) | Event |
|
|
2070
|
+
|------------|-------|
|
|
2071
|
+
| 00:00 | Monitoring alert fired |
|
|
2072
|
+
| 00:05 | On-call engineer paged |
|
|
2073
|
+
| 00:15 | Incident confirmed, IC assigned |
|
|
2074
|
+
| 00:30 | Root cause identified |
|
|
2075
|
+
| 01:00 | Fix deployed |
|
|
2076
|
+
| 01:15 | Incident resolved |
|
|
2077
|
+
|
|
2078
|
+
## Root Cause Analysis (Five Whys)
|
|
2079
|
+
|
|
2080
|
+
**Problem:** [Describe the issue]
|
|
2081
|
+
|
|
2082
|
+
1. **Why?** [First cause]
|
|
2083
|
+
2. **Why?** [Second cause]
|
|
2084
|
+
3. **Why?** [Third cause]
|
|
2085
|
+
4. **Why?** [Fourth cause]
|
|
2086
|
+
5. **Why?** [Root cause]
|
|
2087
|
+
|
|
2088
|
+
## What Went Well
|
|
2089
|
+
|
|
2090
|
+
-
|
|
2091
|
+
-
|
|
2092
|
+
|
|
2093
|
+
## What Could Have Gone Better
|
|
2094
|
+
|
|
2095
|
+
-
|
|
2096
|
+
-
|
|
2097
|
+
|
|
2098
|
+
## Action Items
|
|
2099
|
+
|
|
2100
|
+
| Action | Owner | Due Date | Priority |
|
|
2101
|
+
|--------|-------|----------|----------|
|
|
2102
|
+
| | | | P[0-3] |
|
|
2103
|
+
|
|
2104
|
+
## Lessons Learned
|
|
2105
|
+
|
|
2106
|
+
<!-- Key takeaways to share with the wider team -->
|
|
2107
|
+
`}]}};
|