vibes-plug 1.0.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.
- package/.claude/rules/vibes-plug-core.md +32 -0
- package/.cursor/rules/vibes-plug-core.mdc +51 -0
- package/.cursorrules +42 -0
- package/AGENTS.md +96 -0
- package/BLUEPRINT.md +309 -125
- package/CHANGELOG.md +183 -1
- package/CLAUDE.md +70 -0
- package/LICENSE +1 -1
- package/README.md +641 -263
- package/index.js +19 -0
- package/package.json +61 -25
- package/plugin.json +24 -7
- package/scripts/generate_swarm_gif.py +295 -0
- package/scripts/install.js +201 -0
- package/skills/accessibility-testing-expert/SKILL.md +116 -0
- package/skills/ai-cost-token-optimizer/SKILL.md +82 -0
- package/skills/ai-evals-benchmark-expert/SKILL.md +188 -0
- package/skills/ai-llm-integration-expert/SKILL.md +147 -122
- package/skills/ai-media-generation-expert/SKILL.md +172 -0
- package/skills/ai-prompt-engineering-expert/SKILL.md +84 -0
- package/skills/angular-expert/SKILL.md +148 -0
- package/skills/api-design-expert/SKILL.md +316 -309
- package/skills/api-gateway-proxy-expert/SKILL.md +81 -0
- package/skills/app-analyzer-optimizer/SKILL.md +195 -188
- package/skills/apple-ecosystem-expert/SKILL.md +145 -0
- package/skills/{asisten_ramah → asisten-ramah}/SKILL.md +7 -1
- package/skills/astro-framework-expert/SKILL.md +200 -0
- package/skills/async-queue-temporal-expert/SKILL.md +240 -0
- package/skills/authentication-identity-expert/SKILL.md +279 -45
- package/skills/auto-doc-updater/SKILL.md +219 -203
- package/skills/autonomous-chaos-monkey/SKILL.md +63 -0
- package/skills/autonomous-red-teamer/SKILL.md +203 -0
- package/skills/autonomous-tdd-debugger/SKILL.md +71 -0
- package/skills/background-jobs-queue-expert/SKILL.md +235 -0
- package/skills/biome-linter-formatter-expert/SKILL.md +89 -0
- package/skills/blockchain-web3-expert/SKILL.md +115 -0
- package/skills/bootstrap-to-modern/SKILL.md +93 -86
- package/skills/brainstorming/SKILL.md +381 -353
- package/skills/browser-automation-expert/SKILL.md +222 -0
- package/skills/bun-runtime-expert/SKILL.md +7 -1
- package/skills/chatbot-messaging-expert/SKILL.md +114 -0
- package/skills/ci-cd-devops-architect/SKILL.md +81 -45
- package/skills/cloud-hosting-expert/SKILL.md +249 -243
- package/skills/coderabbit/SKILL.md +197 -191
- package/skills/compliance-gdpr-privacy-expert/SKILL.md +85 -0
- package/skills/cron-scheduler-expert/SKILL.md +304 -0
- package/skills/data-pipeline-etl-expert/SKILL.md +84 -0
- package/skills/data-telemetry-expert/SKILL.md +218 -212
- package/skills/data-visualization-expert/SKILL.md +154 -0
- package/skills/database-migration-versioning-expert/SKILL.md +90 -0
- package/skills/database-orm-expert/SKILL.md +303 -293
- package/skills/dependency-upgrade-migrator/SKILL.md +301 -0
- package/skills/design-system-architect/SKILL.md +278 -242
- package/skills/desktop-electron-expert/SKILL.md +128 -0
- package/skills/documentation-site-expert/SKILL.md +59 -0
- package/skills/doku-mcp-server/SKILL.md +257 -0
- package/skills/doku-payment-gateway/SKILL.md +233 -0
- package/skills/domain-driven-design-expert/SKILL.md +82 -0
- package/skills/e2e-testing-expert/SKILL.md +320 -314
- package/skills/ecommerce-expert/SKILL.md +87 -0
- package/skills/edge-serverless-db-expert/SKILL.md +99 -0
- package/skills/email-notification-expert/SKILL.md +368 -0
- package/skills/error-resilience-expert/SKILL.md +486 -0
- package/skills/event-driven-architect/SKILL.md +86 -80
- package/skills/feature-flag-analytics-expert/SKILL.md +66 -0
- package/skills/file-upload-media-expert/SKILL.md +437 -0
- package/skills/firebase-security-expert/SKILL.md +7 -1
- package/skills/form-validation-expert/SKILL.md +407 -0
- package/skills/fullstack-expert/SKILL.md +260 -201
- package/skills/fullstack-expert/references/api_design_guide.md +466 -466
- package/skills/fullstack-expert/references/multi_language_backend.md +528 -528
- package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -253
- package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -326
- package/skills/gemini-agent-booster/SKILL.md +142 -104
- package/skills/geospatial-maps-expert/SKILL.md +80 -0
- package/skills/global-a11y-i18n-expert/SKILL.md +86 -80
- package/skills/glsl-shader-expert/SKILL.md +107 -0
- package/skills/go-programming-expert/SKILL.md +300 -294
- package/skills/graph-rag-knowledge-expert/SKILL.md +159 -0
- package/skills/graphql-apollo-expert/SKILL.md +114 -0
- package/skills/headless-cms-expert/SKILL.md +181 -0
- package/skills/hig/SKILL.md +193 -187
- package/skills/js-backend-expert/SKILL.md +218 -191
- package/skills/legacy-code-translator/SKILL.md +71 -0
- package/skills/local-slm-edge-ai-expert/SKILL.md +167 -0
- package/skills/logging-error-tracking-expert/SKILL.md +344 -0
- package/skills/mcp-client-orchestrator/SKILL.md +76 -0
- package/skills/mcp-server-architect/SKILL.md +226 -126
- package/skills/micro-frontend-architect/SKILL.md +112 -0
- package/skills/mobile-expo-expert/SKILL.md +191 -185
- package/skills/mobile-push-notification-expert/SKILL.md +71 -0
- package/skills/modern-css-native-expert/SKILL.md +189 -0
- package/skills/monday-design-aesthetic/SKILL.md +72 -66
- package/skills/monorepo-architect/SKILL.md +232 -226
- package/skills/mpa-orchestrator/SKILL.md +120 -101
- package/skills/multi-agent-orchestration/SKILL.md +173 -153
- package/skills/multiple-entry-points/SKILL.md +91 -55
- package/skills/mvc-expert/SKILL.md +237 -231
- package/skills/n8n-automation-expert/SKILL.md +89 -0
- package/skills/nextjs-app-router-expert/SKILL.md +148 -0
- package/skills/openapi-swagger-codegen-expert/SKILL.md +67 -0
- package/skills/payment-gateway-expert/SKILL.md +129 -45
- package/skills/pdf-document-generation-expert/SKILL.md +91 -0
- package/skills/performance-web-vitals/SKILL.md +337 -331
- package/skills/post-quantum-crypto-migrator/SKILL.md +57 -0
- package/skills/prd-architect/SKILL.md +206 -190
- package/skills/proactive-background-watcher/SKILL.md +68 -0
- package/skills/production-ready-hardener/PRODUCTION_READINESS_REPORT.md +67 -0
- package/skills/production-ready-hardener/SKILL.md +461 -468
- package/skills/production-ready-hardener/references/production_checklist.md +161 -161
- package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +881 -875
- package/skills/project-context-mapper/SKILL.md +85 -0
- package/skills/pwa-offline-first-expert/SKILL.md +185 -0
- package/skills/python-programming-expert/SKILL.md +407 -270
- package/skills/rate-limit-abuse-prevention/SKILL.md +377 -0
- package/skills/realtime-collaboration-expert/SKILL.md +99 -45
- package/skills/rich-text-editor-expert/SKILL.md +177 -0
- package/skills/rust-programming-expert/SKILL.md +240 -234
- package/skills/saas-billing/SKILL.md +382 -376
- package/skills/saas-multi-tenant/SKILL.md +256 -236
- package/skills/saas-mvp-launcher/SKILL.md +30 -1
- package/skills/saas-transformer/SKILL.md +499 -445
- package/skills/saas-transformer/references/billing_integration_guide.md +401 -401
- package/skills/saas-transformer/references/feature_gating_patterns.md +137 -137
- package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -121
- package/skills/saas-transformer/scripts/saas_transformation_scanner.py +39 -29
- package/skills/scalability-clean-code/SKILL.md +234 -228
- package/skills/search-engine-expert/SKILL.md +89 -0
- package/skills/secure-fuzz-testing/SKILL.md +7 -1
- package/skills/self-evolving-memory-graph/SKILL.md +91 -0
- package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -0
- package/skills/senior-frontend/SKILL.md +85 -105
- package/skills/seo/SKILL.md +258 -224
- package/skills/session-context-loader/SKILL.md +83 -0
- package/skills/session-handoff-resume/SKILL.md +163 -157
- package/skills/{skill_baru → skill-baru}/SKILL.md +177 -146
- package/skills/solidjs-expert/SKILL.md +80 -0
- package/skills/spa-orchestrator/SKILL.md +306 -287
- package/skills/sse-websocket-streaming-expert/SKILL.md +93 -0
- package/skills/state-management-expert/SKILL.md +277 -271
- package/skills/supabase-migration/SKILL.md +47 -1
- package/skills/supabase-security-expert/SKILL.md +248 -242
- package/skills/svelte-sveltekit-expert/SKILL.md +91 -0
- package/skills/svg-animation-motion-expert/SKILL.md +115 -0
- package/skills/tailwind-expert/SKILL.md +139 -187
- package/skills/tanstack-query-expert/SKILL.md +204 -198
- package/skills/tauri-expert/SKILL.md +7 -1
- package/skills/token-saver/SKILL.md +118 -110
- package/skills/typescript-expert/SKILL.md +329 -278
- package/skills/ui-components-expert/SKILL.md +166 -63
- package/skills/ui-ux-pro-max/SKILL.md +221 -200
- package/skills/vector-db-rag-expert/SKILL.md +208 -0
- package/skills/vibe-code-gardener/SKILL.md +180 -172
- package/skills/visual-qa-vision-agent/SKILL.md +71 -0
- package/skills/voice-ai-realtime-agent/SKILL.md +202 -0
- package/skills/vue-frontend-expert/SKILL.md +132 -0
- package/skills/wasm-edge-computing-expert/SKILL.md +97 -0
- package/skills/web-3d-graphics-expert/SKILL.md +137 -0
- package/skills/web-game-engine-expert/SKILL.md +102 -0
- package/skills/web-scraper/SKILL.md +98 -146
- package/skills/website-design-cloner/SKILL.md +180 -0
- package/skills/webxr-ar-vr-expert/SKILL.md +123 -0
- package/skills/wordpress-headless-expert/SKILL.md +144 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +231 -180
- package/skills/zero-trust-secret-vault/SKILL.md +88 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/CONTRIBUTING.md +0 -199
- package/SECURITY.md +0 -21
- package/banner.png +0 -0
- package/skills/senior-fullstack/SKILL.md +0 -167
- package/skills/senior-fullstack/references/architecture_patterns.md +0 -160
- package/skills/senior-fullstack/references/development_workflows.md +0 -222
- package/skills/senior-fullstack/references/tech_stack_guide.md +0 -190
- package/skills/senior-fullstack/scripts/code_quality_analyzer.py +0 -114
- package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +0 -114
- package/skills/senior-fullstack/scripts/project_scaffolder.py +0 -114
- package/skills/seo-aeo-landing-page-writer/SKILL.md +0 -97
- package/skills/seo-geo/SKILL.md +0 -188
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
- package/skills/ui_ux_expert/SKILL.md +0 -114
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zero-trust-secret-vault
|
|
3
|
+
description: "Expert guide for Zero-Trust Secret Management (Infisical, HashiCorp Vault, Doppler), automated API key rotation, and environment security / Panduan ahli manajemen rahasia Zero-Trust, rotasi kunci API, dan keamanan variabel lingkungan."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Zero-Trust Secret Vault & Credential Security Expert
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Purpose & Overview
|
|
17
|
+
Production-grade security standards for managing application secrets, environment variables, API keys, database credentials, and TLS certificates using Zero-Trust Secret Managers — Infisical, HashiCorp Vault, and Doppler — featuring automated secret rotation, dynamic credentials, and zero plain-text leaks in repositories or CI/CD pipelines.
|
|
18
|
+
|
|
19
|
+
### Key Capabilities
|
|
20
|
+
- **Zero Plain-Text Secrets**: Injecting encrypted secrets at runtime without storing `.env` files in production artifacts.
|
|
21
|
+
- **Automated Rotation**: Programmatic rotation of API keys, JWT secrets, and database passwords.
|
|
22
|
+
- **Audit Logging**: Tracking secret access, version history, and permission policies across development teams.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Infisical CLI Runtime Secret Injection
|
|
26
|
+
infisical run -- env | grep DATABASE_URL
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Implementation Checklist
|
|
30
|
+
- [ ] Install Infisical CLI or Vault agent in the deployment environment.
|
|
31
|
+
- [ ] Map environment variables (Development, Staging, Production) in the Secret Manager.
|
|
32
|
+
- [ ] Configure CI/CD pipeline to inject secrets dynamically rather than using `.env` files.
|
|
33
|
+
- [ ] Set up auto-rotation for database credentials and high-privilege API keys (e.g., every 30 days).
|
|
34
|
+
|
|
35
|
+
### Example: Node.js Infisical SDK
|
|
36
|
+
```javascript
|
|
37
|
+
import { InfisicalClient } from "@infisical/sdk";
|
|
38
|
+
|
|
39
|
+
const client = new InfisicalClient({
|
|
40
|
+
clientId: process.env.INFISICAL_CLIENT_ID,
|
|
41
|
+
clientSecret: process.env.INFISICAL_CLIENT_SECRET
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const dbPassword = await client.getSecret("DATABASE_PASSWORD", {
|
|
45
|
+
environment: "prod",
|
|
46
|
+
path: "/database"
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Orchestration & Integration
|
|
51
|
+
- Integrates with: `ci-cd-devops-architect`, `authentication-identity-expert`, `mcp-server-architect`.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
<a name="bahasa-indonesia"></a>
|
|
56
|
+
## Bahasa Indonesia
|
|
57
|
+
|
|
58
|
+
### Deskripsi
|
|
59
|
+
Standar keamanan tingkat produksi untuk pengelolaan rahasia aplikasi, variabel lingkungan, kunci API, kredensial database, dan sertifikat TLS menggunakan Secret Manager Zero-Trust — Infisical, HashiCorp Vault, dan Doppler — dengan rotasi rahasia otomatis dan jaminan tanpa kebocoran teks polos di repositori atau pipeline CI/CD.
|
|
60
|
+
|
|
61
|
+
### Fitur Utama
|
|
62
|
+
- **Zero Plain-Text Secrets**: Injeksi rahasia terenkripsi saat runtime tanpa menyimpan file `.env` di artefak produksi.
|
|
63
|
+
- **Rotasi Otomatis**: Rotasi terprogram untuk kunci API, rahasia JWT, dan kata sandi database.
|
|
64
|
+
- **Audit Logging**: Pelacakan akses rahasia, riwayat versi, dan kebijakan izin di seluruh tim pengembangan.
|
|
65
|
+
|
|
66
|
+
### Checklist Implementasi
|
|
67
|
+
- [ ] Instal Infisical CLI atau agen Vault di lingkungan deployment.
|
|
68
|
+
- [ ] Petakan variabel lingkungan (Development, Staging, Production) di Secret Manager.
|
|
69
|
+
- [ ] Konfigurasi pipeline CI/CD untuk menyuntikkan rahasia secara dinamis (jangan gunakan file `.env`).
|
|
70
|
+
- [ ] Atur rotasi otomatis untuk kredensial database dan kunci API berhak istimewa (misal: setiap 30 hari).
|
|
71
|
+
|
|
72
|
+
### Contoh: Node.js Infisical SDK
|
|
73
|
+
```javascript
|
|
74
|
+
import { InfisicalClient } from "@infisical/sdk";
|
|
75
|
+
|
|
76
|
+
const client = new InfisicalClient({
|
|
77
|
+
clientId: process.env.INFISICAL_CLIENT_ID,
|
|
78
|
+
clientSecret: process.env.INFISICAL_CLIENT_SECRET
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const dbPassword = await client.getSecret("DATABASE_PASSWORD", {
|
|
82
|
+
environment: "prod",
|
|
83
|
+
path: "/database"
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Integrasi Orkestrasi
|
|
88
|
+
- Terintegrasi dengan: `ci-cd-devops-architect`, `authentication-identity-expert`, `mcp-server-architect`.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Feature request
|
|
3
|
-
about: Suggest an idea for this project
|
|
4
|
-
title: ''
|
|
5
|
-
labels: ''
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Is your feature request related to a problem? Please describe.**
|
|
11
|
-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
-
|
|
13
|
-
**Describe the solution you'd like**
|
|
14
|
-
A clear and concise description of what you want to happen.
|
|
15
|
-
|
|
16
|
-
**Describe alternatives you've considered**
|
|
17
|
-
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
-
|
|
19
|
-
**Additional context**
|
|
20
|
-
Add any other context or screenshots about the feature request here.
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
# Contribution Guide / Panduan Kontribusi
|
|
2
|
-
|
|
3
|
-
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<a name="english"></a>
|
|
8
|
-
## English
|
|
9
|
-
|
|
10
|
-
Thank you for contributing to **Vibes Plug**! This guide is designed to make it easy for you if you have *forked* this repository on GitHub to add or update *skills* according to proper standards.
|
|
11
|
-
|
|
12
|
-
### Contribution Flow (Step-by-Step)
|
|
13
|
-
|
|
14
|
-
#### 1. Sync Your Local Repository
|
|
15
|
-
Ensure your local repository is connected to the main repository (*upstream*) to get the latest updates.
|
|
16
|
-
|
|
17
|
-
If you haven't added the main repository as an *upstream* remote, run the following command in your terminal/PowerShell inside the `vibes-plug` directory:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Add upstream remote
|
|
21
|
-
git remote add upstream https://github.com/roedyrustam/vibes-plug.git
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Before you start creating a new skill, sync your local `main` branch with upstream:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
# Switch to main branch
|
|
28
|
-
git checkout main
|
|
29
|
-
|
|
30
|
-
# Pull the latest updates from upstream
|
|
31
|
-
git pull upstream main
|
|
32
|
-
|
|
33
|
-
# Sync it to your GitHub fork (origin)
|
|
34
|
-
git push origin main
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
#### 2. Create a New Branch
|
|
38
|
-
Always create a new, descriptive branch for the changes you want to make:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
git checkout -b feat/add-skill-<skill-name>
|
|
42
|
-
# Example: git checkout -b feat/add-skill-fast-api
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
#### 3. Create a New Skill Module
|
|
46
|
-
1. Navigate to the `skills/` directory.
|
|
47
|
-
2. Create a new folder with your skill name using **kebab-case** (e.g., `skills/fast-api`).
|
|
48
|
-
3. Create a `SKILL.md` file inside that folder. You can copy the template from [SKILL.md](file:///c:/Users/roedy/.gemini/config/plugins/vibes-plug/skills/skill_baru/SKILL.md).
|
|
49
|
-
|
|
50
|
-
Set up the metadata (frontmatter) at the very top of the `SKILL.md` file:
|
|
51
|
-
|
|
52
|
-
```yaml
|
|
53
|
-
---
|
|
54
|
-
name: kebab-case-skill-name
|
|
55
|
-
description: "Short English description / Deskripsi singkat"
|
|
56
|
-
author: "Your Name or GitHub Username"
|
|
57
|
-
---
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
The document body must have the following sections:
|
|
61
|
-
- `# Skill Name`
|
|
62
|
-
- `## Description`
|
|
63
|
-
- `## Instructions` (Contains detailed guidelines, code styling rules, etc.)
|
|
64
|
-
- `## Trigger Conditions` (Conditions/context under which this skill should be activated by the agent)
|
|
65
|
-
|
|
66
|
-
#### 4. Register the Skill in README.md and BLUEPRINT.md
|
|
67
|
-
To make your new skill recognized and easily discoverable:
|
|
68
|
-
1. **`README.md`**: Register your skill in the **Features and Available Skills** section under the relevant category.
|
|
69
|
-
2. **`BLUEPRINT.md`**: Register your skill module in the **Skill Modules** section.
|
|
70
|
-
|
|
71
|
-
#### 5. Run the Standardization Script
|
|
72
|
-
We provide an automated script to format markdown, align technology stack versions (e.g., React 19, Next.js 15), and fix emoji encoding issues.
|
|
73
|
-
|
|
74
|
-
Run the following command before committing:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
node scripts/update_skills.js
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Ensure the script runs successfully and check if any of your new skill files were updated.
|
|
81
|
-
|
|
82
|
-
#### 6. Commit and Push Changes
|
|
83
|
-
Once everything is neat and validated, commit your changes:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
git add .
|
|
87
|
-
git commit -m "feat: add skill <skill-name>"
|
|
88
|
-
git push origin feat/add-skill-<skill-name>
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
#### 7. Create a Pull Request (PR)
|
|
92
|
-
1. Open your forked repository page on GitHub (e.g., `https://github.com/username/vibes-plug`).
|
|
93
|
-
2. You will see a yellow button saying **"Compare & pull request"**. Click that button.
|
|
94
|
-
3. Provide a clear description of the purpose and utility of the skill you added.
|
|
95
|
-
4. Submit your Pull Request (PR) to the `main` branch of the original repository (`roedyrustam/vibes-plug`).
|
|
96
|
-
|
|
97
|
-
### Additional Rules & Tips
|
|
98
|
-
> [!NOTE]
|
|
99
|
-
> - Ensure instructions are written in a clear and instructive language.
|
|
100
|
-
> - Avoid duplicate instructions with existing skills. If your skill is similar, consider updating an existing skill instead.
|
|
101
|
-
> - Do not include extra frontmatter fields other than `name`, `description`, and `author`, as they will be cleaned automatically by the `update_skills.js` script.
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
<a name="bahasa-indonesia"></a>
|
|
106
|
-
## Bahasa Indonesia
|
|
107
|
-
|
|
108
|
-
Terima kasih telah berkontribusi ke **Vibes Plug**! Panduan ini dirancang khusus untuk mempermudah Anda yang telah melakukan *fork* repositori ini di GitHub agar dapat menambahkan atau memperbarui *skills* dengan standar yang sesuai.
|
|
109
|
-
|
|
110
|
-
### Alur Kontribusi (Step-by-Step)
|
|
111
|
-
|
|
112
|
-
#### 1. Sinkronisasi Repositori Lokal Anda
|
|
113
|
-
Pastikan repositori lokal Anda terhubung dengan repositori utama (*upstream*) agar selalu mendapatkan pembaruan terbaru.
|
|
114
|
-
|
|
115
|
-
Jika Anda belum menambahkan repositori utama sebagai *upstream*, jalankan perintah berikut di terminal/PowerShell di dalam direktori `vibes-plug`:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
# Tambahkan remote upstream
|
|
119
|
-
git remote add upstream https://github.com/roedyrustam/vibes-plug.git
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
Sebelum mulai membuat skill baru, lakukan sinkronisasi branch `main` lokal Anda dengan upstream:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Pindah ke branch main
|
|
126
|
-
git checkout main
|
|
127
|
-
|
|
128
|
-
# Tarik pembaruan terbaru dari upstream
|
|
129
|
-
git pull upstream main
|
|
130
|
-
|
|
131
|
-
# Sinkronisasikan ke fork GitHub Anda (origin)
|
|
132
|
-
git push origin main
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
#### 2. Buat Branch Baru
|
|
136
|
-
Selalu buat branch baru yang deskriptif untuk perubahan yang ingin Anda lakukan:
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
git checkout -b feat/add-skill-<nama-skill>
|
|
140
|
-
# Contoh: git checkout -b feat/add-skill-fast-api
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
#### 3. Buat Modul Skill Baru
|
|
144
|
-
1. Masuk ke direktori `skills/`.
|
|
145
|
-
2. Buat folder baru dengan nama skill Anda menggunakan format **kebab-case** (misalnya `skills/fast-api`).
|
|
146
|
-
3. Buat file `SKILL.md` di dalam folder tersebut. Anda bisa menyalin template dari [SKILL.md](file:///c:/Users/roedy/.gemini/config/plugins/vibes-plug/skills/skill_baru/SKILL.md).
|
|
147
|
-
|
|
148
|
-
Atur format metadata (frontmatter) di bagian paling atas file `SKILL.md`:
|
|
149
|
-
|
|
150
|
-
```yaml
|
|
151
|
-
---
|
|
152
|
-
name: nama-skill-kebab-case
|
|
153
|
-
description: "Deskripsi singkat / Short description"
|
|
154
|
-
author: "Nama Anda atau Username GitHub"
|
|
155
|
-
---
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Struktur isi dokumen harus memiliki bagian berikut:
|
|
159
|
-
- `# Nama Skill`
|
|
160
|
-
- `## Deskripsi`
|
|
161
|
-
- `## Instruksi` (Berisi panduan detail, aturan penulisan kode, dll.)
|
|
162
|
-
- `## Kondisi Pemicu` (Kondisi/konteks kapan skill ini harus diaktifkan oleh agen)
|
|
163
|
-
|
|
164
|
-
#### 4. Daftarkan Skill di README.md dan BLUEPRINT.md
|
|
165
|
-
Agar skill baru Anda dikenali dan mudah ditemukan:
|
|
166
|
-
1. **`README.md`**: Daftarkan skill Anda di bagian **Fitur dan Skills yang Tersedia** di bawah kategori yang relevan.
|
|
167
|
-
2. **`BLUEPRINT.md`**: Daftarkan modul skill Anda di bagian **Skill Modules**.
|
|
168
|
-
|
|
169
|
-
#### 5. Jalankan Script Standardisasi
|
|
170
|
-
Kami menyediakan script otomatis untuk merapikan markdown, menyelaraskan versi stack teknologi (misal React 19, Next.js 15), serta memperbaiki isu encoding emoji.
|
|
171
|
-
|
|
172
|
-
Jalankan perintah berikut sebelum melakukan commit:
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
node scripts/update_skills.js
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Pastikan script berjalan dengan sukses dan laporkan jika ada file skill baru Anda yang diperbarui.
|
|
179
|
-
|
|
180
|
-
#### 6. Commit dan Push Perubahan
|
|
181
|
-
Setelah semuanya rapi dan tervalidasi, commit perubahan Anda:
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
git add .
|
|
185
|
-
git commit -m "feat: add skill <nama-skill>"
|
|
186
|
-
git push origin feat/add-skill-<nama-skill>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
#### 7. Buat Pull Request (PR)
|
|
190
|
-
1. Buka halaman repositori hasil fork Anda di GitHub (misal: `https://github.com/username/vibes-plug`).
|
|
191
|
-
2. Anda akan melihat tombol kuning bertuliskan **"Compare & pull request"**. Klik tombol tersebut.
|
|
192
|
-
3. Berikan deskripsi yang jelas mengenai tujuan dan kegunaan dari skill yang Anda tambahkan.
|
|
193
|
-
4. Kirim Pull Request (PR) Anda ke branch `main` repositori asal (`roedyrustam/vibes-plug`).
|
|
194
|
-
|
|
195
|
-
### Aturan Tambahan & Tips
|
|
196
|
-
> [!NOTE]
|
|
197
|
-
> - Pastikan instruksi ditulis dengan bahasa yang jelas dan instruktif.
|
|
198
|
-
> - Hindari duplikasi instruksi dengan skill yang sudah ada. Jika skill Anda mirip, pertimbangkan untuk memperbarui skill yang telah ada.
|
|
199
|
-
> - Jangan menyertakan frontmatter tambahan di luar `name`, `description`, dan `author`, karena akan dibersihkan secara otomatis oleh script `update_skills.js`.
|
package/SECURITY.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Supported Versions
|
|
4
|
-
|
|
5
|
-
Use this section to tell people about which versions of your project are
|
|
6
|
-
currently being supported with security updates.
|
|
7
|
-
|
|
8
|
-
| Version | Supported |
|
|
9
|
-
| ------- | ------------------ |
|
|
10
|
-
| 5.1.x | :white_check_mark: |
|
|
11
|
-
| 5.0.x | :x: |
|
|
12
|
-
| 4.0.x | :white_check_mark: |
|
|
13
|
-
| < 4.0 | :x: |
|
|
14
|
-
|
|
15
|
-
## Reporting a Vulnerability
|
|
16
|
-
|
|
17
|
-
Use this section to tell people how to report a vulnerability.
|
|
18
|
-
|
|
19
|
-
Tell them where to go, how often they can expect to get an update on a
|
|
20
|
-
reported vulnerability, what to expect if the vulnerability is accepted or
|
|
21
|
-
declined, etc.
|
package/banner.png
DELETED
|
Binary file
|
|
@@ -1,167 +0,0 @@
|
|
|
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`.
|
|
@@ -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.
|