vibes-plug 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  2. package/BLUEPRINT.md +125 -0
  3. package/CHANGELOG.md +195 -0
  4. package/CONTRIBUTING.md +199 -0
  5. package/LICENSE +21 -0
  6. package/README.md +263 -0
  7. package/SECURITY.md +21 -0
  8. package/banner.png +0 -0
  9. package/package.json +25 -0
  10. package/plugin.json +8 -0
  11. package/scripts/update_skills.js +75 -0
  12. package/skills/ai-llm-integration-expert/SKILL.md +162 -0
  13. package/skills/api-design-expert/SKILL.md +310 -0
  14. package/skills/app-analyzer-optimizer/SKILL.md +189 -0
  15. package/skills/asisten_ramah/SKILL.md +41 -0
  16. package/skills/authentication-identity-expert/SKILL.md +45 -0
  17. package/skills/auto-doc-updater/SKILL.md +204 -0
  18. package/skills/bootstrap-to-modern/SKILL.md +87 -0
  19. package/skills/brainstorming/SKILL.md +353 -0
  20. package/skills/bun-runtime-expert/SKILL.md +211 -0
  21. package/skills/ci-cd-devops-architect/SKILL.md +45 -0
  22. package/skills/cloud-hosting-expert/SKILL.md +244 -0
  23. package/skills/coderabbit/SKILL.md +192 -0
  24. package/skills/data-telemetry-expert/SKILL.md +213 -0
  25. package/skills/database-orm-expert/SKILL.md +294 -0
  26. package/skills/design-system-architect/SKILL.md +243 -0
  27. package/skills/e2e-testing-expert/SKILL.md +315 -0
  28. package/skills/event-driven-architect/SKILL.md +81 -0
  29. package/skills/firebase-security-expert/SKILL.md +195 -0
  30. package/skills/fullstack-expert/SKILL.md +202 -0
  31. package/skills/fullstack-expert/references/api_design_guide.md +466 -0
  32. package/skills/fullstack-expert/references/devops_infrastructure.md +477 -0
  33. package/skills/fullstack-expert/references/multi_language_backend.md +528 -0
  34. package/skills/fullstack-expert/references/system_design_patterns.md +358 -0
  35. package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -0
  36. package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -0
  37. package/skills/gemini-agent-booster/SKILL.md +135 -0
  38. package/skills/global-a11y-i18n-expert/SKILL.md +81 -0
  39. package/skills/go-programming-expert/SKILL.md +295 -0
  40. package/skills/hig/SKILL.md +188 -0
  41. package/skills/js-backend-expert/SKILL.md +192 -0
  42. package/skills/mcp-server-architect/SKILL.md +194 -0
  43. package/skills/mobile-expo-expert/SKILL.md +186 -0
  44. package/skills/monday-design-aesthetic/SKILL.md +67 -0
  45. package/skills/monorepo-architect/SKILL.md +227 -0
  46. package/skills/mpa-orchestrator/SKILL.md +101 -0
  47. package/skills/multi-agent-orchestration/SKILL.md +234 -0
  48. package/skills/multiple-entry-points/SKILL.md +55 -0
  49. package/skills/mvc-expert/SKILL.md +231 -0
  50. package/skills/payment-gateway-expert/SKILL.md +45 -0
  51. package/skills/performance-web-vitals/SKILL.md +332 -0
  52. package/skills/prd-architect/SKILL.md +191 -0
  53. package/skills/production-ready-hardener/SKILL.md +469 -0
  54. package/skills/production-ready-hardener/references/performance_optimization.md +441 -0
  55. package/skills/production-ready-hardener/references/production_checklist.md +161 -0
  56. package/skills/production-ready-hardener/references/security_hardening_guide.md +379 -0
  57. package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +875 -0
  58. package/skills/python-programming-expert/SKILL.md +271 -0
  59. package/skills/realtime-collaboration-expert/SKILL.md +45 -0
  60. package/skills/rust-programming-expert/SKILL.md +235 -0
  61. package/skills/saas-billing/SKILL.md +377 -0
  62. package/skills/saas-multi-tenant/SKILL.md +237 -0
  63. package/skills/saas-mvp-launcher/SKILL.md +231 -0
  64. package/skills/saas-transformer/SKILL.md +446 -0
  65. package/skills/saas-transformer/references/billing_integration_guide.md +401 -0
  66. package/skills/saas-transformer/references/feature_gating_patterns.md +137 -0
  67. package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -0
  68. package/skills/saas-transformer/scripts/saas_transformation_scanner.py +254 -0
  69. package/skills/scalability-clean-code/SKILL.md +229 -0
  70. package/skills/secure-fuzz-testing/SKILL.md +201 -0
  71. package/skills/senior-frontend/SKILL.md +161 -0
  72. package/skills/senior-frontend/references/frontend_best_practices.md +806 -0
  73. package/skills/senior-frontend/references/nextjs_optimization_guide.md +724 -0
  74. package/skills/senior-frontend/references/react_patterns.md +746 -0
  75. package/skills/senior-frontend/scripts/bundle_analyzer.py +407 -0
  76. package/skills/senior-frontend/scripts/component_generator.py +329 -0
  77. package/skills/senior-frontend/scripts/frontend_scaffolder.py +1005 -0
  78. package/skills/senior-fullstack/SKILL.md +167 -0
  79. package/skills/senior-fullstack/references/architecture_patterns.md +160 -0
  80. package/skills/senior-fullstack/references/development_workflows.md +222 -0
  81. package/skills/senior-fullstack/references/tech_stack_guide.md +190 -0
  82. package/skills/senior-fullstack/scripts/code_quality_analyzer.py +114 -0
  83. package/skills/senior-fullstack/scripts/fullstack_scaffolder.py +114 -0
  84. package/skills/senior-fullstack/scripts/project_scaffolder.py +114 -0
  85. package/skills/seo/SKILL.md +225 -0
  86. package/skills/seo/references/cwv-thresholds.md +108 -0
  87. package/skills/seo/references/eeat-framework.md +214 -0
  88. package/skills/seo/references/quality-gates.md +155 -0
  89. package/skills/seo/references/schema-types.md +118 -0
  90. package/skills/seo-aeo-landing-page-writer/SKILL.md +97 -0
  91. package/skills/seo-geo/SKILL.md +188 -0
  92. package/skills/session-handoff-resume/SKILL.md +158 -0
  93. package/skills/skill_baru/SKILL.md +147 -0
  94. package/skills/spa-orchestrator/SKILL.md +288 -0
  95. package/skills/state-management-expert/SKILL.md +272 -0
  96. package/skills/supabase-migration/SKILL.md +45 -0
  97. package/skills/supabase-security-expert/SKILL.md +243 -0
  98. package/skills/tailwind-expert/SKILL.md +188 -0
  99. package/skills/tanstack-query-expert/SKILL.md +199 -0
  100. package/skills/tauri-expert/SKILL.md +97 -0
  101. package/skills/token-saver/SKILL.md +111 -0
  102. package/skills/typescript-expert/SKILL.md +279 -0
  103. package/skills/ui-components-expert/SKILL.md +63 -0
  104. package/skills/ui-ux-pro-max/SKILL.md +201 -0
  105. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  106. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  107. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  108. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  109. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  110. package/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  111. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  112. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  113. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  114. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  115. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  116. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  117. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  118. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  119. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  120. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  121. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  122. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  123. package/skills/ui-ux-pro-max/data/styles.csv +59 -0
  124. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  125. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  126. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  127. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  128. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
  129. package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
  130. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
  131. package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
  132. package/skills/ui-ux-pro-max/scripts/core.py +257 -0
  133. package/skills/ui-ux-pro-max/scripts/design_system.py +493 -0
  134. package/skills/ui-ux-pro-max/scripts/search.py +81 -0
  135. package/skills/ui_ux_expert/SKILL.md +114 -0
  136. package/skills/vibe-code-gardener/SKILL.md +173 -0
  137. package/skills/web-scraper/SKILL.md +205 -0
  138. package/skills/web-scraper/references/data-transforms.md +397 -0
  139. package/skills/web-scraper/references/extraction-patterns.md +475 -0
  140. package/skills/web-scraper/references/output-templates.md +481 -0
  141. package/skills/zero-to-prod-orchestrator/SKILL.md +180 -0
@@ -0,0 +1,231 @@
1
+ ---
2
+ name: saas-mvp-launcher
3
+ description: "Structured roadmap and design to plan and launch a SaaS MVP from scratch / Panduan terstruktur untuk merencanakan dan meluncurkan SaaS MVP dari nol."
4
+ author: "Roedy Rustam"
5
+ ---
6
+
7
+ # SaaS MVP Launcher
8
+
9
+ [English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
10
+
11
+ ---
12
+
13
+ <a name="english"></a>
14
+ ## English
15
+
16
+ ### Overview
17
+ This skill guides you through building a production-ready SaaS MVP in the shortest time possible. It covers everything from idea validation and tech stack selection to authentication, payments, database design, deployment, and launch — using modern, battle-tested tools.
18
+
19
+ ### Trigger Conditions
20
+ Use this skill when:
21
+ - Starting a new SaaS product from scratch.
22
+ - Choosing a tech stack for a web application.
23
+ - Setting up authentication, billing, or database for a SaaS.
24
+ - Requiring a structured launch checklist before going live.
25
+ - Designing the architecture of a multi-tenant application.
26
+ - Conducting a technical review of an existing early-stage SaaS.
27
+
28
+ ### Step-by-Step Guide
29
+
30
+ #### 1. Validate Before You Build
31
+ Before writing any code, validate the idea:
32
+ - [ ] Can you describe the problem in one sentence?
33
+ - [ ] Who is the exact customer? (not "everyone")
34
+ - [ ] What do they pay for today to solve this?
35
+ - [ ] Have you talked to 5+ potential customers?
36
+ - [ ] Will they pay $X/month for your solution?
37
+
38
+ *Rule:* If you can't get 3 people to pre-pay or sign a letter of intent, don't build yet.
39
+
40
+ #### 2. Choose Your Tech Stack
41
+ Recommended modern SaaS stack (2026):
42
+ - **Frontend**: Next.js 15 + TypeScript (App Router, React Server Components).
43
+ - **Styling**: Tailwind CSS v4 + shadcn/ui.
44
+ - **Backend**: Next.js Server Actions (type-safe, direct database integration).
45
+ - **Database**: PostgreSQL (Supabase or Neon) with RLS.
46
+ - **ORM**: Drizzle ORM or Prisma.
47
+ - **Auth**: Clerk or NextAuth.js (Auth.js).
48
+ - **Payments**: Choice of Stripe, Midtrans (for SE Asia), PayPal, Paddle, or FastSpring (including subscriptions and customer portals).
49
+ - **Email**: Resend + React Email.
50
+ - **Deployment**: Vercel (seamless deployment, edge network, zero-config CI/CD).
51
+ - **Monitoring**: Sentry + PostHog (crash reporting, user analytics).
52
+
53
+ #### 3. Architecture & Database Schema
54
+ - **Architecture (`multiple-entry-points`)**: Apply the `multiple-entry-points` pattern to logically separate the public landing page, the authenticated tenant dashboard, and the administrative backend. This ensures the public site loads blazingly fast without bootstrapping heavy application logic.
55
+ - **Super Admin Dashboard**: A critical requirement for application management. The Super Admin panel must be explicitly separated and deployed on a dedicated subdomain (e.g., `admin.example.com`). This isolates administrative capabilities (user moderation, global metrics, tenant management) from the main application.
56
+ - **Schema (Multi-tenant SaaS)**: Choose between **Shared Schema** (tenant_id on every table, simpler) or **Isolated Schema** (schema-per-tenant, stricter isolation). Please refer to the code examples below for Shared Schema database configurations in Prisma and Drizzle. Ensure the User schema includes a role or flag (e.g., `isSuperAdmin`) to restrict access to the admin subdomain.
57
+
58
+ #### 4. Pre-Launch Checklist
59
+ - **Technical**: Authentication works, Payments work end-to-end, Error monitoring configured (Sentry), Database backups active, Rate limiting on API routes, Input validation with Zod.
60
+ - **Session Management Optimization**: Use Edge-compatible JWTs combined with Redis (e.g., Upstash) for high-performance session validation. Avoid blocking relational database queries on every authenticated request.
61
+ - **Authentication & Auth Provider Checklist**:
62
+ - **Clerk**: Ensure webhook secrets are configured in production to sync user creations/deletions, set `ClerkProvider` dynamic flags, and lock down middleware matching routes so API folders are protected.
63
+ - **NextAuth.js (Auth.js)**: Verify `NEXTAUTH_SECRET` is set with a strong generated value, session driver is correctly configured (JWT or database sessions), and token expiration rules are set appropriately.
64
+ - **Product**: Landing page with clear value prop, Pricing page with 2-3 tiers, Onboarding flow (< 5 minutes to first value), ToS and Privacy Policy, **Super Admin Dashboard** deployed on a subdomain for app management.
65
+ - **Marketing**: Domain configured, SEO meta tags on all pages, Analytics active.
66
+
67
+
68
+ ### Best Practices & Troubleshooting
69
+ - **Build Fast**: Ship a working MVP in 4-6 weeks maximum, then iterate based on feedback.
70
+ - **Charge from Day 1**: Paying users validate product-market fit.
71
+ - **Stripe Webhooks**: Use Stripe CLI for local testing: `stripe listen --forward-to localhost:3000/api/webhooks/stripe`.
72
+
73
+ ---
74
+
75
+ <a name="bahasa-indonesia"></a>
76
+ ## Bahasa Indonesia
77
+
78
+ ### Ringkasan
79
+ Skill ini memandu Anda membangun SaaS MVP tingkat produksi dalam waktu sesingkat mungkin. Panduan ini mencakup validasi ide, pemilihan stack teknologi, autentikasi, pembayaran, desain database, deployment, hingga checklist peluncuran menggunakan teknologi modern yang teruji.
80
+
81
+ ### Kondisi Pemicu
82
+ Gunakan skill ini ketika:
83
+ - Memulai produk SaaS baru dari awal.
84
+ - Memilih stack teknologi untuk aplikasi web SaaS.
85
+ - Mengatur autentikasi, penagihan (billing), atau database untuk SaaS.
86
+ - Memerlukan checklist peluncuran terstruktur sebelum rilis ke publik.
87
+ - Merancang arsitektur aplikasi multi-tenant.
88
+ - Melakukan tinjauan teknis (audit) terhadap SaaS tahap awal.
89
+
90
+ ### Panduan Langkah demi Langkah
91
+
92
+ #### 1. Validasi Sebelum Membangun
93
+ Sebelum menulis kode, lakukan validasi ide:
94
+ - [ ] Apakah Anda dapat menjelaskan masalah dalam satu kalimat?
95
+ - [ ] Siapa target pelanggan yang tepat? (bukan "semua orang")
96
+ - [ ] Apa alternatif berbayar yang mereka gunakan saat ini?
97
+ - [ ] Apakah Anda sudah berbicara dengan 5+ calon pelanggan?
98
+ - [ ] Apakah mereka bersedia membayar sebesar $X/bulan untuk solusi Anda?
99
+
100
+ *Aturan:* Jika Anda tidak bisa mendapatkan 3 orang yang bersedia melakukan pre-pay atau menandatangani letter of intent, jangan mulai menulis kode terlebih dahulu.
101
+
102
+ #### 2. Pilih Stack Teknologi Anda
103
+ Rekomendasi stack SaaS modern (2026):
104
+ - **Frontend**: Next.js 15 + TypeScript (App Router, Server Components).
105
+ - **Styling**: Tailwind CSS v4 + shadcn/ui.
106
+ - **Backend**: Next.js Server Actions (integrasi DB langsung, type-safe).
107
+ - **Database**: PostgreSQL (Supabase atau Neon) dengan RLS.
108
+ - **ORM**: Drizzle ORM atau Prisma.
109
+ - **Auth**: Clerk atau NextAuth.js (Auth.js).
110
+ - **Payments**: Pilihan Stripe, Midtrans (untuk Asia Tenggara/Indonesia), PayPal, Paddle, atau FastSpring (termasuk fitur langganan, customer portal, dan kepatuhan pajak otomatis).
111
+ - **Email**: Resend + React Email.
112
+ - **Deployment**: Vercel (CI/CD otomatis, edge network).
113
+ - **Monitoring**: Sentry + PostHog (crash reporting, user analytics).
114
+
115
+ #### 3. Arsitektur & Database Schema
116
+ - **Arsitektur (`multiple-entry-points`)**: Terapkan pola `multiple-entry-points` untuk memisahkan secara logis halaman *landing page* publik, *dashboard* tenant yang diautentikasi, dan *backend* administratif. Ini memastikan situs publik memuat dengan sangat cepat tanpa memuat logika aplikasi yang berat.
117
+ - **Dashboard Super Admin**: Fitur wajib untuk manajemen aplikasi. Panel Super Admin harus dipisahkan secara eksplisit dan di-deploy pada subdomain khusus (contoh: `admin.example.com`). Hal ini mengisolasi akses administratif (moderasi user, metrik sistem, manajemen tenant) dari aplikasi utama.
118
+ - **Schema (Multi-tenant SaaS)**: Pilih antara **Shared Schema** (tenant_id di setiap tabel, lebih sederhana) atau **Isolated Schema** (schema-per-tenant, isolasi lebih ketat). Skema database multi-tenant Shared Schema menyediakan struktur relasi antara `User`, `Workspace`, `WorkspaceMember`, dan `Subscription` (lihat acuan kode di bawah). Pastikan skema User memiliki flag atau role (contoh: `isSuperAdmin`) untuk membatasi akses ke subdomain admin.
119
+
120
+ #### 4. Checklist Peluncuran (Pre-Launch Checklist)
121
+ - **Teknis**: Autentikasi bekerja dengan baik, Pembayaran bekerja end-to-end (subscribe, cancel), Pemantauan error terkonfigurasi (Sentry), Database backup aktif, Rate limiting pada API routes, Validasi input dengan Zod pada semua form.
122
+ - **Optimasi Session Management**: Gunakan JWT (Edge-compatible) yang dikombinasikan dengan Redis (contoh: Upstash) untuk validasi sesi berkinerja tinggi. Hindari query database relasional yang memblokir pada setiap request yang terautentikasi.
123
+ - **Checklist Autentikasi & Auth Provider**:
124
+ - **Clerk**: Pastikan webhook secret dikonfigurasi di produksi untuk sinkronisasi pembuatan/penghapusan user, atur dynamic flags pada `ClerkProvider`, dan kunci middleware agar seluruh endpoint API terproteksi.
125
+ - **NextAuth.js (Auth.js)**: Pastikan `NEXTAUTH_SECRET` diatur dengan nilai acak yang kuat di environment production, adapter session terhubung dengan benar (JWT atau database session), dan atur waktu kedaluwarsa token secara aman.
126
+ - **Produk**: Landing page dengan proposisi nilai yang jelas, Halaman harga (pricing) dengan 2-3 tier, Alur onboarding (< 5 menit), Dokumen Terms of Service dan Kebijakan Privasi, **Dashboard Super Admin** yang di-deploy di subdomain untuk manajemen aplikasi.
127
+ - **Pemasaran**: Domain terkonfigurasi, Tag meta SEO pada semua halaman, Google Analytics/PostHog aktif, Akun media sosial siap.
128
+
129
+
130
+ ### Praktik Terbaik & Pemecahan Masalah
131
+ - **Iterasi Cepat**: Luncurkan MVP dalam waktu maksimal 4-6 minggu, lalu lakukan iterasi berdasarkan masukan pengguna.
132
+ - **Tarik Biaya sejak Hari Ke-1**: Pengguna berbayar memvalidasi keselarasan produk dengan kebutuhan pasar secara nyata.
133
+ - **Webhook Stripe**: Gunakan Stripe CLI untuk pengujian webhook lokal: `stripe listen --forward-to localhost:3000/api/webhooks/stripe`.
134
+
135
+ ---
136
+
137
+ ## Code References / Acuan Kode
138
+
139
+ ### Prisma Schema (`prisma/schema.prisma`)
140
+ ```prisma
141
+ model User {
142
+ id String @id @default(cuid())
143
+ email String @unique
144
+ name String?
145
+ isSuperAdmin Boolean @default(false)
146
+ createdAt DateTime @default(now())
147
+ subscription Subscription?
148
+ workspaces WorkspaceMember[]
149
+ }
150
+
151
+ model Workspace {
152
+ id String @id @default(cuid())
153
+ name String
154
+ slug String @unique
155
+ plan Plan @default(FREE)
156
+ members WorkspaceMember[]
157
+ createdAt DateTime @default(now())
158
+ }
159
+
160
+ model WorkspaceMember {
161
+ id String @id @default(cuid())
162
+ workspaceId String
163
+ workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
164
+ userId String
165
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
166
+ role String // ADMIN, MEMBER
167
+ createdAt DateTime @default(now())
168
+
169
+ @@unique([workspaceId, userId])
170
+ }
171
+
172
+ model Subscription {
173
+ id String @id @default(cuid())
174
+ userId String @unique
175
+ user User @relation(fields: [userId], references: [id])
176
+ stripeCustomerId String @unique
177
+ stripePriceId String
178
+ stripeSubId String @unique
179
+ status String # active, canceled, past_due
180
+ currentPeriodEnd DateTime
181
+ }
182
+
183
+ enum Plan {
184
+ FREE
185
+ PRO
186
+ ENTERPRISE
187
+ }
188
+ ```
189
+
190
+ ### Drizzle ORM Schema (`lib/db/schema.ts`)
191
+ ```typescript
192
+ import { pgTable, text, timestamp, pgEnum, unique, boolean } from 'drizzle-orm/pg-core';
193
+
194
+ export const planEnum = pgEnum('plan', ['FREE', 'PRO', 'ENTERPRISE']);
195
+
196
+ export const users = pgTable('users', {
197
+ id: text('id').primaryKey(),
198
+ email: text('email').notNull().unique(),
199
+ name: text('name'),
200
+ isSuperAdmin: boolean('is_super_admin').default(false).notNull(),
201
+ createdAt: timestamp('created_at').defaultNow().notNull(),
202
+ });
203
+
204
+ export const workspaces = pgTable('workspaces', {
205
+ id: text('id').primaryKey(),
206
+ name: text('name').notNull(),
207
+ slug: text('slug').notNull().unique(),
208
+ plan: planEnum('plan').default('FREE').notNull(),
209
+ createdAt: timestamp('created_at').defaultNow().notNull(),
210
+ });
211
+
212
+ export const workspaceMembers = pgTable('workspace_members', {
213
+ id: text('id').primaryKey(),
214
+ workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'cascade' }).notNull(),
215
+ userId: text('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
216
+ role: text('role').$type<'ADMIN' | 'MEMBER'>().default('MEMBER').notNull(),
217
+ createdAt: timestamp('created_at').defaultNow().notNull(),
218
+ }, (t) => ({
219
+ unq: unique().on(t.workspaceId, t.userId),
220
+ }));
221
+
222
+ export const subscriptions = pgTable('subscriptions', {
223
+ id: text('id').primaryKey(),
224
+ userId: text('user_id').references(() => users.id).notNull().unique(),
225
+ stripeCustomerId: text('stripe_customer_id').notNull().unique(),
226
+ stripePriceId: text('stripe_price_id').notNull(),
227
+ stripeSubId: text('stripe_sub_id').notNull().unique(),
228
+ status: text('status').notNull(),
229
+ currentPeriodEnd: timestamp('current_period_end').notNull(),
230
+ });
231
+ ```