@riligar/agents-kit 1.12.0 → 1.14.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/.agent/skills/riligar-business-startup/SKILL.md +0 -1
- package/.agent/skills/riligar-design-system/SKILL.md +0 -1
- package/.agent/skills/riligar-dev-architecture/SKILL.md +7 -8
- package/.agent/skills/riligar-dev-auth-elysia/SKILL.md +7 -3
- package/.agent/skills/riligar-dev-auth-react/SKILL.md +5 -3
- package/.agent/skills/riligar-dev-autopilot/SKILL.md +0 -1
- package/.agent/skills/riligar-dev-backend/SKILL.md +0 -1
- package/.agent/skills/riligar-dev-clean-code/SKILL.md +0 -1
- package/.agent/skills/riligar-dev-code-review/SKILL.md +0 -1
- package/.agent/skills/riligar-dev-database/SKILL.md +8 -9
- package/.agent/skills/riligar-dev-frontend/SKILL.md +0 -1
- package/.agent/skills/riligar-dev-landing-page/SKILL.md +0 -1
- package/.agent/skills/riligar-dev-seo/SKILL.md +6 -3
- package/.agent/skills/riligar-dev-stripe/SKILL.md +196 -91
- package/.agent/skills/riligar-dev-stripe/assets/stripe-client.js +422 -0
- package/.agent/skills/riligar-dev-stripe/assets/stripe-server.js +300 -0
- package/.agent/skills/riligar-dev-stripe/references/stripe-database.md +369 -0
- package/.agent/skills/riligar-dev-stripe/references/stripe-elysia.md +342 -0
- package/.agent/skills/riligar-dev-stripe/references/stripe-react.md +478 -0
- package/.agent/skills/riligar-dev-stripe/references/stripe-webhooks.md +376 -0
- package/.agent/skills/riligar-infrastructure/SKILL.md +0 -1
- package/.agent/skills/riligar-marketing-copy/SKILL.md +0 -1
- package/.agent/skills/riligar-marketing-email/SKILL.md +0 -1
- package/.agent/skills/riligar-marketing-seo/SKILL.md +0 -1
- package/.agent/skills/riligar-plan-writing/SKILL.md +0 -1
- package/.agent/skills/riligar-tech-stack/SKILL.md +0 -1
- package/.agent/skills/skill-creator/SKILL.md +0 -2
- package/package.json +1 -1
- /package/.agent/skills/riligar-dev-architecture/{context-discovery.md → references/context-discovery.md} +0 -0
- /package/.agent/skills/riligar-dev-architecture/{examples.md → references/examples.md} +0 -0
- /package/.agent/skills/riligar-dev-architecture/{pattern-selection.md → references/pattern-selection.md} +0 -0
- /package/.agent/skills/riligar-dev-architecture/{patterns-reference.md → references/patterns-reference.md} +0 -0
- /package/.agent/skills/riligar-dev-architecture/{trade-off-analysis.md → references/trade-off-analysis.md} +0 -0
- /package/.agent/skills/riligar-dev-database/{database-selection.md → references/database-selection.md} +0 -0
- /package/.agent/skills/riligar-dev-database/{indexing.md → references/indexing.md} +0 -0
- /package/.agent/skills/riligar-dev-database/{migrations.md → references/migrations.md} +0 -0
- /package/.agent/skills/riligar-dev-database/{optimization.md → references/optimization.md} +0 -0
- /package/.agent/skills/riligar-dev-database/{orm-selection.md → references/orm-selection.md} +0 -0
- /package/.agent/skills/riligar-dev-database/{schema-design.md → references/schema-design.md} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-business-startup
|
|
3
|
-
type: business
|
|
4
3
|
description: Comprehensive startup planning toolkit. Use for business cases, financial projections (3-5 year models), and market opportunity analysis (TAM/SAM/SOM). Covers investor-ready documentation, fundraising strategy, and go-to-market planning.
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-design-system
|
|
3
|
-
type: design
|
|
4
3
|
description: Especialista no Sistema Visual da RiLiGar. Use para: (1) Criação de interfaces web e mobile (Light/Dark Mode), (2) Implementação de componentes UI (Mantine Only), (3) Garantir estética minimalista "Content-First", (4) Aplicar tokens de design via Mantine Theme.
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-dev-architecture
|
|
3
|
-
type: development
|
|
4
3
|
description: Architectural decision-making framework. Requirements analysis, trade-off evaluation, ADR documentation. Use when making architecture decisions or analyzing system design.
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -12,13 +11,13 @@ description: Architectural decision-making framework. Requirements analysis, tra
|
|
|
12
11
|
|
|
13
12
|
**Read ONLY files relevant to the request!** Check the content map, find what you need.
|
|
14
13
|
|
|
15
|
-
| File
|
|
16
|
-
|
|
|
17
|
-
| `context-discovery.md`
|
|
18
|
-
| `trade-off-analysis.md`
|
|
19
|
-
| `pattern-selection.md`
|
|
20
|
-
| `examples.md`
|
|
21
|
-
| `patterns-reference.md`
|
|
14
|
+
| File | Description | When to Read |
|
|
15
|
+
| ----------------------------------- | ---------------------------------------- | ---------------------------- |
|
|
16
|
+
| `references/context-discovery.md` | Questions to ask, project classification | Starting architecture design |
|
|
17
|
+
| `references/trade-off-analysis.md` | ADR templates, trade-off framework | Documenting decisions |
|
|
18
|
+
| `references/pattern-selection.md` | Decision trees, anti-patterns | Choosing patterns |
|
|
19
|
+
| `references/examples.md` | MVP, SaaS, Enterprise examples | Reference implementations |
|
|
20
|
+
| `references/patterns-reference.md` | Quick lookup for patterns | Pattern comparison |
|
|
22
21
|
|
|
23
22
|
---
|
|
24
23
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-dev-auth-elysia
|
|
3
|
-
type: development
|
|
4
3
|
description: 'Comprehensive guide for integrating the Riligar Auth Elysia SDK into backend servers. Use when a user needs to: (1) Set up a backend auth plugin, (2) Configure Elysia with Riligar Secret Key, (3) Protect API routes or groups, (4) Access authenticated user data in handlers, (5) Perform manual JWT verification.'
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -20,13 +19,18 @@ npm install @riligar/auth-elysia
|
|
|
20
19
|
|
|
21
20
|
### 2. Environment Variables
|
|
22
21
|
|
|
23
|
-
Set up your Secret Key and URLs in your
|
|
22
|
+
Set up your Secret Key and URLs in your environment files.
|
|
24
23
|
|
|
25
24
|
> [!CAUTION]
|
|
26
25
|
> Backend integration requires the **Secret Key** (`sk_...`). Never share this key or include it in client-side code.
|
|
27
26
|
|
|
28
27
|
```bash
|
|
29
|
-
# .env
|
|
28
|
+
# .env.development
|
|
29
|
+
AUTH_API_URL=https://manager.myauth.click
|
|
30
|
+
AUTH_API_SECRET=sk_test_your_secret_key
|
|
31
|
+
AUTH_JWKS_URL=https://manager.myauth.click/.well-known/jwks.json
|
|
32
|
+
|
|
33
|
+
# .env.production
|
|
30
34
|
AUTH_API_URL=https://manager.myauth.click
|
|
31
35
|
AUTH_API_SECRET=sk_live_your_secret_key
|
|
32
36
|
AUTH_JWKS_URL=https://manager.myauth.click/.well-known/jwks.json
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-dev-auth-react
|
|
3
|
-
type: development
|
|
4
3
|
description: 'Comprehensive guide for integrating the Riligar Auth React SDK into web applications. Use when a user needs to: (1) Set up authentication from scratch, (2) Configure AuthProvider, (3) Implement route protection, (4) Use auth hooks or pre-built UI components, (5) Handle login/signup/profile/magic links in React.'
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -20,13 +19,16 @@ bun add @riligar/auth-react
|
|
|
20
19
|
|
|
21
20
|
### 2. Environment Variables
|
|
22
21
|
|
|
23
|
-
Set up your Public Key in your
|
|
22
|
+
Set up your Public Key in your environment files.
|
|
24
23
|
|
|
25
24
|
> [!IMPORTANT]
|
|
26
25
|
> Always use the **Public Key** (`pk_...`) in the frontend. Never expose your Secret Key.
|
|
27
26
|
|
|
28
27
|
```bash
|
|
29
|
-
# .env.
|
|
28
|
+
# .env.development
|
|
29
|
+
VITE_AUTH_API_KEY=pk_test_your_public_key
|
|
30
|
+
|
|
31
|
+
# .env.production
|
|
30
32
|
VITE_AUTH_API_KEY=pk_live_your_public_key
|
|
31
33
|
```
|
|
32
34
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-dev-database
|
|
3
|
-
type: development
|
|
4
3
|
description: Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases. Use when designing schemas or optimizing database performance.
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -12,14 +11,14 @@ description: Database design principles and decision-making. Schema design, inde
|
|
|
12
11
|
|
|
13
12
|
**Read ONLY files relevant to the request!** Check the content map, find what you need.
|
|
14
13
|
|
|
15
|
-
| File
|
|
16
|
-
|
|
|
17
|
-
| `database-selection.md
|
|
18
|
-
| `orm-selection.md`
|
|
19
|
-
| `schema-design.md`
|
|
20
|
-
| `indexing.md`
|
|
21
|
-
| `optimization.md`
|
|
22
|
-
| `migrations.md`
|
|
14
|
+
| File | Description | When to Read |
|
|
15
|
+
| --------------------------------- | ------------------------------------- | ------------------ |
|
|
16
|
+
| `references/database-selection.md`| PostgreSQL vs Neon vs Turso vs SQLite | Choosing database |
|
|
17
|
+
| `references/orm-selection.md` | Drizzle vs Prisma vs Kysely | Choosing ORM |
|
|
18
|
+
| `references/schema-design.md` | Normalization, PKs, relationships | Designing schema |
|
|
19
|
+
| `references/indexing.md` | Index types, composite indexes | Performance tuning |
|
|
20
|
+
| `references/optimization.md` | N+1, EXPLAIN ANALYZE | Query optimization |
|
|
21
|
+
| `references/migrations.md` | Safe migrations, serverless DBs | Schema changes |
|
|
23
22
|
|
|
24
23
|
---
|
|
25
24
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-dev-landing-page
|
|
3
|
-
type: development
|
|
4
3
|
description: Specialist in High-Conversion Landing Pages using RiLiGar Design System. Use for: (1) Creating marketing/sales pages, (2) Structuring conversion flows (AIDA/PAS), (3) Implementing high-trust components (Hero, Social Proof, Pricing), (4) Writing persuasive copy.
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-dev-seo
|
|
3
|
-
type: development
|
|
4
3
|
description: Implementação de infraestrutura de SEO técnico seguindo a stack RiLiGar (React, Vite, Bun, Elysia). Use para configurar sitemaps, robots.txt, meta tags, OpenGraph, dados estruturados (JSON-LD) e URLs canônicas.
|
|
5
4
|
---
|
|
6
5
|
|
|
@@ -177,10 +176,14 @@ app.get('/*', async ({ path }) => {
|
|
|
177
176
|
|
|
178
177
|
# Part 4: Variáveis de Ambiente
|
|
179
178
|
|
|
180
|
-
Sempre configure a URL base:
|
|
179
|
+
Sempre configure a URL base nos arquivos de ambiente:
|
|
181
180
|
|
|
182
181
|
```bash
|
|
183
|
-
# .env
|
|
182
|
+
# .env.development
|
|
183
|
+
VITE_SITE_URL=http://localhost:5173
|
|
184
|
+
SITE_URL=http://localhost:3000
|
|
185
|
+
|
|
186
|
+
# .env.production
|
|
184
187
|
VITE_SITE_URL=https://riligar.com
|
|
185
188
|
SITE_URL=https://riligar.com
|
|
186
189
|
```
|
|
@@ -1,152 +1,257 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: riligar-dev-stripe
|
|
3
|
-
|
|
4
|
-
description: Stripe payment integration patterns. Use when implementing payments, subscriptions, webhooks, checkout flows, or billing in Elysia/Bun applications.
|
|
3
|
+
description: 'Interactive Stripe setup wizard. Use when implementing payments. The agent will ask for keys, products, and configure everything automatically.'
|
|
5
4
|
---
|
|
6
5
|
|
|
7
|
-
# Stripe
|
|
6
|
+
# Stripe Setup Wizard
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
Esta skill configura a integração completa do Stripe no seu projeto. O agente vai guiar você através de um setup interativo.
|
|
10
9
|
|
|
11
10
|
---
|
|
12
11
|
|
|
13
|
-
##
|
|
12
|
+
## Setup Workflow
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Quando o usuário solicitar configurar o Stripe, siga este fluxo **OBRIGATÓRIO**:
|
|
15
|
+
|
|
16
|
+
### Step 1: Coletar Chaves
|
|
17
|
+
|
|
18
|
+
Pergunte ao usuário:
|
|
19
|
+
|
|
20
|
+
> Para configurar o Stripe, preciso das suas chaves da API.
|
|
21
|
+
> Você pode encontrá-las em: https://dashboard.stripe.com/apikeys
|
|
17
22
|
>
|
|
18
|
-
>
|
|
19
|
-
>
|
|
23
|
+
> Por favor, me forneça:
|
|
24
|
+
> 1. **Publishable Key** (pk_live_... ou pk_test_...)
|
|
25
|
+
> 2. **Secret Key** (sk_live_... ou sk_test_...)
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
Aguarde as chaves antes de prosseguir.
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
### Step 2: Identificar Produtos
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
| --- | --- |
|
|
27
|
-
| **Customer** | User identity in Stripe |
|
|
28
|
-
| **Product** | What you're selling |
|
|
29
|
-
| **Price** | How much and billing cycle |
|
|
30
|
-
| **Subscription** | Recurring payment |
|
|
31
|
-
| **PaymentIntent** | One-time payment |
|
|
32
|
-
| **Webhook** | Event notifications |
|
|
31
|
+
Após receber as chaves, pergunte:
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
> Agora preciso entender seus produtos. Me diga:
|
|
34
|
+
>
|
|
35
|
+
> 1. **Tipo de cobrança**: Assinatura (recorrente) ou pagamento único?
|
|
36
|
+
> 2. **Quais planos/produtos** você quer oferecer?
|
|
37
|
+
>
|
|
38
|
+
> Exemplo de resposta:
|
|
39
|
+
> - Assinatura mensal
|
|
40
|
+
> - Plano Starter: R$ 29/mês (5 projetos, suporte email)
|
|
41
|
+
> - Plano Pro: R$ 99/mês (ilimitado, suporte prioritário)
|
|
42
|
+
> - Plano Enterprise: R$ 299/mês (tudo + SLA)
|
|
35
43
|
|
|
36
|
-
|
|
44
|
+
### Step 3: Criar Produtos no Stripe
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
Com as informações coletadas, gere o script para criar os produtos:
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
// scripts/setup-stripe-products.js
|
|
50
|
+
import Stripe from 'stripe'
|
|
51
|
+
|
|
52
|
+
const stripe = new Stripe('SK_KEY_AQUI')
|
|
53
|
+
|
|
54
|
+
async function setupProducts() {
|
|
55
|
+
const products = [
|
|
56
|
+
// Substituir com os produtos do usuário
|
|
57
|
+
{
|
|
58
|
+
name: 'Plano Starter',
|
|
59
|
+
description: '5 projetos, suporte email',
|
|
60
|
+
price: 2900, // R$ 29,00 em centavos
|
|
61
|
+
interval: 'month',
|
|
62
|
+
features: ['5 projetos', 'Suporte email', '1GB storage']
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Plano Pro',
|
|
66
|
+
description: 'Ilimitado, suporte prioritário',
|
|
67
|
+
price: 9900, // R$ 99,00 em centavos
|
|
68
|
+
interval: 'month',
|
|
69
|
+
features: ['Projetos ilimitados', 'Suporte prioritário', '10GB storage']
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
console.log('Criando produtos no Stripe...\n')
|
|
74
|
+
|
|
75
|
+
for (const product of products) {
|
|
76
|
+
const stripeProduct = await stripe.products.create({
|
|
77
|
+
name: product.name,
|
|
78
|
+
description: product.description,
|
|
79
|
+
metadata: { features: JSON.stringify(product.features) }
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const stripePrice = await stripe.prices.create({
|
|
83
|
+
product: stripeProduct.id,
|
|
84
|
+
unit_amount: product.price,
|
|
85
|
+
currency: 'brl',
|
|
86
|
+
recurring: product.interval ? { interval: product.interval } : undefined
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
console.log(`✓ ${product.name}`)
|
|
90
|
+
console.log(` Product ID: ${stripeProduct.id}`)
|
|
91
|
+
console.log(` Price ID: ${stripePrice.id}\n`)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.log('Produtos criados com sucesso!')
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
setupProducts().catch(console.error)
|
|
43
98
|
```
|
|
44
99
|
|
|
45
|
-
|
|
46
|
-
> Never expose `STRIPE_SECRET_KEY` in frontend code.
|
|
100
|
+
Instrua o usuário a executar: `bun run scripts/setup-stripe-products.js`
|
|
47
101
|
|
|
48
|
-
|
|
102
|
+
### Step 4: Coletar Price IDs
|
|
49
103
|
|
|
50
|
-
|
|
104
|
+
Após executar o script, peça:
|
|
51
105
|
|
|
52
|
-
|
|
106
|
+
> O script gerou os Price IDs. Por favor, me envie os IDs gerados.
|
|
107
|
+
> Exemplo: price_1ABC123...
|
|
53
108
|
|
|
54
|
-
|
|
55
|
-
import Stripe from 'stripe'
|
|
109
|
+
### Step 5: Configurar Ambiente
|
|
56
110
|
|
|
57
|
-
|
|
111
|
+
Com as chaves e Price IDs, configure os arquivos de ambiente:
|
|
112
|
+
|
|
113
|
+
**Backend: `.env.development` e `.env.production`**
|
|
114
|
+
```bash
|
|
115
|
+
# .env.development (chaves de teste)
|
|
116
|
+
STRIPE_SECRET_KEY=sk_test_...
|
|
117
|
+
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
118
|
+
|
|
119
|
+
# .env.production (chaves de produção)
|
|
120
|
+
STRIPE_SECRET_KEY=sk_live_...
|
|
121
|
+
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
58
122
|
```
|
|
59
123
|
|
|
60
|
-
|
|
124
|
+
**Frontend: `.env.development` e `.env.production`**
|
|
125
|
+
```bash
|
|
126
|
+
# .env.development
|
|
127
|
+
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...
|
|
61
128
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
mode: 'subscription',
|
|
65
|
-
customer_email: user.email,
|
|
66
|
-
line_items: [{ price: priceId, quantity: 1 }],
|
|
67
|
-
success_url: `${baseUrl}/success?session_id={CHECKOUT_SESSION_ID}`,
|
|
68
|
-
cancel_url: `${baseUrl}/cancel`,
|
|
69
|
-
})
|
|
129
|
+
# .env.production
|
|
130
|
+
VITE_STRIPE_PUBLISHABLE_KEY=pk_live_...
|
|
70
131
|
```
|
|
71
132
|
|
|
72
|
-
###
|
|
133
|
+
### Step 6: Configurar Database
|
|
73
134
|
|
|
74
|
-
|
|
75
|
-
app.post('/webhook/stripe', async ({ request, set }) => {
|
|
76
|
-
const sig = request.headers.get('stripe-signature')
|
|
77
|
-
const body = await request.text()
|
|
78
|
-
|
|
79
|
-
const event = stripe.webhooks.constructEvent(
|
|
80
|
-
body,
|
|
81
|
-
sig,
|
|
82
|
-
process.env.STRIPE_WEBHOOK_SECRET
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
switch (event.type) {
|
|
86
|
-
case 'checkout.session.completed':
|
|
87
|
-
await handleCheckoutComplete(event.data.object)
|
|
88
|
-
break
|
|
89
|
-
case 'customer.subscription.updated':
|
|
90
|
-
await handleSubscriptionUpdate(event.data.object)
|
|
91
|
-
break
|
|
92
|
-
case 'customer.subscription.deleted':
|
|
93
|
-
await handleSubscriptionCancel(event.data.object)
|
|
94
|
-
break
|
|
95
|
-
}
|
|
135
|
+
Gere a migration para adicionar campos do Stripe:
|
|
96
136
|
|
|
97
|
-
|
|
98
|
-
|
|
137
|
+
```javascript
|
|
138
|
+
// database/schema.js - adicionar aos users
|
|
139
|
+
stripeCustomerId: text('stripe_customer_id').unique(),
|
|
140
|
+
stripeSubscriptionId: text('stripe_subscription_id').unique(),
|
|
141
|
+
plan: text('plan').default('free'),
|
|
142
|
+
subscriptionStatus: text('subscription_status'),
|
|
143
|
+
currentPeriodEnd: integer('current_period_end', { mode: 'timestamp' }),
|
|
99
144
|
```
|
|
100
145
|
|
|
101
|
-
|
|
146
|
+
### Step 7: Configurar Webhook
|
|
102
147
|
|
|
103
|
-
|
|
148
|
+
Instrua o usuário:
|
|
104
149
|
|
|
105
|
-
|
|
150
|
+
> Configure o webhook no Stripe Dashboard:
|
|
151
|
+
>
|
|
152
|
+
> 1. Acesse https://dashboard.stripe.com/webhooks
|
|
153
|
+
> 2. Clique em "Add endpoint"
|
|
154
|
+
> 3. URL: `https://seu-dominio.com/webhook/stripe`
|
|
155
|
+
> 4. Selecione os eventos:
|
|
156
|
+
> - `checkout.session.completed`
|
|
157
|
+
> - `customer.subscription.updated`
|
|
158
|
+
> - `customer.subscription.deleted`
|
|
159
|
+
> - `invoice.paid`
|
|
160
|
+
> - `invoice.payment_failed`
|
|
161
|
+
> 5. Copie o "Signing secret" (whsec_...)
|
|
162
|
+
> 6. Adicione ao `.env.development` e `.env.production`
|
|
163
|
+
|
|
164
|
+
### Step 8: Gerar Código
|
|
165
|
+
|
|
166
|
+
Gere todos os arquivos necessários usando os templates de [assets/](assets/):
|
|
167
|
+
|
|
168
|
+
| Arquivo | Baseado em |
|
|
106
169
|
| --- | --- |
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
170
|
+
| `plugins/stripe.js` | stripe-server.js (seção 1) |
|
|
171
|
+
| `routes/billing.js` | stripe-server.js (seção 2) |
|
|
172
|
+
| `routes/webhook.js` | stripe-server.js (seção 3) |
|
|
173
|
+
| `services/billing.js` | stripe-server.js (seção 4) |
|
|
174
|
+
| `config/stripe-prices.js` | Price IDs coletados |
|
|
175
|
+
| `pages/Pricing.jsx` | stripe-client.js (seção 3) |
|
|
176
|
+
| `components/BillingSettings.jsx` | stripe-client.js (seção 4) |
|
|
177
|
+
| `hooks/useSubscription.js` | stripe-client.js (seção 2) |
|
|
112
178
|
|
|
113
|
-
|
|
179
|
+
### Step 9: Criar Config de Preços
|
|
114
180
|
|
|
115
|
-
|
|
181
|
+
Gere o arquivo de configuração com os Price IDs:
|
|
116
182
|
|
|
117
183
|
```javascript
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
184
|
+
// config/stripe-prices.js
|
|
185
|
+
export const STRIPE_PRICES = {
|
|
186
|
+
starter: {
|
|
187
|
+
priceId: 'price_COLETADO_STARTER',
|
|
188
|
+
name: 'Starter',
|
|
189
|
+
price: 29,
|
|
190
|
+
features: ['5 projetos', 'Suporte email', '1GB storage']
|
|
191
|
+
},
|
|
192
|
+
pro: {
|
|
193
|
+
priceId: 'price_COLETADO_PRO',
|
|
194
|
+
name: 'Pro',
|
|
195
|
+
price: 99,
|
|
196
|
+
features: ['Projetos ilimitados', 'Suporte prioritário', '10GB storage']
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const getPrice = (plan) => STRIPE_PRICES[plan]
|
|
201
|
+
export const getPriceId = (plan) => STRIPE_PRICES[plan]?.priceId
|
|
122
202
|
```
|
|
123
203
|
|
|
124
204
|
---
|
|
125
205
|
|
|
126
|
-
##
|
|
206
|
+
## Checklist Final
|
|
127
207
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- [ ]
|
|
131
|
-
- [ ]
|
|
132
|
-
- [ ]
|
|
208
|
+
Ao completar o setup, confirme:
|
|
209
|
+
|
|
210
|
+
- [ ] Dependências instaladas (`bun add stripe @stripe/stripe-js @stripe/react-stripe-js`)
|
|
211
|
+
- [ ] Chaves no `.env.development` e `.env.production` (backend e frontend)
|
|
212
|
+
- [ ] Produtos criados no Stripe
|
|
213
|
+
- [ ] Price IDs configurados em `config/stripe-prices.js`
|
|
214
|
+
- [ ] Schema do database atualizado
|
|
215
|
+
- [ ] Webhook endpoint configurado no Stripe Dashboard
|
|
216
|
+
- [ ] Webhook secret nos arquivos de ambiente
|
|
217
|
+
- [ ] Rotas de billing funcionando
|
|
218
|
+
- [ ] Página de pricing criada
|
|
219
|
+
- [ ] Testado com cartão 4242 4242 4242 4242
|
|
133
220
|
|
|
134
221
|
---
|
|
135
222
|
|
|
136
|
-
##
|
|
223
|
+
## Testing Local
|
|
137
224
|
|
|
138
225
|
```bash
|
|
139
|
-
#
|
|
226
|
+
# Instalar Stripe CLI
|
|
140
227
|
brew install stripe/stripe-cli/stripe
|
|
141
228
|
|
|
142
|
-
#
|
|
229
|
+
# Login
|
|
230
|
+
stripe login
|
|
231
|
+
|
|
232
|
+
# Forward webhooks
|
|
143
233
|
stripe listen --forward-to localhost:3000/webhook/stripe
|
|
234
|
+
|
|
235
|
+
# Testar checkout
|
|
236
|
+
stripe trigger checkout.session.completed
|
|
144
237
|
```
|
|
145
238
|
|
|
146
239
|
---
|
|
147
240
|
|
|
241
|
+
## Specialized Guides
|
|
242
|
+
|
|
243
|
+
| Guide | Content |
|
|
244
|
+
| --- | --- |
|
|
245
|
+
| [stripe-elysia.md](references/stripe-elysia.md) | Backend routes completas |
|
|
246
|
+
| [stripe-react.md](references/stripe-react.md) | Componentes React/Mantine |
|
|
247
|
+
| [stripe-webhooks.md](references/stripe-webhooks.md) | Handlers de eventos |
|
|
248
|
+
| [stripe-database.md](references/stripe-database.md) | Schema Drizzle |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
148
252
|
## Related Skills
|
|
149
253
|
|
|
150
254
|
- @[.agent/skills/riligar-dev-backend]
|
|
255
|
+
- @[.agent/skills/riligar-dev-frontend]
|
|
151
256
|
- @[.agent/skills/riligar-dev-auth-elysia]
|
|
152
257
|
- @[.agent/skills/riligar-tech-stack]
|