vibes-plug 2.5.0 → 2.11.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 (177) hide show
  1. package/.claude/rules/vibes-plug-core.md +32 -0
  2. package/.cursor/rules/vibes-plug-core.mdc +51 -0
  3. package/.cursorrules +42 -0
  4. package/AGENTS.md +37 -7
  5. package/BLUEPRINT.md +309 -217
  6. package/CHANGELOG.md +133 -1
  7. package/CLAUDE.md +70 -0
  8. package/LICENSE +1 -1
  9. package/README.md +641 -415
  10. package/index.js +19 -0
  11. package/package.json +44 -8
  12. package/plugin.json +24 -7
  13. package/scripts/generate_swarm_gif.py +295 -0
  14. package/scripts/install.js +201 -0
  15. package/skills/accessibility-testing-expert/SKILL.md +116 -0
  16. package/skills/ai-cost-token-optimizer/SKILL.md +82 -52
  17. package/skills/ai-evals-benchmark-expert/SKILL.md +188 -0
  18. package/skills/ai-llm-integration-expert/SKILL.md +185 -178
  19. package/skills/ai-media-generation-expert/SKILL.md +172 -0
  20. package/skills/ai-prompt-engineering-expert/SKILL.md +84 -0
  21. package/skills/angular-expert/SKILL.md +148 -0
  22. package/skills/api-design-expert/SKILL.md +6 -3
  23. package/skills/api-gateway-proxy-expert/SKILL.md +81 -0
  24. package/skills/app-analyzer-optimizer/SKILL.md +6 -3
  25. package/skills/apple-ecosystem-expert/SKILL.md +144 -141
  26. package/skills/{asisten_ramah → asisten-ramah}/SKILL.md +7 -1
  27. package/skills/astro-framework-expert/SKILL.md +200 -0
  28. package/skills/async-queue-temporal-expert/SKILL.md +210 -24
  29. package/skills/authentication-identity-expert/SKILL.md +278 -275
  30. package/skills/auto-doc-updater/SKILL.md +7 -1
  31. package/skills/autonomous-chaos-monkey/SKILL.md +63 -63
  32. package/skills/autonomous-red-teamer/SKILL.md +172 -28
  33. package/skills/autonomous-tdd-debugger/SKILL.md +70 -64
  34. package/skills/background-jobs-queue-expert/SKILL.md +235 -0
  35. package/skills/biome-linter-formatter-expert/SKILL.md +89 -0
  36. package/skills/blockchain-web3-expert/SKILL.md +115 -0
  37. package/skills/bootstrap-to-modern/SKILL.md +9 -6
  38. package/skills/brainstorming/SKILL.md +58 -50
  39. package/skills/browser-automation-expert/SKILL.md +197 -21
  40. package/skills/bun-runtime-expert/SKILL.md +7 -1
  41. package/skills/chatbot-messaging-expert/SKILL.md +114 -0
  42. package/skills/ci-cd-devops-architect/SKILL.md +45 -36
  43. package/skills/cloud-hosting-expert/SKILL.md +7 -1
  44. package/skills/coderabbit/SKILL.md +7 -1
  45. package/skills/compliance-gdpr-privacy-expert/SKILL.md +85 -0
  46. package/skills/cron-scheduler-expert/SKILL.md +303 -297
  47. package/skills/data-pipeline-etl-expert/SKILL.md +84 -0
  48. package/skills/data-telemetry-expert/SKILL.md +7 -1
  49. package/skills/data-visualization-expert/SKILL.md +154 -0
  50. package/skills/database-migration-versioning-expert/SKILL.md +90 -0
  51. package/skills/database-orm-expert/SKILL.md +13 -3
  52. package/skills/dependency-upgrade-migrator/SKILL.md +300 -294
  53. package/skills/design-system-architect/SKILL.md +278 -259
  54. package/skills/desktop-electron-expert/SKILL.md +128 -0
  55. package/skills/documentation-site-expert/SKILL.md +59 -0
  56. package/skills/doku-mcp-server/SKILL.md +7 -1
  57. package/skills/doku-payment-gateway/SKILL.md +7 -1
  58. package/skills/domain-driven-design-expert/SKILL.md +82 -0
  59. package/skills/e2e-testing-expert/SKILL.md +7 -1
  60. package/skills/ecommerce-expert/SKILL.md +87 -0
  61. package/skills/edge-serverless-db-expert/SKILL.md +98 -42
  62. package/skills/email-notification-expert/SKILL.md +367 -361
  63. package/skills/error-resilience-expert/SKILL.md +485 -479
  64. package/skills/event-driven-architect/SKILL.md +7 -1
  65. package/skills/feature-flag-analytics-expert/SKILL.md +65 -45
  66. package/skills/file-upload-media-expert/SKILL.md +436 -430
  67. package/skills/firebase-security-expert/SKILL.md +7 -1
  68. package/skills/form-validation-expert/SKILL.md +406 -400
  69. package/skills/fullstack-expert/SKILL.md +60 -1
  70. package/skills/gemini-agent-booster/SKILL.md +173 -135
  71. package/skills/geospatial-maps-expert/SKILL.md +80 -0
  72. package/skills/global-a11y-i18n-expert/SKILL.md +7 -1
  73. package/skills/glsl-shader-expert/SKILL.md +106 -100
  74. package/skills/go-programming-expert/SKILL.md +21 -15
  75. package/skills/graph-rag-knowledge-expert/SKILL.md +159 -0
  76. package/skills/graphql-apollo-expert/SKILL.md +113 -107
  77. package/skills/headless-cms-expert/SKILL.md +181 -0
  78. package/skills/hig/SKILL.md +7 -1
  79. package/skills/js-backend-expert/SKILL.md +218 -216
  80. package/skills/legacy-code-translator/SKILL.md +70 -64
  81. package/skills/local-slm-edge-ai-expert/SKILL.md +167 -0
  82. package/skills/logging-error-tracking-expert/SKILL.md +343 -337
  83. package/skills/mcp-client-orchestrator/SKILL.md +75 -69
  84. package/skills/mcp-server-architect/SKILL.md +294 -194
  85. package/skills/micro-frontend-architect/SKILL.md +111 -105
  86. package/skills/mobile-expo-expert/SKILL.md +8 -2
  87. package/skills/mobile-push-notification-expert/SKILL.md +70 -50
  88. package/skills/modern-css-native-expert/SKILL.md +189 -0
  89. package/skills/monday-design-aesthetic/SKILL.md +7 -1
  90. package/skills/monorepo-architect/SKILL.md +7 -1
  91. package/skills/mpa-orchestrator/SKILL.md +20 -1
  92. package/skills/multi-agent-orchestration/SKILL.md +254 -234
  93. package/skills/multiple-entry-points/SKILL.md +37 -1
  94. package/skills/mvc-expert/SKILL.md +7 -1
  95. package/skills/n8n-automation-expert/SKILL.md +89 -0
  96. package/skills/nextjs-app-router-expert/SKILL.md +148 -0
  97. package/skills/openapi-swagger-codegen-expert/SKILL.md +67 -0
  98. package/skills/payment-gateway-expert/SKILL.md +85 -1
  99. package/skills/pdf-document-generation-expert/SKILL.md +91 -0
  100. package/skills/performance-web-vitals/SKILL.md +7 -1
  101. package/skills/post-quantum-crypto-migrator/SKILL.md +57 -57
  102. package/skills/prd-architect/SKILL.md +7 -1
  103. package/skills/proactive-background-watcher/SKILL.md +67 -61
  104. package/skills/production-ready-hardener/SKILL.md +461 -455
  105. package/skills/project-context-mapper/SKILL.md +84 -78
  106. package/skills/pwa-offline-first-expert/SKILL.md +185 -0
  107. package/skills/python-programming-expert/SKILL.md +407 -401
  108. package/skills/rate-limit-abuse-prevention/SKILL.md +376 -370
  109. package/skills/realtime-collaboration-expert/SKILL.md +55 -1
  110. package/skills/rich-text-editor-expert/SKILL.md +177 -0
  111. package/skills/rust-programming-expert/SKILL.md +7 -1
  112. package/skills/saas-billing/SKILL.md +7 -1
  113. package/skills/saas-multi-tenant/SKILL.md +7 -1
  114. package/skills/saas-mvp-launcher/SKILL.md +20 -1
  115. package/skills/saas-transformer/SKILL.md +499 -488
  116. package/skills/scalability-clean-code/SKILL.md +7 -1
  117. package/skills/search-engine-expert/SKILL.md +89 -0
  118. package/skills/secure-fuzz-testing/SKILL.md +7 -1
  119. package/skills/self-evolving-memory-graph/SKILL.md +90 -74
  120. package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -57
  121. package/skills/senior-frontend/SKILL.md +141 -161
  122. package/skills/seo/SKILL.md +41 -17
  123. package/skills/session-context-loader/SKILL.md +82 -76
  124. package/skills/session-handoff-resume/SKILL.md +7 -1
  125. package/skills/{skill_baru → skill-baru}/SKILL.md +8 -2
  126. package/skills/solidjs-expert/SKILL.md +80 -0
  127. package/skills/spa-orchestrator/SKILL.md +20 -1
  128. package/skills/sse-websocket-streaming-expert/SKILL.md +93 -0
  129. package/skills/state-management-expert/SKILL.md +7 -1
  130. package/skills/supabase-migration/SKILL.md +47 -1
  131. package/skills/supabase-security-expert/SKILL.md +7 -1
  132. package/skills/svelte-sveltekit-expert/SKILL.md +91 -0
  133. package/skills/svg-animation-motion-expert/SKILL.md +115 -0
  134. package/skills/tailwind-expert/SKILL.md +88 -136
  135. package/skills/tanstack-query-expert/SKILL.md +7 -1
  136. package/skills/tauri-expert/SKILL.md +7 -1
  137. package/skills/token-saver/SKILL.md +1 -1
  138. package/skills/typescript-expert/SKILL.md +12 -6
  139. package/skills/ui-components-expert/SKILL.md +165 -279
  140. package/skills/ui-ux-pro-max/SKILL.md +23 -3
  141. package/skills/vector-db-rag-expert/SKILL.md +175 -19
  142. package/skills/vibe-code-gardener/SKILL.md +1 -1
  143. package/skills/visual-qa-vision-agent/SKILL.md +70 -64
  144. package/skills/voice-ai-realtime-agent/SKILL.md +202 -0
  145. package/skills/vue-frontend-expert/SKILL.md +131 -125
  146. package/skills/wasm-edge-computing-expert/SKILL.md +97 -0
  147. package/skills/web-3d-graphics-expert/SKILL.md +136 -130
  148. package/skills/web-game-engine-expert/SKILL.md +101 -95
  149. package/skills/web-scraper/SKILL.md +157 -207
  150. package/skills/website-design-cloner/SKILL.md +179 -173
  151. package/skills/webxr-ar-vr-expert/SKILL.md +122 -116
  152. package/skills/wordpress-headless-expert/SKILL.md +144 -0
  153. package/skills/zero-to-prod-orchestrator/SKILL.md +52 -27
  154. package/skills/zero-trust-secret-vault/SKILL.md +87 -39
  155. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  156. package/.github/workflows/publish.yml +0 -20
  157. package/CONTRIBUTING.md +0 -199
  158. package/SECURITY.md +0 -21
  159. package/banner.png +0 -0
  160. package/skills/autonomous-swarm-director/SKILL.md +0 -69
  161. package/skills/hyper-context-synthesizer/SKILL.md +0 -55
  162. package/skills/llm-cost-arbitrage-router/SKILL.md +0 -59
  163. package/skills/senior-fullstack/SKILL.md +0 -167
  164. package/skills/senior-fullstack/references/architecture_patterns.md +0 -160
  165. package/skills/senior-fullstack/references/development_workflows.md +0 -222
  166. package/skills/senior-fullstack/references/tech_stack_guide.md +0 -190
  167. package/skills/senior-fullstack/scripts/code_quality_analyzer.py +0 -114
  168. package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +0 -114
  169. package/skills/senior-fullstack/scripts/project_scaffolder.py +0 -114
  170. package/skills/seo-aeo-landing-page-writer/SKILL.md +0 -97
  171. package/skills/seo-geo/SKILL.md +0 -188
  172. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  173. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  174. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  175. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  176. package/skills/ui_ux_expert/SKILL.md +0 -125
  177. package/vibes-swarm-demo.gif +0 -0
@@ -1,160 +0,0 @@
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.
@@ -1,222 +0,0 @@
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.
@@ -1,190 +0,0 @@
1
- # Tech Stack Guide
2
-
3
- ## Overview
4
- This reference guide details production-grade tech stack patterns, concrete typescript implementations, and scaling strategies for React 19, Next.js 15, PostgreSQL, and connection pooling.
5
-
6
- ---
7
-
8
- ## Production Patterns & Practices
9
-
10
- ### 1. Server-First Next.js 15 Architecture
11
-
12
- Next.js 15 standardizes on React Server Components (RSC) by default. Data fetching is co-located with rendering, preventing waterfalls and saving significant client bandwidth.
13
-
14
- #### Pattern: Modular Layout & Data Fetching
15
-
16
- ```tsx
17
- // app/dashboard/layout.tsx
18
- import { ReactNode } from 'react';
19
- import { Sidebar } from '@/components/dashboard/sidebar';
20
- import { Header } from '@/components/dashboard/header';
21
-
22
- export default async function DashboardLayout({ children }: { children: ReactNode }) {
23
- return (
24
- <div className="flex h-screen overflow-hidden bg-slate-50">
25
- <Sidebar />
26
- <div className="flex flex-1 flex-col overflow-y-auto">
27
- <Header />
28
- <main className="p-6">{children}</main>
29
- </div>
30
- </div>
31
- );
32
- }
33
- ```
34
-
35
- ```tsx
36
- // app/dashboard/page.tsx
37
- import { Suspense } from 'react';
38
- import { db } from '@/lib/db';
39
- import { workspaces } from '@/lib/db/schema';
40
- import { auth } from '@clerk/nextjs/server';
41
- import { eq } from 'drizzle-orm';
42
- import { Skeleton } from '@/components/ui/skeleton';
43
- import { WorkspaceCard } from '@/components/dashboard/workspace-card';
44
-
45
- // Server-side dynamic fetching component
46
- async function WorkspaceList() {
47
- const { userId } = await auth();
48
- if (!userId) throw new Error('Unauthorized');
49
-
50
- const userWorkspaces = await db
51
- .select()
52
- .from(workspaces)
53
- .where(eq(workspaces.ownerId, userId));
54
-
55
- return (
56
- <div className="grid gap-4 md:grid-cols-3">
57
- {userWorkspaces.map((ws) => (
58
- <WorkspaceCard key={ws.id} workspace={ws} />
59
- ))}
60
- </div>
61
- );
62
- }
63
-
64
- export default function DashboardPage() {
65
- return (
66
- <div className="space-y-6">
67
- <h1 className="text-3xl font-bold">Your Workspaces</h1>
68
- <Suspense fallback={<div className="grid gap-4 md:grid-cols-3"><Skeleton className="h-32 w-full" /></div>}>
69
- <WorkspaceList />
70
- </Suspense>
71
- </div>
72
- );
73
- }
74
- ```
75
-
76
- ---
77
-
78
- ### 2. High-Performance PostgreSQL & Connection Pooling
79
-
80
- In a serverless runtime (e.g., Vercel / Netlify Functions), direct database connections spike exponentially during peak request loads. Employ transaction connection pooling (via Supabase Supavisor, PgBouncer, or Neon Serverless Driver) to recycle handles.
81
-
82
- #### Pattern: Multi-Client Connection Configuration (`lib/db/index.ts`)
83
-
84
- ```typescript
85
- import { drizzle } from 'drizzle-orm/postgres-js';
86
- import postgres from 'postgres';
87
- import * as schema from './schema';
88
-
89
- // Enforce single database client in development to prevent hot-reload socket exhaustion
90
- const globalForDb = globalThis as unknown as {
91
- conn: postgres.Sql | undefined;
92
- };
93
-
94
- // Use transaction pooling for high concurrent workloads
95
- const connectionString = process.env.DATABASE_URL!;
96
-
97
- const client = globalForDb.conn ?? postgres(connectionString, {
98
- max: process.env.DB_MAX_CONNECTIONS ? parseInt(process.env.DB_MAX_CONNECTIONS) : 10,
99
- prepare: false, // Set to false when utilizing Transaction poolers like pgBouncer/Supavisor
100
- idle_timeout: 20,
101
- connect_timeout: 10,
102
- });
103
-
104
- if (process.env.NODE_ENV !== 'production') {
105
- globalForDb.conn = client;
106
- }
107
-
108
- export const db = drizzle(client, { schema });
109
- ```
110
-
111
- ---
112
-
113
- ## Technical Guidelines & Guidelines
114
-
115
- ### Type-Safe REST Contracts
116
-
117
- Utilize Zod structures on both the client form schemas and the server-side Next.js route handlers to achieve full type safety across HTTP borders.
118
-
119
- ```typescript
120
- // lib/validators/auth.ts
121
- import { z } from 'zod';
122
-
123
- export const SignupSchema = z.object({
124
- email: z.string().email('Please supply a valid email address'),
125
- password: z.string().min(8, 'Password must contain at least 8 characters'),
126
- name: z.string().min(2, 'Name must contain at least 2 characters').optional(),
127
- });
128
-
129
- export type SignupInput = z.infer<typeof SignupSchema>;
130
- ```
131
-
132
- ```typescript
133
- // app/api/auth/signup/route.ts
134
- import { NextResponse } from 'next/server';
135
- import { SignupSchema } from '@/lib/validators/auth';
136
- import { db } from '@/lib/db';
137
- import { users } from '@/lib/db/schema';
138
- import { hash } from 'bcrypt';
139
-
140
- export async function POST(req: Request) {
141
- try {
142
- const body = await req.json();
143
- const result = SignupSchema.safeParse(body);
144
-
145
- if (!result.success) {
146
- return NextResponse.json({ error: result.error.format() }, { status: 400 });
147
- }
148
-
149
- const { email, password, name } = result.data;
150
-
151
- // Check if user already exists
152
- const existing = await db.query.users.findFirst({
153
- where: (u, { eq }) => eq(u.email, email),
154
- });
155
-
156
- if (existing) {
157
- return NextResponse.json({ error: 'User already exists' }, { status: 409 });
158
- }
159
-
160
- const hashedPassword = await hash(password, 12);
161
-
162
- const [newUser] = await db.insert(users).values({
163
- email,
164
- name,
165
- password: hashedPassword,
166
- }).returning();
167
-
168
- return NextResponse.json({ id: newUser.id, email: newUser.email, name: newUser.name }, { status: 201 });
169
- } catch (err) {
170
- return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 });
171
- }
172
- }
173
- ```
174
-
175
- ---
176
-
177
- ## Anti-Patterns to Avoid
178
-
179
- ### 🚫 Client-Side Waterfall Loading
180
- *Do not* chain individual API requests inside standard client-side `useEffect` declarations (e.g. Fetch user -> then fetch workspaces -> then fetch analytics).
181
- *Instead:* Prefetch parallel states via Next.js server components or leverage dynamic `Promise.all` scopes before returning client modules.
182
-
183
- ### 🚫 Global Database Client Hot Exhaustion
184
- *Do not* initialize fresh database connections inline inside database-consuming server functions.
185
- *Instead:* Maintain a shared, global db handle scoped correctly to check development hot-reloads.
186
-
187
- ---
188
-
189
- ## Conclusion
190
- Adhering to server-first Next.js models paired with secure pooled database connections will guarantee your fullstack applications execute fast, scale securely, and retain complete end-to-end type safety.
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Code Quality Analyzer
4
- Automated tool for senior fullstack tasks
5
- """
6
-
7
- import os
8
- import sys
9
- import json
10
- import argparse
11
- from pathlib import Path
12
- from typing import Dict, List, Optional
13
-
14
- class CodeQualityAnalyzer:
15
- """Main class for code quality analyzer functionality"""
16
-
17
- def __init__(self, target_path: str, verbose: bool = False):
18
- self.target_path = Path(target_path)
19
- self.verbose = verbose
20
- self.results = {}
21
-
22
- def run(self) -> Dict:
23
- """Execute the main functionality"""
24
- print(f"🚀 Running {self.__class__.__name__}...")
25
- print(f"📁 Target: {self.target_path}")
26
-
27
- try:
28
- self.validate_target()
29
- self.analyze()
30
- self.generate_report()
31
-
32
- print("✅ Completed successfully!")
33
- return self.results
34
-
35
- except Exception as e:
36
- print(f"❌ Error: {e}")
37
- sys.exit(1)
38
-
39
- def validate_target(self):
40
- """Validate the target path exists and is accessible"""
41
- if not self.target_path.exists():
42
- raise ValueError(f"Target path does not exist: {self.target_path}")
43
-
44
- if self.verbose:
45
- print(f"✓ Target validated: {self.target_path}")
46
-
47
- def analyze(self):
48
- """Perform the main analysis or operation"""
49
- if self.verbose:
50
- print("📊 Analyzing...")
51
-
52
- # Main logic here
53
- self.results['status'] = 'success'
54
- self.results['target'] = str(self.target_path)
55
- self.results['findings'] = []
56
-
57
- # Add analysis results
58
- if self.verbose:
59
- print(f"✓ Analysis complete: {len(self.results.get('findings', []))} findings")
60
-
61
- def generate_report(self):
62
- """Generate and display the report"""
63
- print("\n" + "="*50)
64
- print("REPORT")
65
- print("="*50)
66
- print(f"Target: {self.results.get('target')}")
67
- print(f"Status: {self.results.get('status')}")
68
- print(f"Findings: {len(self.results.get('findings', []))}")
69
- print("="*50 + "\n")
70
-
71
- def main():
72
- """Main entry point"""
73
- parser = argparse.ArgumentParser(
74
- description="Code Quality Analyzer"
75
- )
76
- parser.add_argument(
77
- 'target',
78
- help='Target path to analyze or process'
79
- )
80
- parser.add_argument(
81
- '--verbose', '-v',
82
- action='store_true',
83
- help='Enable verbose output'
84
- )
85
- parser.add_argument(
86
- '--json',
87
- action='store_true',
88
- help='Output results as JSON'
89
- )
90
- parser.add_argument(
91
- '--output', '-o',
92
- help='Output file path'
93
- )
94
-
95
- args = parser.parse_args()
96
-
97
- tool = CodeQualityAnalyzer(
98
- args.target,
99
- verbose=args.verbose
100
- )
101
-
102
- results = tool.run()
103
-
104
- if args.json:
105
- output = json.dumps(results, indent=2)
106
- if args.output:
107
- with open(args.output, 'w') as f:
108
- f.write(output)
109
- print(f"Results written to {args.output}")
110
- else:
111
- print(output)
112
-
113
- if __name__ == '__main__':
114
- main()