vibes-plug 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  2. package/BLUEPRINT.md +125 -0
  3. package/CHANGELOG.md +195 -0
  4. package/CONTRIBUTING.md +199 -0
  5. package/LICENSE +21 -0
  6. package/README.md +263 -0
  7. package/SECURITY.md +21 -0
  8. package/banner.png +0 -0
  9. package/package.json +25 -0
  10. package/plugin.json +8 -0
  11. package/scripts/update_skills.js +75 -0
  12. package/skills/ai-llm-integration-expert/SKILL.md +162 -0
  13. package/skills/api-design-expert/SKILL.md +310 -0
  14. package/skills/app-analyzer-optimizer/SKILL.md +189 -0
  15. package/skills/asisten_ramah/SKILL.md +41 -0
  16. package/skills/authentication-identity-expert/SKILL.md +45 -0
  17. package/skills/auto-doc-updater/SKILL.md +204 -0
  18. package/skills/bootstrap-to-modern/SKILL.md +87 -0
  19. package/skills/brainstorming/SKILL.md +353 -0
  20. package/skills/bun-runtime-expert/SKILL.md +211 -0
  21. package/skills/ci-cd-devops-architect/SKILL.md +45 -0
  22. package/skills/cloud-hosting-expert/SKILL.md +244 -0
  23. package/skills/coderabbit/SKILL.md +192 -0
  24. package/skills/data-telemetry-expert/SKILL.md +213 -0
  25. package/skills/database-orm-expert/SKILL.md +294 -0
  26. package/skills/design-system-architect/SKILL.md +243 -0
  27. package/skills/e2e-testing-expert/SKILL.md +315 -0
  28. package/skills/event-driven-architect/SKILL.md +81 -0
  29. package/skills/firebase-security-expert/SKILL.md +195 -0
  30. package/skills/fullstack-expert/SKILL.md +202 -0
  31. package/skills/fullstack-expert/references/api_design_guide.md +466 -0
  32. package/skills/fullstack-expert/references/devops_infrastructure.md +477 -0
  33. package/skills/fullstack-expert/references/multi_language_backend.md +528 -0
  34. package/skills/fullstack-expert/references/system_design_patterns.md +358 -0
  35. package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -0
  36. package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -0
  37. package/skills/gemini-agent-booster/SKILL.md +135 -0
  38. package/skills/global-a11y-i18n-expert/SKILL.md +81 -0
  39. package/skills/go-programming-expert/SKILL.md +295 -0
  40. package/skills/hig/SKILL.md +188 -0
  41. package/skills/js-backend-expert/SKILL.md +192 -0
  42. package/skills/mcp-server-architect/SKILL.md +194 -0
  43. package/skills/mobile-expo-expert/SKILL.md +186 -0
  44. package/skills/monday-design-aesthetic/SKILL.md +67 -0
  45. package/skills/monorepo-architect/SKILL.md +227 -0
  46. package/skills/mpa-orchestrator/SKILL.md +101 -0
  47. package/skills/multi-agent-orchestration/SKILL.md +234 -0
  48. package/skills/multiple-entry-points/SKILL.md +55 -0
  49. package/skills/mvc-expert/SKILL.md +231 -0
  50. package/skills/payment-gateway-expert/SKILL.md +45 -0
  51. package/skills/performance-web-vitals/SKILL.md +332 -0
  52. package/skills/prd-architect/SKILL.md +191 -0
  53. package/skills/production-ready-hardener/SKILL.md +469 -0
  54. package/skills/production-ready-hardener/references/performance_optimization.md +441 -0
  55. package/skills/production-ready-hardener/references/production_checklist.md +161 -0
  56. package/skills/production-ready-hardener/references/security_hardening_guide.md +379 -0
  57. package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +875 -0
  58. package/skills/python-programming-expert/SKILL.md +271 -0
  59. package/skills/realtime-collaboration-expert/SKILL.md +45 -0
  60. package/skills/rust-programming-expert/SKILL.md +235 -0
  61. package/skills/saas-billing/SKILL.md +377 -0
  62. package/skills/saas-multi-tenant/SKILL.md +237 -0
  63. package/skills/saas-mvp-launcher/SKILL.md +231 -0
  64. package/skills/saas-transformer/SKILL.md +446 -0
  65. package/skills/saas-transformer/references/billing_integration_guide.md +401 -0
  66. package/skills/saas-transformer/references/feature_gating_patterns.md +137 -0
  67. package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -0
  68. package/skills/saas-transformer/scripts/saas_transformation_scanner.py +254 -0
  69. package/skills/scalability-clean-code/SKILL.md +229 -0
  70. package/skills/secure-fuzz-testing/SKILL.md +201 -0
  71. package/skills/senior-frontend/SKILL.md +161 -0
  72. package/skills/senior-frontend/references/frontend_best_practices.md +806 -0
  73. package/skills/senior-frontend/references/nextjs_optimization_guide.md +724 -0
  74. package/skills/senior-frontend/references/react_patterns.md +746 -0
  75. package/skills/senior-frontend/scripts/bundle_analyzer.py +407 -0
  76. package/skills/senior-frontend/scripts/component_generator.py +329 -0
  77. package/skills/senior-frontend/scripts/frontend_scaffolder.py +1005 -0
  78. package/skills/senior-fullstack/SKILL.md +167 -0
  79. package/skills/senior-fullstack/references/architecture_patterns.md +160 -0
  80. package/skills/senior-fullstack/references/development_workflows.md +222 -0
  81. package/skills/senior-fullstack/references/tech_stack_guide.md +190 -0
  82. package/skills/senior-fullstack/scripts/code_quality_analyzer.py +114 -0
  83. package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +114 -0
  84. package/skills/senior-fullstack/scripts/project_scaffolder.py +114 -0
  85. package/skills/seo/SKILL.md +225 -0
  86. package/skills/seo/references/cwv-thresholds.md +108 -0
  87. package/skills/seo/references/eeat-framework.md +214 -0
  88. package/skills/seo/references/quality-gates.md +155 -0
  89. package/skills/seo/references/schema-types.md +118 -0
  90. package/skills/seo-aeo-landing-page-writer/SKILL.md +97 -0
  91. package/skills/seo-geo/SKILL.md +188 -0
  92. package/skills/session-handoff-resume/SKILL.md +158 -0
  93. package/skills/skill_baru/SKILL.md +147 -0
  94. package/skills/spa-orchestrator/SKILL.md +288 -0
  95. package/skills/state-management-expert/SKILL.md +272 -0
  96. package/skills/supabase-migration/SKILL.md +45 -0
  97. package/skills/supabase-security-expert/SKILL.md +243 -0
  98. package/skills/tailwind-expert/SKILL.md +188 -0
  99. package/skills/tanstack-query-expert/SKILL.md +199 -0
  100. package/skills/tauri-expert/SKILL.md +97 -0
  101. package/skills/token-saver/SKILL.md +111 -0
  102. package/skills/typescript-expert/SKILL.md +279 -0
  103. package/skills/ui-components-expert/SKILL.md +63 -0
  104. package/skills/ui-ux-pro-max/SKILL.md +201 -0
  105. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  106. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  107. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  108. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  109. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  110. package/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  111. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  112. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  113. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  114. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  115. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  116. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  117. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  118. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  119. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  120. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  121. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  122. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  123. package/skills/ui-ux-pro-max/data/styles.csv +59 -0
  124. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  125. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  126. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  127. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  128. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  129. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  130. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  131. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  132. package/skills/ui-ux-pro-max/scripts/core.py +257 -0
  133. package/skills/ui-ux-pro-max/scripts/design_system.py +493 -0
  134. package/skills/ui-ux-pro-max/scripts/search.py +81 -0
  135. package/skills/ui_ux_expert/SKILL.md +114 -0
  136. package/skills/vibe-code-gardener/SKILL.md +173 -0
  137. package/skills/web-scraper/SKILL.md +205 -0
  138. package/skills/web-scraper/references/data-transforms.md +397 -0
  139. package/skills/web-scraper/references/extraction-patterns.md +475 -0
  140. package/skills/web-scraper/references/output-templates.md +481 -0
  141. package/skills/zero-to-prod-orchestrator/SKILL.md +180 -0
@@ -0,0 +1,477 @@
1
+ # DevOps & Infrastructure
2
+
3
+ ## Overview
4
+ This reference documents production-grade DevOps patterns covering Docker, Kubernetes, CI/CD pipelines, Infrastructure as Code, and observability setup.
5
+
6
+ ---
7
+
8
+ ## 1. Docker Best Practices
9
+
10
+ ### Multi-Stage Build (Node.js / Next.js)
11
+
12
+ ```dockerfile
13
+ # Stage 1: Dependencies
14
+ FROM node:22-alpine AS deps
15
+ WORKDIR /app
16
+ COPY package.json package-lock.json ./
17
+ RUN npm ci --ignore-scripts
18
+
19
+ # Stage 2: Build
20
+ FROM node:22-alpine AS builder
21
+ WORKDIR /app
22
+ COPY --from=deps /app/node_modules ./node_modules
23
+ COPY . .
24
+ ENV NEXT_TELEMETRY_DISABLED=1
25
+ RUN npm run build
26
+
27
+ # Stage 3: Production Runner
28
+ FROM node:22-alpine AS runner
29
+ WORKDIR /app
30
+ ENV NODE_ENV=production
31
+ ENV NEXT_TELEMETRY_DISABLED=1
32
+
33
+ # Create non-root user
34
+ RUN addgroup --system --gid 1001 nodejs \
35
+ && adduser --system --uid 1001 nextjs
36
+
37
+ COPY --from=builder /app/public ./public
38
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
39
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
40
+
41
+ USER nextjs
42
+ EXPOSE 3000
43
+ ENV PORT=3000
44
+ ENV HOSTNAME="0.0.0.0"
45
+
46
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
47
+ CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
48
+
49
+ CMD ["node", "server.js"]
50
+ ```
51
+
52
+ ### Multi-Stage Build (Go)
53
+
54
+ ```dockerfile
55
+ # Stage 1: Build
56
+ FROM golang:1.23-alpine AS builder
57
+ WORKDIR /app
58
+ COPY go.mod go.sum ./
59
+ RUN go mod download
60
+ COPY . .
61
+ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /app/server ./cmd/server
62
+
63
+ # Stage 2: Minimal Production Image
64
+ FROM gcr.io/distroless/static-debian12
65
+ COPY --from=builder /app/server /server
66
+ COPY --from=builder /app/migrations /migrations
67
+ EXPOSE 8080
68
+ ENTRYPOINT ["/server"]
69
+ ```
70
+
71
+ ### Multi-Stage Build (Rust)
72
+
73
+ ```dockerfile
74
+ # Stage 1: Build with cargo-chef for caching
75
+ FROM rust:1.82-slim AS chef
76
+ RUN cargo install cargo-chef
77
+ WORKDIR /app
78
+
79
+ FROM chef AS planner
80
+ COPY . .
81
+ RUN cargo chef prepare --recipe-path recipe.json
82
+
83
+ FROM chef AS builder
84
+ COPY --from=planner /app/recipe.json recipe.json
85
+ RUN cargo chef cook --release --recipe-path recipe.json
86
+ COPY . .
87
+ RUN cargo build --release
88
+
89
+ # Stage 2: Minimal Production Image
90
+ FROM gcr.io/distroless/cc-debian12
91
+ COPY --from=builder /app/target/release/server /server
92
+ EXPOSE 8080
93
+ ENTRYPOINT ["/server"]
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 2. Kubernetes Deployment Patterns
99
+
100
+ ### Production Deployment with Rolling Updates
101
+
102
+ ```yaml
103
+ # k8s/deployment.yaml
104
+ apiVersion: apps/v1
105
+ kind: Deployment
106
+ metadata:
107
+ name: api-service
108
+ namespace: production
109
+ labels:
110
+ app: api-service
111
+ version: v2
112
+ spec:
113
+ replicas: 3
114
+ strategy:
115
+ type: RollingUpdate
116
+ rollingUpdate:
117
+ maxSurge: 1
118
+ maxUnavailable: 0
119
+ selector:
120
+ matchLabels:
121
+ app: api-service
122
+ template:
123
+ metadata:
124
+ labels:
125
+ app: api-service
126
+ version: v2
127
+ annotations:
128
+ prometheus.io/scrape: "true"
129
+ prometheus.io/port: "9090"
130
+ spec:
131
+ serviceAccountName: api-service
132
+ securityContext:
133
+ runAsNonRoot: true
134
+ runAsUser: 1001
135
+ containers:
136
+ - name: api
137
+ image: ghcr.io/example/api-service:v2.1.0
138
+ ports:
139
+ - containerPort: 3000
140
+ name: http
141
+ - containerPort: 9090
142
+ name: metrics
143
+ env:
144
+ - name: NODE_ENV
145
+ value: production
146
+ - name: DATABASE_URL
147
+ valueFrom:
148
+ secretKeyRef:
149
+ name: api-secrets
150
+ key: database-url
151
+ resources:
152
+ requests:
153
+ cpu: 250m
154
+ memory: 256Mi
155
+ limits:
156
+ cpu: 1000m
157
+ memory: 512Mi
158
+ livenessProbe:
159
+ httpGet:
160
+ path: /healthz
161
+ port: http
162
+ initialDelaySeconds: 10
163
+ periodSeconds: 15
164
+ failureThreshold: 3
165
+ readinessProbe:
166
+ httpGet:
167
+ path: /readyz
168
+ port: http
169
+ initialDelaySeconds: 5
170
+ periodSeconds: 5
171
+ failureThreshold: 2
172
+ startupProbe:
173
+ httpGet:
174
+ path: /healthz
175
+ port: http
176
+ initialDelaySeconds: 5
177
+ periodSeconds: 5
178
+ failureThreshold: 30
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 3. CI/CD Pipeline (GitHub Actions)
184
+
185
+ ### Full Pipeline: Lint → Test → Build → Deploy
186
+
187
+ ```yaml
188
+ # .github/workflows/ci-cd.yaml
189
+ name: CI/CD Pipeline
190
+
191
+ on:
192
+ push:
193
+ branches: [main]
194
+ pull_request:
195
+ branches: [main]
196
+
197
+ env:
198
+ REGISTRY: ghcr.io
199
+ IMAGE_NAME: ${{ github.repository }}
200
+
201
+ jobs:
202
+ lint-and-test:
203
+ runs-on: ubuntu-latest
204
+ services:
205
+ postgres:
206
+ image: postgres:16
207
+ env:
208
+ POSTGRES_DB: test_db
209
+ POSTGRES_USER: test
210
+ POSTGRES_PASSWORD: test
211
+ ports: [5432:5432]
212
+ options: >-
213
+ --health-cmd pg_isready
214
+ --health-interval 10s
215
+ --health-timeout 5s
216
+ --health-retries 5
217
+ redis:
218
+ image: redis:7-alpine
219
+ ports: [6379:6379]
220
+
221
+ steps:
222
+ - uses: actions/checkout@v4
223
+
224
+ - uses: actions/setup-node@v4
225
+ with:
226
+ node-version: 22
227
+ cache: npm
228
+
229
+ - run: npm ci
230
+
231
+ - name: Lint & Type Check
232
+ run: |
233
+ npm run lint
234
+ npm run typecheck
235
+
236
+ - name: Unit Tests
237
+ env:
238
+ DATABASE_URL: postgresql://test:test@localhost:5432/test_db
239
+ REDIS_URL: redis://localhost:6379
240
+ run: npm run test:unit -- --coverage
241
+
242
+ - name: Run Migrations
243
+ env:
244
+ DATABASE_URL: postgresql://test:test@localhost:5432/test_db
245
+ run: npx drizzle-kit migrate
246
+
247
+ - name: Integration Tests
248
+ env:
249
+ DATABASE_URL: postgresql://test:test@localhost:5432/test_db
250
+ REDIS_URL: redis://localhost:6379
251
+ run: npm run test:integration
252
+
253
+ - name: Upload Coverage
254
+ uses: codecov/codecov-action@v4
255
+ with:
256
+ token: ${{ secrets.CODECOV_TOKEN }}
257
+
258
+ build-and-push:
259
+ needs: lint-and-test
260
+ if: github.ref == 'refs/heads/main'
261
+ runs-on: ubuntu-latest
262
+ permissions:
263
+ contents: read
264
+ packages: write
265
+
266
+ steps:
267
+ - uses: actions/checkout@v4
268
+
269
+ - uses: docker/login-action@v3
270
+ with:
271
+ registry: ${{ env.REGISTRY }}
272
+ username: ${{ github.actor }}
273
+ password: ${{ secrets.GITHUB_TOKEN }}
274
+
275
+ - uses: docker/metadata-action@v5
276
+ id: meta
277
+ with:
278
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
279
+ tags: |
280
+ type=sha,prefix=
281
+ type=raw,value=latest
282
+
283
+ - uses: docker/build-push-action@v5
284
+ with:
285
+ context: .
286
+ push: true
287
+ tags: ${{ steps.meta.outputs.tags }}
288
+ cache-from: type=gha
289
+ cache-to: type=gha,mode=max
290
+
291
+ deploy:
292
+ needs: build-and-push
293
+ if: github.ref == 'refs/heads/main'
294
+ runs-on: ubuntu-latest
295
+ environment: production
296
+
297
+ steps:
298
+ - uses: actions/checkout@v4
299
+
300
+ - name: Deploy to Kubernetes
301
+ env:
302
+ KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
303
+ run: |
304
+ echo "$KUBE_CONFIG" | base64 -d > kubeconfig.yaml
305
+ export KUBECONFIG=kubeconfig.yaml
306
+ kubectl set image deployment/api-service \
307
+ api=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
308
+ -n production
309
+ kubectl rollout status deployment/api-service -n production --timeout=300s
310
+ ```
311
+
312
+ ---
313
+
314
+ ## 4. Infrastructure as Code (Terraform)
315
+
316
+ ### AWS ECS Fargate Service
317
+
318
+ ```hcl
319
+ # infra/main.tf
320
+ terraform {
321
+ required_version = ">= 1.7"
322
+ required_providers {
323
+ aws = {
324
+ source = "hashicorp/aws"
325
+ version = "~> 5.0"
326
+ }
327
+ }
328
+ backend "s3" {
329
+ bucket = "my-terraform-state"
330
+ key = "production/api-service.tfstate"
331
+ region = "us-east-1"
332
+ }
333
+ }
334
+
335
+ resource "aws_ecs_service" "api" {
336
+ name = "api-service"
337
+ cluster = aws_ecs_cluster.main.id
338
+ task_definition = aws_ecs_task_definition.api.arn
339
+ desired_count = 3
340
+ launch_type = "FARGATE"
341
+
342
+ network_configuration {
343
+ subnets = var.private_subnets
344
+ security_groups = [aws_security_group.api.id]
345
+ assign_public_ip = false
346
+ }
347
+
348
+ load_balancer {
349
+ target_group_arn = aws_lb_target_group.api.arn
350
+ container_name = "api"
351
+ container_port = 3000
352
+ }
353
+
354
+ deployment_circuit_breaker {
355
+ enable = true
356
+ rollback = true
357
+ }
358
+
359
+ deployment_minimum_healthy_percent = 100
360
+ deployment_maximum_percent = 200
361
+ }
362
+
363
+ resource "aws_ecs_task_definition" "api" {
364
+ family = "api-service"
365
+ network_mode = "awsvpc"
366
+ requires_compatibilities = ["FARGATE"]
367
+ cpu = "512"
368
+ memory = "1024"
369
+ execution_role_arn = aws_iam_role.ecs_execution.arn
370
+ task_role_arn = aws_iam_role.ecs_task.arn
371
+
372
+ container_definitions = jsonencode([{
373
+ name = "api"
374
+ image = "${var.ecr_repo_url}:${var.image_tag}"
375
+ portMappings = [{
376
+ containerPort = 3000
377
+ protocol = "tcp"
378
+ }]
379
+ environment = [
380
+ { name = "NODE_ENV", value = "production" },
381
+ ]
382
+ secrets = [
383
+ { name = "DATABASE_URL", valueFrom = aws_ssm_parameter.db_url.arn },
384
+ ]
385
+ logConfiguration = {
386
+ logDriver = "awslogs"
387
+ options = {
388
+ "awslogs-group" = aws_cloudwatch_log_group.api.name
389
+ "awslogs-region" = var.aws_region
390
+ "awslogs-stream-prefix" = "api"
391
+ }
392
+ }
393
+ healthCheck = {
394
+ command = ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/healthz || exit 1"]
395
+ interval = 30
396
+ timeout = 5
397
+ retries = 3
398
+ startPeriod = 10
399
+ }
400
+ }])
401
+ }
402
+ ```
403
+
404
+ ---
405
+
406
+ ## 5. Observability Stack
407
+
408
+ ### OpenTelemetry Setup (TypeScript)
409
+
410
+ ```typescript
411
+ // lib/telemetry.ts
412
+ import { NodeSDK } from '@opentelemetry/sdk-node';
413
+ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
414
+ import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
415
+ import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
416
+ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
417
+ import { Resource } from '@opentelemetry/resources';
418
+ import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
419
+
420
+ const sdk = new NodeSDK({
421
+ resource: new Resource({
422
+ [ATTR_SERVICE_NAME]: process.env.SERVICE_NAME ?? 'api-service',
423
+ [ATTR_SERVICE_VERSION]: process.env.SERVICE_VERSION ?? '1.0.0',
424
+ }),
425
+ traceExporter: new OTLPTraceExporter({
426
+ url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? 'http://localhost:4318/v1/traces',
427
+ }),
428
+ metricReader: new PeriodicExportingMetricReader({
429
+ exporter: new OTLPMetricExporter({
430
+ url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? 'http://localhost:4318/v1/metrics',
431
+ }),
432
+ exportIntervalMillis: 30000,
433
+ }),
434
+ instrumentations: [
435
+ getNodeAutoInstrumentations({
436
+ '@opentelemetry/instrumentation-fs': { enabled: false },
437
+ }),
438
+ ],
439
+ });
440
+
441
+ sdk.start();
442
+ console.log('📡 OpenTelemetry initialized');
443
+
444
+ process.on('SIGTERM', async () => {
445
+ await sdk.shutdown();
446
+ console.log('📡 OpenTelemetry shut down');
447
+ });
448
+ ```
449
+
450
+ ### Health Check Endpoints
451
+
452
+ ```typescript
453
+ // app/api/health/route.ts (Next.js)
454
+ import { NextResponse } from 'next/server';
455
+ import { db } from '@/lib/db';
456
+ import { sql } from 'drizzle-orm';
457
+
458
+ // /healthz — Liveness probe (is the process alive?)
459
+ export async function GET() {
460
+ return NextResponse.json({ status: 'ok', timestamp: new Date().toISOString() });
461
+ }
462
+
463
+ // /readyz — Readiness probe (can the service handle traffic?)
464
+ export async function HEAD() {
465
+ try {
466
+ await db.execute(sql`SELECT 1`);
467
+ return new NextResponse(null, { status: 200 });
468
+ } catch {
469
+ return new NextResponse(null, { status: 503 });
470
+ }
471
+ }
472
+ ```
473
+
474
+ ---
475
+
476
+ ## Conclusion
477
+ Modern DevOps is about automation, observability, and resilience. Invest in proper CI/CD pipelines, container best practices, and comprehensive monitoring to ship confidently and recover quickly from failures.