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.
- 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 +37 -7
- package/BLUEPRINT.md +309 -217
- package/CHANGELOG.md +133 -1
- package/CLAUDE.md +70 -0
- package/LICENSE +1 -1
- package/README.md +641 -415
- package/index.js +19 -0
- package/package.json +44 -8
- 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 -52
- package/skills/ai-evals-benchmark-expert/SKILL.md +188 -0
- package/skills/ai-llm-integration-expert/SKILL.md +185 -178
- 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 +6 -3
- package/skills/api-gateway-proxy-expert/SKILL.md +81 -0
- package/skills/app-analyzer-optimizer/SKILL.md +6 -3
- package/skills/apple-ecosystem-expert/SKILL.md +144 -141
- 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 +210 -24
- package/skills/authentication-identity-expert/SKILL.md +278 -275
- package/skills/auto-doc-updater/SKILL.md +7 -1
- package/skills/autonomous-chaos-monkey/SKILL.md +63 -63
- package/skills/autonomous-red-teamer/SKILL.md +172 -28
- package/skills/autonomous-tdd-debugger/SKILL.md +70 -64
- 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 +9 -6
- package/skills/brainstorming/SKILL.md +58 -50
- package/skills/browser-automation-expert/SKILL.md +197 -21
- 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 +45 -36
- package/skills/cloud-hosting-expert/SKILL.md +7 -1
- package/skills/coderabbit/SKILL.md +7 -1
- package/skills/compliance-gdpr-privacy-expert/SKILL.md +85 -0
- package/skills/cron-scheduler-expert/SKILL.md +303 -297
- package/skills/data-pipeline-etl-expert/SKILL.md +84 -0
- package/skills/data-telemetry-expert/SKILL.md +7 -1
- 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 +13 -3
- package/skills/dependency-upgrade-migrator/SKILL.md +300 -294
- package/skills/design-system-architect/SKILL.md +278 -259
- 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 +7 -1
- package/skills/doku-payment-gateway/SKILL.md +7 -1
- package/skills/domain-driven-design-expert/SKILL.md +82 -0
- package/skills/e2e-testing-expert/SKILL.md +7 -1
- package/skills/ecommerce-expert/SKILL.md +87 -0
- package/skills/edge-serverless-db-expert/SKILL.md +98 -42
- package/skills/email-notification-expert/SKILL.md +367 -361
- package/skills/error-resilience-expert/SKILL.md +485 -479
- package/skills/event-driven-architect/SKILL.md +7 -1
- package/skills/feature-flag-analytics-expert/SKILL.md +65 -45
- package/skills/file-upload-media-expert/SKILL.md +436 -430
- package/skills/firebase-security-expert/SKILL.md +7 -1
- package/skills/form-validation-expert/SKILL.md +406 -400
- package/skills/fullstack-expert/SKILL.md +60 -1
- package/skills/gemini-agent-booster/SKILL.md +173 -135
- package/skills/geospatial-maps-expert/SKILL.md +80 -0
- package/skills/global-a11y-i18n-expert/SKILL.md +7 -1
- package/skills/glsl-shader-expert/SKILL.md +106 -100
- package/skills/go-programming-expert/SKILL.md +21 -15
- package/skills/graph-rag-knowledge-expert/SKILL.md +159 -0
- package/skills/graphql-apollo-expert/SKILL.md +113 -107
- package/skills/headless-cms-expert/SKILL.md +181 -0
- package/skills/hig/SKILL.md +7 -1
- package/skills/js-backend-expert/SKILL.md +218 -216
- package/skills/legacy-code-translator/SKILL.md +70 -64
- package/skills/local-slm-edge-ai-expert/SKILL.md +167 -0
- package/skills/logging-error-tracking-expert/SKILL.md +343 -337
- package/skills/mcp-client-orchestrator/SKILL.md +75 -69
- package/skills/mcp-server-architect/SKILL.md +294 -194
- package/skills/micro-frontend-architect/SKILL.md +111 -105
- package/skills/mobile-expo-expert/SKILL.md +8 -2
- package/skills/mobile-push-notification-expert/SKILL.md +70 -50
- package/skills/modern-css-native-expert/SKILL.md +189 -0
- package/skills/monday-design-aesthetic/SKILL.md +7 -1
- package/skills/monorepo-architect/SKILL.md +7 -1
- package/skills/mpa-orchestrator/SKILL.md +20 -1
- package/skills/multi-agent-orchestration/SKILL.md +254 -234
- package/skills/multiple-entry-points/SKILL.md +37 -1
- package/skills/mvc-expert/SKILL.md +7 -1
- 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 +85 -1
- package/skills/pdf-document-generation-expert/SKILL.md +91 -0
- package/skills/performance-web-vitals/SKILL.md +7 -1
- package/skills/post-quantum-crypto-migrator/SKILL.md +57 -57
- package/skills/prd-architect/SKILL.md +7 -1
- package/skills/proactive-background-watcher/SKILL.md +67 -61
- package/skills/production-ready-hardener/SKILL.md +461 -455
- package/skills/project-context-mapper/SKILL.md +84 -78
- package/skills/pwa-offline-first-expert/SKILL.md +185 -0
- package/skills/python-programming-expert/SKILL.md +407 -401
- package/skills/rate-limit-abuse-prevention/SKILL.md +376 -370
- package/skills/realtime-collaboration-expert/SKILL.md +55 -1
- package/skills/rich-text-editor-expert/SKILL.md +177 -0
- package/skills/rust-programming-expert/SKILL.md +7 -1
- package/skills/saas-billing/SKILL.md +7 -1
- package/skills/saas-multi-tenant/SKILL.md +7 -1
- package/skills/saas-mvp-launcher/SKILL.md +20 -1
- package/skills/saas-transformer/SKILL.md +499 -488
- package/skills/scalability-clean-code/SKILL.md +7 -1
- 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 +90 -74
- package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -57
- package/skills/senior-frontend/SKILL.md +141 -161
- package/skills/seo/SKILL.md +41 -17
- package/skills/session-context-loader/SKILL.md +82 -76
- package/skills/session-handoff-resume/SKILL.md +7 -1
- package/skills/{skill_baru → skill-baru}/SKILL.md +8 -2
- package/skills/solidjs-expert/SKILL.md +80 -0
- package/skills/spa-orchestrator/SKILL.md +20 -1
- package/skills/sse-websocket-streaming-expert/SKILL.md +93 -0
- package/skills/state-management-expert/SKILL.md +7 -1
- package/skills/supabase-migration/SKILL.md +47 -1
- package/skills/supabase-security-expert/SKILL.md +7 -1
- 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 +88 -136
- package/skills/tanstack-query-expert/SKILL.md +7 -1
- package/skills/tauri-expert/SKILL.md +7 -1
- package/skills/token-saver/SKILL.md +1 -1
- package/skills/typescript-expert/SKILL.md +12 -6
- package/skills/ui-components-expert/SKILL.md +165 -279
- package/skills/ui-ux-pro-max/SKILL.md +23 -3
- package/skills/vector-db-rag-expert/SKILL.md +175 -19
- package/skills/vibe-code-gardener/SKILL.md +1 -1
- package/skills/visual-qa-vision-agent/SKILL.md +70 -64
- package/skills/voice-ai-realtime-agent/SKILL.md +202 -0
- package/skills/vue-frontend-expert/SKILL.md +131 -125
- package/skills/wasm-edge-computing-expert/SKILL.md +97 -0
- package/skills/web-3d-graphics-expert/SKILL.md +136 -130
- package/skills/web-game-engine-expert/SKILL.md +101 -95
- package/skills/web-scraper/SKILL.md +157 -207
- package/skills/website-design-cloner/SKILL.md +179 -173
- package/skills/webxr-ar-vr-expert/SKILL.md +122 -116
- package/skills/wordpress-headless-expert/SKILL.md +144 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +52 -27
- package/skills/zero-trust-secret-vault/SKILL.md +87 -39
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/publish.yml +0 -20
- package/CONTRIBUTING.md +0 -199
- package/SECURITY.md +0 -21
- package/banner.png +0 -0
- package/skills/autonomous-swarm-director/SKILL.md +0 -69
- package/skills/hyper-context-synthesizer/SKILL.md +0 -55
- package/skills/llm-cost-arbitrage-router/SKILL.md +0 -59
- 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 -125
- package/vibes-swarm-demo.gif +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: astro-framework-expert
|
|
3
|
+
description: "Expert guide for Astro 5+ framework — Content Collections, Islands Architecture, View Transitions, partial hydration, and MDX integration / Panduan ahli framework Astro 5+ — Content Collections, Islands Architecture, View Transitions, partial hydration, dan integrasi MDX."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Astro Framework Expert (2026 Edition)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Orchestration & Integration
|
|
17
|
+
- **`seo`**: Astro's built-in SEO capabilities, sitemaps, and structured data.
|
|
18
|
+
- **`performance-web-vitals`**: Astro's zero-JS-by-default performance optimization.
|
|
19
|
+
- **`tailwind-expert`**: Tailwind CSS v4 integration with Astro.
|
|
20
|
+
- **`headless-cms-expert`**: Content fetching from Sanity/Payload/Strapi in Astro.
|
|
21
|
+
- **`ci-cd-devops-architect`**: Deploying Astro to Vercel, Cloudflare Pages, or Netlify.
|
|
22
|
+
|
|
23
|
+
### Description
|
|
24
|
+
Expert guide for building high-performance, content-first websites with Astro 5+. Covers Content Collections (type-safe content), Islands Architecture (partial hydration), View Transitions, server-side rendering, hybrid rendering, MDX integration, Astro DB, and multi-framework component support (React, Vue, Svelte in one project).
|
|
25
|
+
|
|
26
|
+
### Trigger Conditions
|
|
27
|
+
- Building content-heavy websites (blogs, docs, marketing pages, portfolios).
|
|
28
|
+
- Choosing between Astro and Next.js for a content-first project.
|
|
29
|
+
- Implementing partial hydration or Islands Architecture.
|
|
30
|
+
- Creating documentation sites or landing pages optimized for performance.
|
|
31
|
+
- Using multiple UI frameworks (React + Vue + Svelte) in one project.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Core Concepts
|
|
36
|
+
|
|
37
|
+
#### Astro vs Next.js Decision Guide
|
|
38
|
+
|
|
39
|
+
| Criteria | Astro 5 | Next.js 15 |
|
|
40
|
+
|----------|---------|------------|
|
|
41
|
+
| Primary Focus | Content sites | Full-stack apps |
|
|
42
|
+
| Default JS Shipped | 0 KB | React runtime |
|
|
43
|
+
| Rendering | Static-first, opt-in SSR | SSR-first, opt-in static |
|
|
44
|
+
| Multi-framework | ✅ React, Vue, Svelte, Solid | React only |
|
|
45
|
+
| Content Collections | ✅ Built-in, type-safe | Manual with MDX |
|
|
46
|
+
| Server Islands | ✅ Deferred rendering | PPR (similar) |
|
|
47
|
+
| **Choose When** | Content, SEO, speed critical | Complex interactivity |
|
|
48
|
+
|
|
49
|
+
**Recommendation:** Choose **Astro** for content-driven sites where performance and SEO are top priorities. Choose **Next.js** for interactive web applications with complex state.
|
|
50
|
+
|
|
51
|
+
#### 1. Project Setup
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Create new Astro project
|
|
55
|
+
npm create astro@latest ./my-site -- --template blog --typescript strict
|
|
56
|
+
|
|
57
|
+
# Add integrations
|
|
58
|
+
npx astro add tailwind react mdx sitemap
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### 2. Content Collections (Type-Safe Content)
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// src/content/config.ts
|
|
65
|
+
import { defineCollection, z } from 'astro:content';
|
|
66
|
+
|
|
67
|
+
const blog = defineCollection({
|
|
68
|
+
type: 'content', // Markdown/MDX files
|
|
69
|
+
schema: z.object({
|
|
70
|
+
title: z.string(),
|
|
71
|
+
description: z.string(),
|
|
72
|
+
pubDate: z.coerce.date(),
|
|
73
|
+
heroImage: z.string().optional(),
|
|
74
|
+
tags: z.array(z.string()).default([]),
|
|
75
|
+
draft: z.boolean().default(false),
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const authors = defineCollection({
|
|
80
|
+
type: 'data', // JSON/YAML files
|
|
81
|
+
schema: z.object({
|
|
82
|
+
name: z.string(),
|
|
83
|
+
avatar: z.string(),
|
|
84
|
+
bio: z.string(),
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export const collections = { blog, authors };
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```astro
|
|
92
|
+
---
|
|
93
|
+
// src/pages/blog/[...slug].astro
|
|
94
|
+
import { getCollection } from 'astro:content';
|
|
95
|
+
|
|
96
|
+
export async function getStaticPaths() {
|
|
97
|
+
const posts = await getCollection('blog', ({ data }) => !data.draft);
|
|
98
|
+
return posts.map((post) => ({
|
|
99
|
+
params: { slug: post.slug },
|
|
100
|
+
props: { post },
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const { post } = Astro.props;
|
|
105
|
+
const { Content } = await post.render();
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
<article>
|
|
109
|
+
<h1>{post.data.title}</h1>
|
|
110
|
+
<time>{post.data.pubDate.toLocaleDateString()}</time>
|
|
111
|
+
<Content />
|
|
112
|
+
</article>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### 3. Islands Architecture (Partial Hydration)
|
|
116
|
+
|
|
117
|
+
```astro
|
|
118
|
+
---
|
|
119
|
+
// Only hydrate interactive components — rest ships as 0 JS
|
|
120
|
+
import Newsletter from '../components/Newsletter.tsx';
|
|
121
|
+
import Counter from '../components/Counter.vue';
|
|
122
|
+
import Chart from '../components/Chart.svelte';
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
<!-- Static by default — no JS shipped -->
|
|
126
|
+
<h1>My Blog Post</h1>
|
|
127
|
+
<p>This is static HTML with zero JavaScript.</p>
|
|
128
|
+
|
|
129
|
+
<!-- Hydrate only when visible (lazy loading) -->
|
|
130
|
+
<Newsletter client:visible />
|
|
131
|
+
|
|
132
|
+
<!-- Hydrate on page load -->
|
|
133
|
+
<Counter client:load />
|
|
134
|
+
|
|
135
|
+
<!-- Hydrate only on interaction (click, hover) -->
|
|
136
|
+
<Chart client:idle />
|
|
137
|
+
|
|
138
|
+
<!-- Hydrate only on specific media query -->
|
|
139
|
+
<MobileMenu client:media="(max-width: 768px)" />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### 4. View Transitions
|
|
143
|
+
|
|
144
|
+
```astro
|
|
145
|
+
---
|
|
146
|
+
// src/layouts/BaseLayout.astro
|
|
147
|
+
import { ViewTransitions } from 'astro:transitions';
|
|
148
|
+
---
|
|
149
|
+
<html>
|
|
150
|
+
<head>
|
|
151
|
+
<ViewTransitions />
|
|
152
|
+
</head>
|
|
153
|
+
<body>
|
|
154
|
+
<nav transition:persist><!-- Persists across pages --></nav>
|
|
155
|
+
<main transition:animate="slide">
|
|
156
|
+
<slot />
|
|
157
|
+
</main>
|
|
158
|
+
</body>
|
|
159
|
+
</html>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### 5. Server Islands (Deferred Rendering)
|
|
163
|
+
|
|
164
|
+
```astro
|
|
165
|
+
---
|
|
166
|
+
// Renders on the server, deferred from the initial page load
|
|
167
|
+
// Great for personalized content in otherwise static pages
|
|
168
|
+
---
|
|
169
|
+
<UserGreeting server:defer>
|
|
170
|
+
<p slot="fallback">Loading...</p>
|
|
171
|
+
</UserGreeting>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Production Checklist
|
|
175
|
+
- [ ] Content Collections with strict Zod schemas.
|
|
176
|
+
- [ ] Sitemap integration enabled (`@astrojs/sitemap`).
|
|
177
|
+
- [ ] Image optimization with `astro:assets`.
|
|
178
|
+
- [ ] View Transitions for smooth page navigation.
|
|
179
|
+
- [ ] Hybrid rendering (static + SSR where needed).
|
|
180
|
+
- [ ] Deploy adapter configured (Vercel, Cloudflare, Node).
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
<a name="bahasa-indonesia"></a>
|
|
185
|
+
## Bahasa Indonesia
|
|
186
|
+
|
|
187
|
+
### Integrasi Orkestrasi
|
|
188
|
+
- **`seo`**: Kemampuan SEO bawaan Astro, sitemap, dan data terstruktur.
|
|
189
|
+
- **`performance-web-vitals`**: Optimasi performa zero-JS-by-default Astro.
|
|
190
|
+
- **`tailwind-expert`**: Integrasi Tailwind CSS v4 dengan Astro.
|
|
191
|
+
- **`headless-cms-expert`**: Pengambilan konten dari Sanity/Payload/Strapi di Astro.
|
|
192
|
+
|
|
193
|
+
### Deskripsi
|
|
194
|
+
Panduan ahli untuk membangun website berperforma tinggi dan berfokus konten dengan Astro 5+. Mencakup Content Collections, Islands Architecture (partial hydration), View Transitions, rendering hybrid, integrasi MDX, Astro DB, dan dukungan multi-framework (React, Vue, Svelte dalam satu proyek).
|
|
195
|
+
|
|
196
|
+
### Kondisi Pemicu
|
|
197
|
+
- Membangun website berat konten (blog, docs, halaman marketing, portfolio).
|
|
198
|
+
- Memilih antara Astro dan Next.js untuk proyek konten.
|
|
199
|
+
- Mengimplementasikan partial hydration atau Islands Architecture.
|
|
200
|
+
- Membuat situs dokumentasi atau landing page yang dioptimalkan untuk performa.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: async-queue-temporal-expert
|
|
3
3
|
description: "Expert guide for Durable Workflow Engines (Temporal.io, Trigger.dev v3, Inngest, BullMQ v5) and fault-tolerant background sagas / Panduan ahli workflow engine tahan-gagal (Temporal, Trigger.dev, Inngest, BullMQ)."
|
|
4
|
-
author:
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Async Queue & Durable Workflow Expert
|
|
7
|
+
# Async Queue & Durable Workflow Expert (Temporal & Sagas 2026)
|
|
8
8
|
|
|
9
9
|
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
10
|
|
|
@@ -14,23 +14,103 @@ author: vibes-plug-swarm
|
|
|
14
14
|
## English
|
|
15
15
|
|
|
16
16
|
### Purpose & Overview
|
|
17
|
-
Production-grade
|
|
17
|
+
Production-grade architectural guide for designing durable, fault-tolerant background execution pipelines, asynchronous job queues, and distributed state machines using **Temporal.io**, **Trigger.dev v3**, **Inngest**, and **BullMQ v5**. Guarantees eventual completion across long-running sagas, API rate limits, worker crashes, and network partitions.
|
|
18
18
|
|
|
19
19
|
### Key Capabilities
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
1. **Durable State Machines**: Workflows survive process restarts, deployments, and database blips without losing state or re-executing completed side-effects.
|
|
21
|
+
2. **Distributed Saga Pattern**: Multi-step transactions paired with automated compensating activities (rollbacks) whenever a downstream service permanently fails.
|
|
22
|
+
3. **Idempotency & Deduplication**: Ensuring unique idempotency keys per transaction to prevent double billing or duplicate emails.
|
|
23
|
+
4. **Queue Concurrency & Rate Limiting**: Token-bucket throttles, exponential backoff with jitter, and dead-letter queues (DLQ) for poison-pill isolation.
|
|
23
24
|
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### Production Implementation Recipes
|
|
28
|
+
|
|
29
|
+
#### Recipe 1: Temporal.io Saga Pattern with Compensations (TypeScript SDK)
|
|
30
|
+
```typescript
|
|
31
|
+
import { proxyActivities, ApplicationFailure } from '@temporalio/workflow';
|
|
32
|
+
import type * as activities from './activities';
|
|
33
|
+
|
|
34
|
+
// Proxy activities with aggressive retry policies
|
|
35
|
+
const { chargeCustomer, provisionLicense, sendWelcomeEmail, refundCustomer, revokeLicense } =
|
|
36
|
+
proxyActivities<typeof activities>({
|
|
37
|
+
startToCloseTimeout: '1 minute',
|
|
38
|
+
retry: {
|
|
39
|
+
initialInterval: '1s',
|
|
40
|
+
backoffCoefficient: 2,
|
|
41
|
+
maximumAttempts: 5,
|
|
42
|
+
nonRetryableErrorTypes: ['InvalidCardError', 'AccountSuspendedError'],
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export interface SubscriptionWorkflowInput {
|
|
47
|
+
customerId: string;
|
|
48
|
+
planId: string;
|
|
49
|
+
amountCents: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Distributed Subscription Saga with Compensating Rollbacks
|
|
54
|
+
*/
|
|
55
|
+
export async function subscriptionSagaWorkflow(input: SubscriptionWorkflowInput): Promise<{ status: string }> {
|
|
56
|
+
const compensations: Array<() => Promise<void>> = [];
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
// Step 1: Charge Customer
|
|
60
|
+
const chargeResult = await chargeCustomer(input.customerId, input.amountCents);
|
|
61
|
+
compensations.unshift(() => refundCustomer(chargeResult.chargeId));
|
|
62
|
+
|
|
63
|
+
// Step 2: Provision License
|
|
64
|
+
const licenseResult = await provisionLicense(input.customerId, input.planId);
|
|
65
|
+
compensations.unshift(() => revokeLicense(licenseResult.licenseId));
|
|
66
|
+
|
|
67
|
+
// Step 3: Send Welcome Notification
|
|
68
|
+
await sendWelcomeEmail(input.customerId, licenseResult.licenseKey);
|
|
69
|
+
|
|
70
|
+
return { status: 'COMPLETED' };
|
|
71
|
+
} catch (error) {
|
|
72
|
+
// Execute compensating activities in reverse order
|
|
73
|
+
for (const compensate of compensations) {
|
|
74
|
+
try {
|
|
75
|
+
await compensate();
|
|
76
|
+
} catch (compError) {
|
|
77
|
+
console.error('Compensation failed, alerting on-call engineer:', compError);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
throw ApplicationFailure.create({
|
|
81
|
+
message: `Subscription saga failed and rolled back: ${(error as Error).message}`,
|
|
82
|
+
nonRetryable: true,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Recipe 2: Trigger.dev v3 Durable Task with Idempotency
|
|
24
89
|
```typescript
|
|
25
|
-
import { task } from
|
|
26
|
-
|
|
27
|
-
export const
|
|
28
|
-
id:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
90
|
+
import { task } from '@trigger.dev/sdk/v3';
|
|
91
|
+
|
|
92
|
+
export const generateEnterpriseAnalyticsReport = task({
|
|
93
|
+
id: 'generate-enterprise-report',
|
|
94
|
+
retry: {
|
|
95
|
+
maxAttempts: 4,
|
|
96
|
+
minTimeoutInMs: 2000,
|
|
97
|
+
factor: 2,
|
|
98
|
+
randomize: true, // Jitter
|
|
99
|
+
},
|
|
100
|
+
run: async (payload: { tenantId: string; month: string }, { ctx }) => {
|
|
101
|
+
// Automatic checkpointing: each step runs durably
|
|
102
|
+
const data = await ctx.run('fetch-telemetry', async () => {
|
|
103
|
+
return await fetchTelemetryFromWarehouse(payload.tenantId, payload.month);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const pdfUrl = await ctx.run('render-pdf', async () => {
|
|
107
|
+
return await generateReportPdf(data);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
await ctx.run('dispatch-webhook', async () => {
|
|
111
|
+
return await sendWebhookNotification(payload.tenantId, pdfUrl);
|
|
112
|
+
});
|
|
113
|
+
|
|
34
114
|
return { success: true, pdfUrl };
|
|
35
115
|
},
|
|
36
116
|
});
|
|
@@ -38,17 +118,123 @@ export const generateSaaSReport = task({
|
|
|
38
118
|
|
|
39
119
|
---
|
|
40
120
|
|
|
121
|
+
### Implementation Checklist
|
|
122
|
+
- [ ] Implement Saga rollback handlers for multi-step distributed payments and user provisioning.
|
|
123
|
+
- [ ] Enforce deterministic code inside Temporal workflows (never use `Math.random()`, `Date.now()`, or direct DB calls in workflow files; run them inside activities).
|
|
124
|
+
- [ ] Store large payloads in object storage (S3/R2); pass only IDs and signed URLs through queues.
|
|
125
|
+
- [ ] Configure DLQ (Dead Letter Queue) and alert thresholds for persistent failures.
|
|
126
|
+
|
|
127
|
+
## Orchestration & Integration
|
|
128
|
+
- Integrates with: `js-backend-expert`, `background-jobs-queue-expert`, `error-resilience-expert`, `saas-billing`, `doku-payment-gateway`.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
41
132
|
<a name="bahasa-indonesia"></a>
|
|
42
133
|
## Bahasa Indonesia
|
|
43
134
|
|
|
44
|
-
###
|
|
45
|
-
Panduan tingkat produksi untuk merancang pipeline eksekusi background yang tahan-gagal (durable execution) dan state machine terdistribusi menggunakan Temporal.io
|
|
135
|
+
### Tujuan & Gambaran Umum
|
|
136
|
+
Panduan arsitektur tingkat produksi untuk merancang pipeline eksekusi background yang tahan-gagal (durable execution), antrean tugas asinkron, dan state machine terdistribusi menggunakan **Temporal.io**, **Trigger.dev v3**, **Inngest**, dan **BullMQ v5**. Menjamin penyelesaian mutlak tugas berdurasi panjang terhadap pembatasan rate limit API, kegagalan worker, dan partisi jaringan.
|
|
46
137
|
|
|
47
|
-
###
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
138
|
+
### Kemampuan Utama
|
|
139
|
+
1. **State Machine Tahan-Gagal (Durable Execution)**: Alur kerja (workflow) tetap bertahan saat restart server, deployment, atau gangguan database tanpa kehilangan progres state.
|
|
140
|
+
2. **Pola Transaksi Terdistribusi (Saga Pattern)**: Transaksi multi-langkah yang dilengkapi dengan aktivitas kompensasi (rollback otomatis) jika langkah lanjutan gagal permanen.
|
|
141
|
+
3. **Idempotensi & Anti-Duplikasi**: Menjamin kunci idempotensi unik pada setiap transaksi guna mencegah duplikasi penagihan atau email berulang.
|
|
142
|
+
4. **Pembatasan Rate Limit & DLQ**: Throttling berbasis token bucket, exponential backoff dengan jitter acak, dan dead-letter queue (DLQ) untuk mengisolasi tugas beracun (*poison pills*).
|
|
52
143
|
|
|
53
|
-
|
|
54
|
-
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### Resep Implementasi Produksi
|
|
147
|
+
|
|
148
|
+
#### Resep 1: Pola Saga Temporal.io dengan Logika Kompensasi (TypeScript)
|
|
149
|
+
```typescript
|
|
150
|
+
import { proxyActivities, ApplicationFailure } from '@temporalio/workflow';
|
|
151
|
+
import type * as activities from './activities';
|
|
152
|
+
|
|
153
|
+
const { tagihPelanggan, aktifkanLisensi, kirimEmailSambutan, kembalikanDana, cabutLisensi } =
|
|
154
|
+
proxyActivities<typeof activities>({
|
|
155
|
+
startToCloseTimeout: '1 minute',
|
|
156
|
+
retry: {
|
|
157
|
+
initialInterval: '1s',
|
|
158
|
+
backoffCoefficient: 2,
|
|
159
|
+
maximumAttempts: 5,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export interface InputWorkflowLangganan {
|
|
164
|
+
customerId: string;
|
|
165
|
+
planId: string;
|
|
166
|
+
amountCents: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export async function workflowSagaLangganan(input: InputWorkflowLangganan) {
|
|
170
|
+
const kompensasi: Array<() => Promise<void>> = [];
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
// Langkah 1: Tagih Pembayaran
|
|
174
|
+
const hasilTagihan = await tagihPelanggan(input.customerId, input.amountCents);
|
|
175
|
+
kompensasi.unshift(() => kembalikanDana(hasilTagihan.chargeId));
|
|
176
|
+
|
|
177
|
+
// Langkah 2: Aktifkan Lisensi
|
|
178
|
+
const hasilLisensi = await aktifkanLisensi(input.customerId, input.planId);
|
|
179
|
+
kompensasi.unshift(() => cabutLisensi(hasilLisensi.licenseId));
|
|
180
|
+
|
|
181
|
+
// Langkah 3: Kirim Notifikasi
|
|
182
|
+
await kirimEmailSambutan(input.customerId, hasilLisensi.licenseKey);
|
|
183
|
+
|
|
184
|
+
return { status: 'SELESAI' };
|
|
185
|
+
} catch (error) {
|
|
186
|
+
// Eksekusi kompensasi rollback secara berurutan mundur
|
|
187
|
+
for (const compensate of kompensasi) {
|
|
188
|
+
try {
|
|
189
|
+
await compensate();
|
|
190
|
+
} catch (err) {
|
|
191
|
+
console.error('Kompensasi gagal:', err);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw ApplicationFailure.create({
|
|
195
|
+
message: `Saga gagal dan dilakukan rollback: ${(error as Error).message}`,
|
|
196
|
+
nonRetryable: true,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Resep 2: Tugas Background Tahan-Gagal Trigger.dev v3
|
|
203
|
+
```typescript
|
|
204
|
+
import { task } from '@trigger.dev/sdk/v3';
|
|
205
|
+
|
|
206
|
+
export const buatLaporanAnalitik = task({
|
|
207
|
+
id: 'buat-laporan-analitik',
|
|
208
|
+
retry: {
|
|
209
|
+
maxAttempts: 4,
|
|
210
|
+
factor: 2,
|
|
211
|
+
randomize: true, // Jitter
|
|
212
|
+
},
|
|
213
|
+
run: async (payload: { tenantId: string; bulan: string }, { ctx }) => {
|
|
214
|
+
const data = await ctx.run('ambil-data', async () => {
|
|
215
|
+
return await ambilDataWarehouse(payload.tenantId, payload.bulan);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const urlPdf = await ctx.run('buat-pdf', async () => {
|
|
219
|
+
return await renderDokumenPdf(data);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
await ctx.run('kirim-webhook', async () => {
|
|
223
|
+
return await notifikasiWebhook(payload.tenantId, urlPdf);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return { sukses: true, urlPdf };
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### Checklist Implementasi
|
|
234
|
+
- [ ] Terapkan penanganan rollback (Saga) untuk alur transaksi pembayaran dan provisi akun bertahap.
|
|
235
|
+
- [ ] Pastikan kode di dalam alur Temporal selalu deterministik (jangan gunakan `Math.random()` atau kueri DB langsung di dalam workflow, tempatkan di dalam activities).
|
|
236
|
+
- [ ] Pindahkan berkas besar ke S3/R2 dan hanya teruskan referensi ID melalui queue.
|
|
237
|
+
- [ ] Pasang konfigurasi DLQ (Dead Letter Queue) dan notifikasi peringatan jika ada job yang macet.
|
|
238
|
+
|
|
239
|
+
## Integrasi Orkestrasi
|
|
240
|
+
- Terintegrasi dengan: `js-backend-expert`, `background-jobs-queue-expert`, `error-resilience-expert`, `saas-billing`, `doku-payment-gateway`.
|