How mathew-gao/subscription-starter works
Main System Components
a) Frontend Layer (Next.js Application):
• Client-side components (under /components/ui)
• Authentication forms
• Account management
• Pricing interface
• Payment flows
b) Backend Layer:
• Next.js API routes (under /app/api)
• Webhook handlers
• Authentication endpoints
• Middleware
c) External Services:
• Supabase (Authentication & Database)
• Stripe (Payment Processing)
Component Relationships
a) Client-Server Flow:
• User interactions with the frontend
• API calls to backend endpoints
• Authentication flows
• Payment processing routes
b) External Service Integration:
• Supabase authentication flows
• Stripe payment processing
• Webhook communication paths
Related components
Frontend Layer:
• Public Pages (/, /signin, /account)
• Protected Routes
• UI Components
• Auth Forms
Backend Layer:
• API Routes
• Webhook Handlers
• Middleware
External Services:
• Supabase
• Auth
• Database
• Stripe
• Checkout
• Customer Portal
• Webhooks
Critical paths
• User authentication flow
• Subscription purchase flow
• Webhook processing flow
• Database synchronization
[User Browser] → [Next.js Frontend] → [Next.js API Routes]
• ↕ ↕ ↕
[Supabase Auth] ← → [Middleware] ← → [Stripe Payments]
• ↕ ↕
[Supabase DB] ← ─ ─ ─ ─ ─ ─ ─ ─ ─ [Stripe Webhooks]
Document all external service connections
This architecture should emphasize the project's subscription-based SaaS nature while showing the integration between Next.js, Supabase, and Stripe.