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,167 @@
1
+ ---
2
+ name: senior-fullstack
3
+ description: "Complete toolkit for senior fullstack with modern tools and best practices / Perangkat instruksi lengkap untuk pengembang fullstack tingkat senior dengan alat-alat dan best practices termutakhir."
4
+ author: "Roedy Rustam"
5
+ ---
6
+
7
+ # Senior Fullstack Developer (2026 Edition)
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Description
17
+ Complete guidelines for senior fullstack developers building production-grade applications in 2026. Covers the modern AI-native stack, architecture decision-making, API design, frontend/backend integration, and team-level best practices.
18
+
19
+ ### Trigger Conditions
20
+ - Making fullstack architecture decisions across frontend and backend.
21
+ - Designing API contracts between React 19/Next.js 15 frontend and Node.js/Go/Python backend.
22
+ - Integrating AI features (LLM, agents, RAG) into a fullstack application.
23
+ - Setting up a monorepo with shared types between frontend and backend.
24
+ - Reviewing and improving overall application architecture and code quality.
25
+
26
+ ### Modern 2026 Fullstack Stack
27
+
28
+ #### Recommended Stacks by Use Case
29
+
30
+ | Use Case | Frontend | Backend | Database | AI Layer |
31
+ |---|---|---|---|---|
32
+ | **SaaS App (default)** | Next.js 15 (App Router) | Hono / Fastify 5 | Postgres + Drizzle | Vercel AI SDK 5.x |
33
+ | **AI-First App** | Next.js 15 + RSC streaming | Mastra.ai / LangGraph | pgvector + Supabase | Anthropic / OpenAI |
34
+ | **Decoupled SPA** | TanStack Start + React 19 | Hono RPC | Postgres + Drizzle | Vercel AI SDK |
35
+ | **Content Site** | Astro 5 + MDX | N/A (static) | Sanity / Contentful | — |
36
+ | **Mobile** | Expo SDK 53 + React Native 0.79 | Hono / Fastify | SQLite (Expo) + Postgres | Vercel AI SDK |
37
+
38
+ #### AI-Native Fullstack Patterns
39
+ In 2026, AI is a first-class citizen in fullstack applications:
40
+ - **Streaming AI Responses**: Use Next.js RSC + Vercel AI SDK `streamUI` to stream LLM responses as React components from the server.
41
+ - **Server Actions as AI Triggers**: Use React 19 `useActionState` with Server Actions to invoke LLM calls without an API layer.
42
+ - **Background AI Jobs**: Offload long LLM tasks to BullMQ + Redis workers; stream results via WebSockets or SSE.
43
+ - **Structured AI Output**: Always use `zodResponseFormat` or Pydantic schemas for LLM responses — never parse free-form JSON.
44
+
45
+ ### API Design Principles (2026)
46
+
47
+ #### Type-Safe Communication
48
+ Choose one approach and be consistent:
49
+ - **Hono RPC**: If backend is Hono — zero codegen, end-to-end types.
50
+ - **tRPC**: If using React Query with Next.js — excellent DX with RSC support.
51
+ - **OpenAPI + codegen**: If you have multiple consumers (mobile, third parties).
52
+
53
+ #### API Versioning
54
+ - Use URL versioning: `/api/v1/users`.
55
+ - Pin major version in URL, minor versions are backward-compatible.
56
+ - Deprecate with `Deprecation` and `Sunset` headers.
57
+
58
+ #### Error Response Standard (RFC 9457 Problem Details)
59
+ ```typescript
60
+ // Consistent error format across all endpoints
61
+ interface ProblemDetail {
62
+ type: string; // URI identifying the error type
63
+ title: string; // Human-readable summary
64
+ status: number; // HTTP status code
65
+ detail: string; // Specific explanation
66
+ instance?: string; // URI of the specific occurrence
67
+ }
68
+ ```
69
+
70
+ ### SPA vs SSR vs Static — Decision Guide
71
+ ```
72
+ SEO-critical + mostly read? → Next.js SSR / Astro 5 (static)
73
+ Highly interactive dashboard? → SPA (TanStack Start / Vite + TanStack Router)
74
+ → see spa-orchestrator skill for architecture details
75
+ Mixed (marketing + app)? → Next.js 15 with hybrid routing
76
+ Real-time data? → SSR + WebSocket or SSE streaming
77
+ ```
78
+
79
+ ### Monorepo with Shared Types
80
+ ```typescript
81
+ // packages/types/src/index.ts — single source of truth
82
+ export interface User {
83
+ id: string;
84
+ email: string;
85
+ name: string;
86
+ plan: 'free' | 'pro' | 'enterprise';
87
+ isSuperAdmin: boolean;
88
+ }
89
+
90
+ export interface ApiResponse<T> {
91
+ data: T;
92
+ meta?: { page: number; total: number };
93
+ }
94
+
95
+ // apps/api — uses the type
96
+ // apps/web — uses the same type
97
+ // apps/admin — uses the same type
98
+ import type { User } from '@myapp/types';
99
+ ```
100
+
101
+ ### Security Checklist (Fullstack)
102
+ - [ ] All user inputs validated with Zod on the server (never trust the client).
103
+ - [ ] JWT secrets rotated every 90 days; use short expiry + refresh tokens.
104
+ - [ ] CSP headers configured (no `unsafe-inline` in production).
105
+ - [ ] All DB queries use parameterized queries — no string concatenation.
106
+ - [ ] File uploads validated for MIME type and scanned before storage.
107
+ - [ ] Rate limiting on all public API endpoints.
108
+ - [ ] Super Admin routes restricted to `admin.domain.com` with `isSuperAdmin` check.
109
+
110
+ ### Code Review Standards
111
+ - Functions < 30 lines; files < 300 lines.
112
+ - No business logic in UI components.
113
+ - Every PR includes relevant tests (unit or E2E).
114
+ - No `any` types in TypeScript production code.
115
+ - Dependencies audited with `pnpm audit` on every PR.
116
+
117
+ ---
118
+
119
+ <a name="bahasa-indonesia"></a>
120
+ ## Bahasa Indonesia
121
+
122
+ ### Deskripsi
123
+ Panduan lengkap untuk pengembang fullstack senior yang membangun aplikasi tingkat produksi di 2026. Mencakup stack AI-native modern, pengambilan keputusan arsitektur, desain API, integrasi frontend/backend, dan best practices tingkat tim.
124
+
125
+ ### Kondisi Pemicu
126
+ - Membuat keputusan arsitektur fullstack di frontend dan backend.
127
+ - Merancang kontrak API antara frontend React 19/Next.js 15 dan backend Node.js/Go/Python.
128
+ - Mengintegrasikan fitur AI (LLM, agen, RAG) ke dalam aplikasi fullstack.
129
+ - Menyiapkan monorepo dengan shared types antara frontend dan backend.
130
+ - Meninjau dan meningkatkan arsitektur dan kualitas kode aplikasi secara keseluruhan.
131
+
132
+ ### Stack Fullstack Modern 2026
133
+
134
+ Rekomendasi stack berdasarkan use case:
135
+ - **SaaS App**: Next.js 15 + Hono/Fastify + Postgres + Drizzle + Vercel AI SDK.
136
+ - **AI-First App**: Next.js 15 RSC streaming + Mastra.ai/LangGraph + pgvector.
137
+ - **SPA Terpisah**: TanStack Start + Hono RPC + Postgres — lihat `spa-orchestrator`.
138
+ - **Situs Konten**: Astro 5 + MDX.
139
+ - **Mobile**: Expo SDK 53 + Hono + SQLite.
140
+
141
+ ### Pola Fullstack AI-Native (2026)
142
+ AI adalah warga kelas satu di aplikasi fullstack 2026:
143
+ - **Streaming RSC**: Alirkan respons LLM sebagai komponen React dari server menggunakan `streamUI` Vercel AI SDK 5.x.
144
+ - **Server Actions sebagai Pemicu AI**: Panggil LLM dari Server Actions React 19 tanpa lapisan API terpisah.
145
+ - **Background AI Jobs**: Offload tugas LLM panjang ke BullMQ + Redis; stream hasil via WebSocket atau SSE.
146
+ - **Output AI Terstruktur**: Selalu gunakan `zodResponseFormat` atau skema Pydantic — jangan pernah parse JSON bebas dari LLM.
147
+
148
+ ### Prinsip Desain API (2026)
149
+ - **Hono RPC**: Zero codegen, end-to-end type-safe jika backend adalah Hono.
150
+ - **tRPC**: Untuk React Query + Next.js dengan dukungan RSC.
151
+ - **OpenAPI + codegen**: Jika memiliki banyak konsumen (mobile, pihak ketiga).
152
+ - **Format Error RFC 9457**: Respons error yang konsisten dengan `type`, `title`, `status`, `detail`.
153
+
154
+ ### SPA vs SSR vs Static
155
+ Gunakan SSR/Astro untuk situs kritis SEO dan banyak baca. Gunakan SPA (TanStack Start) untuk dashboard yang sangat interaktif. Gunakan Next.js 15 dengan routing hybrid untuk aplikasi campuran (marketing + app).
156
+
157
+ ### Monorepo dengan Shared Types
158
+ Definisikan interface dan tipe bersama di `packages/types` — digunakan oleh semua app (web, admin, api, mobile) sebagai single source of truth.
159
+
160
+ ### Checklist Keamanan
161
+ - Input pengguna divalidasi Zod di server.
162
+ - JWT rotasi 90 hari; expiry pendek + refresh token.
163
+ - Header CSP dikonfigurasi.
164
+ - Semua query DB menggunakan parameterized query.
165
+ - Upload file divalidasi MIME type.
166
+ - Rate limiting di semua endpoint publik.
167
+ - Rute Super Admin dibatasi di `admin.domain.com` dengan cek `isSuperAdmin`.
@@ -0,0 +1,160 @@
1
+ # Architecture Patterns
2
+
3
+ ## Overview
4
+ This reference guide details high-performance architecture patterns for senior fullstack systems. It covers multi-tier caching (Redis), relational database partitioning, and resilient event-driven background queues.
5
+
6
+ ---
7
+
8
+ ## Production Architecture Designs
9
+
10
+ ### 1. Multi-Tier Caching Layer (Redis + Memory)
11
+
12
+ For write-heavy/read-intensive endpoints (e.g., public API stats or product catalogs), hitting the relational database directly is a major bottleneck. Implement a Cache-Aside pattern using memory-first or Redis structures.
13
+
14
+ #### Pattern: Type-Safe Cache-Aside Implementation (`lib/cache/redis.ts`)
15
+
16
+ ```typescript
17
+ import { Redis } from '@upstash/redis'; // or ioredis
18
+
19
+ export const redis = new Redis({
20
+ url: process.env.UPSTASH_REDIS_REST_URL!,
21
+ token: process.env.UPSTASH_REDIS_REST_TOKEN!,
22
+ });
23
+
24
+ interface CacheOptions {
25
+ ttlSeconds?: number;
26
+ }
27
+
28
+ export async function getOrSetCache<T>(
29
+ key: string,
30
+ fetchFn: () => Promise<T>,
31
+ options: CacheOptions = {}
32
+ ): Promise<T> {
33
+ const ttl = options.ttlSeconds ?? 3600; // Default: 1 hour
34
+
35
+ try {
36
+ // Attempt cache read
37
+ const cachedData = await redis.get<string>(key);
38
+ if (cachedData) {
39
+ return typeof cachedData === 'string' ? JSON.parse(cachedData) : cachedData;
40
+ }
41
+ } catch (err) {
42
+ console.error(`⚠️ Redis read failed for key ${key}:`, err);
43
+ }
44
+
45
+ // Cache miss - execute database hit
46
+ const freshData = await fetchFn();
47
+
48
+ try {
49
+ // Populate cache asynchronously
50
+ await redis.set(key, JSON.stringify(freshData), { ex: ttl });
51
+ } catch (err) {
52
+ console.error(`⚠️ Redis write failed for key ${key}:`, err);
53
+ }
54
+
55
+ return freshData;
56
+ }
57
+ ```
58
+
59
+ ---
60
+
61
+ ### 2. High-Performance Indexing and Query Tuning
62
+
63
+ Poor database performance is almost always caused by missing indexes on fields targeted by `WHERE` and `JOIN` clauses. Use standard PostgreSQL compound indexes and profile execution paths.
64
+
65
+ #### Pattern: Compound & Partial Indexing (`prisma/schema.prisma` or pure SQL)
66
+
67
+ ```prisma
68
+ // Example Prisma compound index optimized for scoped tenant querying
69
+ model Invoice {
70
+ id String @id @default(cuid())
71
+ tenantId String
72
+ status String // PAID, UNPAID, OVERDUE
73
+ amount Float
74
+ createdAt DateTime @default(now())
75
+
76
+ // Optimize compound filters: WHERE tenantId = X AND status = Y ORDER BY createdAt DESC
77
+ @@index([tenantId, status, createdAt(sort: Desc)])
78
+ }
79
+ ```
80
+
81
+ #### Profiling Queries with PostgreSQL `EXPLAIN ANALYZE`
82
+
83
+ Run the following SQL diagnostic query inside your migration console to detect costly Sequential Scans (Seq Scan):
84
+
85
+ ```sql
86
+ EXPLAIN ANALYZE
87
+ SELECT * FROM "Invoice"
88
+ WHERE "tenantId" = 'tenant_123'
89
+ AND "status" = 'PAID'
90
+ ORDER BY "createdAt" DESC;
91
+ ```
92
+
93
+ *Look for:* `Index Scan using Invoice_tenantId_status_createdAt_idx` indicating the optimizer is executing query lookup paths with O(log N) complexity instead of O(N).
94
+
95
+ ---
96
+
97
+ ### 3. Resilient Webhooks & Resilient Background Workers
98
+
99
+ Handling computationally heavy tasks (e.g., PDF generation, batch emails, image processing) in the standard request/response HTTP loop leads to poor UI performance and timeout failures. Decouple execution paths with background job queues (e.g., BullMQ, Inngest, or Celery).
100
+
101
+ #### Pattern: Event-Driven Queue Producer (`lib/queue/jobs.ts`)
102
+
103
+ ```typescript
104
+ import { Queue } from 'bullmq';
105
+ import IORedis from 'ioredis';
106
+
107
+ const connection = new IORedis(process.env.REDIS_URL!);
108
+
109
+ // 1. Establish the queue
110
+ export const emailQueue = new Queue('EmailQueue', { connection });
111
+
112
+ export async function queueWelcomeEmail(userId: string, email: string) {
113
+ await emailQueue.add(
114
+ 'send_welcome',
115
+ { userId, email },
116
+ {
117
+ attempts: 5, // High retry resilience
118
+ backoff: {
119
+ type: 'exponential',
120
+ delay: 5000, // Exponential backoff starting at 5s
121
+ },
122
+ }
123
+ );
124
+ }
125
+ ```
126
+
127
+ #### Pattern: Decoupled Queue Worker (`workers/email.ts`)
128
+
129
+ ```typescript
130
+ import { Worker, Job } from 'bullmq';
131
+ import IORedis from 'ioredis';
132
+ import { sendWelcomeEmail } from '@/lib/email';
133
+
134
+ const connection = new IORedis(process.env.REDIS_URL!);
135
+
136
+ // Decoupled consumer execution running in a separate thread/container
137
+ const emailWorker = new Worker(
138
+ 'EmailQueue',
139
+ async (job: Job) => {
140
+ if (job.name === 'send_welcome') {
141
+ const { email, userId } = job.data;
142
+ await sendWelcomeEmail(email, userId);
143
+ }
144
+ },
145
+ { connection, concurrency: 10 }
146
+ );
147
+
148
+ emailWorker.on('completed', (job) => {
149
+ console.log(`✅ Job ${job.id} completed successfully`);
150
+ });
151
+
152
+ emailWorker.on('failed', (job, err) => {
153
+ console.error(`❌ Job ${job?.id} failed:`, err);
154
+ });
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Technical Summary
160
+ Decoupling application layers using structured micro-tier architectures—caching, indexes, and background workers—prevents cascading performance issues, guarantees high availability, and maintains scalable SaaS responses.
@@ -0,0 +1,222 @@
1
+ # Development Workflows
2
+
3
+ ## Overview
4
+ This reference guide details production-grade development workflows, automated testing matrices, and CI/CD pipelines for senior fullstack applications.
5
+
6
+ ---
7
+
8
+ ## Production Workflows & Pipelines
9
+
10
+ ### 1. High-Fidelity Test Matrix (Vitest & Playwright)
11
+
12
+ Senior fullstack projects must enforce a multi-tiered test strategy:
13
+ 1. **Unit Testing**: Instant feedback cycles using Vitest or Jest for pure logic and schema validations.
14
+ 2. **End-to-End (E2E) Testing**: High-fidelity customer flow validations using Playwright.
15
+
16
+ #### Pattern: Vitest Schema Validator Unit Test (`__tests__/signup.test.ts`)
17
+
18
+ ```typescript
19
+ import { describe, it, expect } from 'vitest';
20
+ import { SignupSchema } from '../lib/validators/auth';
21
+
22
+ describe('Signup Schema Validation', () => {
23
+ it('should pass on complete, valid payload', () => {
24
+ const payload = {
25
+ email: 'test@example.com',
26
+ password: 'password123',
27
+ name: 'Jane Doe',
28
+ };
29
+ const result = SignupSchema.safeParse(payload);
30
+ expect(result.success).toBe(true);
31
+ });
32
+
33
+ it('should reject passwords shorter than 8 characters', () => {
34
+ const payload = {
35
+ email: 'test@example.com',
36
+ password: 'short',
37
+ };
38
+ const result = SignupSchema.safeParse(payload);
39
+ expect(result.success).toBe(false);
40
+ });
41
+ });
42
+ ```
43
+
44
+ #### Pattern: Playwright Multi-Role Customer E2E Flow (`e2e/onboarding.spec.ts`)
45
+
46
+ ```typescript
47
+ import { test, expect } from '@playwright/test';
48
+
49
+ test.describe('Customer Workspace Onboarding', () => {
50
+ test('should allow authenticated customer to create a workspace and view dashboard', async ({ page }) => {
51
+ // 1. Visit landing page
52
+ await page.goto('/sign-in');
53
+
54
+ // 2. Perform mock login or enter user credentials
55
+ await page.fill('input[type="email"]', 'jane@company.com');
56
+ await page.fill('input[type="password"]', 'janePassword123');
57
+ await page.click('button[type="submit"]');
58
+
59
+ // 3. Confirm redirected to dashboard onboarding step
60
+ await expect(page).toHaveURL(/.*dashboard/);
61
+ await expect(page.locator('h1')).toContainText('Create Your Workspace');
62
+
63
+ // 4. Submit form
64
+ await page.fill('input[name="name"]', 'Jane Ventures');
65
+ await page.fill('input[name="slug"]', 'jane-ventures');
66
+ await page.click('button[type="submit"]');
67
+
68
+ // 5. Verify success state and layout rendering
69
+ await expect(page.locator('main')).toContainText('Jane Ventures');
70
+ });
71
+ });
72
+ ```
73
+
74
+ ---
75
+
76
+ ### 2. Automated CI/CD Pipelines (GitHub Actions)
77
+
78
+ Establish automated quality gates on every Pull Request to verify build integrity, linter standards, and security vulnerability profiles.
79
+
80
+ #### Pattern: GitHub Actions Workflow (`.github/workflows/ci.yml`)
81
+
82
+ ```yaml
83
+ name: Continuous Integration
84
+
85
+ on:
86
+ push:
87
+ branches: [ main ]
88
+ pull_request:
89
+ branches: [ main ]
90
+
91
+ jobs:
92
+ validate:
93
+ runs-on: ubuntu-latest
94
+
95
+ services:
96
+ postgres:
97
+ image: postgres:15
98
+ env:
99
+ POSTGRES_USER: test_user
100
+ POSTGRES_PASSWORD: test_password
101
+ POSTGRES_DB: test_db
102
+ ports:
103
+ - 5432:5432
104
+ options: >-
105
+ --health-cmd pg_isready
106
+ --health-interval 10s
107
+ --health-timeout 5s
108
+ --health-retries 5
109
+
110
+ steps:
111
+ - name: Checkout Source Code
112
+ uses: actions/checkout@v4
113
+
114
+ - name: Setup Node.js Environment
115
+ uses: actions/setup-node@v4
116
+ with:
117
+ node-version: 20
118
+ cache: 'npm'
119
+
120
+ - name: Install Dependencies
121
+ run: npm ci
122
+
123
+ - name: Verify Linter & Formatters
124
+ run: |
125
+ npm run lint
126
+ npm run format:check
127
+
128
+ - name: Run Database Migrations
129
+ env:
130
+ DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db
131
+ run: npx prisma migrate deploy # or npx drizzle-kit migrate
132
+
133
+ - name: Execute Vitest Unit Suite
134
+ env:
135
+ DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db
136
+ run: npm run test:unit
137
+
138
+ - name: Install Playwright Browsers
139
+ run: npx playwright install --with-deps
140
+
141
+ - name: Execute E2E Integration Suite
142
+ env:
143
+ DATABASE_URL: postgresql://test_user:test_password@localhost:5432/test_db
144
+ run: npm run test:e2e
145
+
146
+ - name: Validate Production Build
147
+ run: npm run build
148
+ ```
149
+
150
+ ---
151
+
152
+ ### 3. Containerized Local Environments (Docker & Compose)
153
+
154
+ To guarantee absolute environment consistency between developer workstations and staging/production clouds, define lightweight multi-container environments.
155
+
156
+ #### Pattern: Production-Grade Multi-Stage Dockerfile (`Dockerfile`)
157
+
158
+ ```dockerfile
159
+ # --- Stage 1: Build Workspace ---
160
+ FROM node:20-alpine AS builder
161
+ WORKDIR /app
162
+ COPY package*.json ./
163
+ RUN npm ci
164
+ COPY . .
165
+ RUN npm run build
166
+
167
+ # --- Stage 2: Minimalist Production Runner ---
168
+ FROM node:20-alpine AS runner
169
+ WORKDIR /app
170
+ ENV NODE_ENV=production
171
+ COPY --from=builder /app/package*.json ./
172
+ COPY --from=builder /app/node_modules ./node_modules
173
+ COPY --from=builder /app/.next ./.next
174
+ COPY --from=builder /app/public ./public
175
+
176
+ EXPOSE 3000
177
+ CMD ["npm", "run", "start"]
178
+ ```
179
+
180
+ #### Pattern: Docker Compose Stack (`docker-compose.yml`)
181
+
182
+ ```yaml
183
+ version: '3.8'
184
+
185
+ services:
186
+ web:
187
+ build:
188
+ context: .
189
+ dockerfile: Dockerfile
190
+ ports:
191
+ - "3000:3000"
192
+ environment:
193
+ - DATABASE_URL=postgresql://app_user:app_password@db:5432/app_db
194
+ - REDIS_URL=redis://redis:6379
195
+ depends_on:
196
+ - db
197
+ - redis
198
+
199
+ db:
200
+ image: postgres:15
201
+ environment:
202
+ POSTGRES_USER: app_user
203
+ POSTGRES_PASSWORD: app_password
204
+ POSTGRES_DB: app_db
205
+ ports:
206
+ - "5432:5432"
207
+ volumes:
208
+ - pgdata:/var/lib/postgresql/data
209
+
210
+ redis:
211
+ image: redis:7-alpine
212
+ ports:
213
+ - "6379:6379"
214
+
215
+ volumes:
216
+ pgdata:
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Conclusion
222
+ Setting up rigorous CI/CD gates, high-fidelity testing metrics, and matching container local stacks completely eliminates "works on my machine" failures and keeps server releases highly stable.