# kimflip-dev/vibebase-essential architecture

> Architecture diagram of the GitHub repository kimflip-dev/vibebase-essential, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kimflip-dev/vibebase-essential
- Repository: https://github.com/kimflip-dev/vibebase-essential

## Overview

VibeBase Essential is a Next.js SaaS starter kit. Its main user journey is account creation/login, browsing a product, checkout and payment verification, then accessing purchases and receipts in the account area. Separate branches provide blog publishing, gated downloads, inquiries, and administrative management. Supabase backs authentication and application records; PortOne handles payments, with optional Resend email. The graph reflects README-documented capabilities where implementation was not sampled; those links are documented rather than claims of source inspection.

Main entry points: [`app/api/webhooks/portone/route.ts`](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/api/webhooks/portone/route.ts) (Payment webhook), [`app/products/actions.ts`](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/products/actions.ts) (Payment actions), [`lib/portone/client.ts`](https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/portone/client.ts) (PortOne API client), [`lib/admin/auth.ts`](https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/admin/auth.ts) (Admin authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_home["Landing page<br/>[page.tsx]"]
end

subgraph group_identity["Identity and account"]
  node_auth["Authentication<br/>[actions.ts]"]
  node_auth_callback["OAuth callback<br/>[route.ts]"]
  node_account["Member account<br/>[actions.ts]"]
  node_profile["Profile settings<br/>[page.tsx]"]
  node_inquiries["Member inquiries<br/>[actions.ts]"]
end

subgraph group_commerce["Commerce and payments"]
  node_products["Product catalog<br/>[actions.ts]"]
  node_checkout["Checkout<br/>[page.tsx]"]
  node_payment_widget["Payment widget"]
  node_payment_actions["Payment actions<br/>[actions.ts]"]
  node_portone_client["PortOne API client<br/>[client.ts]"]
  node_webhook["Payment webhook<br/>[route.ts]"]
  node_signature["Webhook verification<br/>[webhook.ts]"]
  node_purchases["Purchase history<br/>[page.tsx]"]
end

subgraph group_content["Content and downloads"]
  node_blog["Public blog<br/>[actions.ts]"]
  node_downloads["Download catalog<br/>[actions.ts]"]
  node_download_file["Gated file delivery<br/>[route.ts]"]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin workspace<br/>[page.tsx]"]
  node_admin_downloads["Download management<br/>[actions.ts]"]
  node_admin_auth["Admin authorization<br/>[auth.ts]"]
  node_bootstrap["First-admin bootstrap<br/>[bootstrap.ts]"]
end

subgraph group_platform["Shared services"]
  node_supabase[("Supabase")]
  node_email["Email delivery<br/>[send.ts]"]
end

node_visitor(("Visitor or member"))
node_resend["Resend"]
node_portone["PortOne"]

node_visitor -->|"visits"| node_home
node_visitor -.->|"registers or logs in"| node_auth
node_auth_callback -->|"checks first admin"| node_bootstrap
node_auth_callback -->|"exchanges session"| node_supabase
node_account -.->|"reads and updates account"| node_supabase
node_profile -->|"invokes profile actions"| node_account
node_profile -->|"loads current user"| node_supabase
node_visitor -.->|"browses products"| node_products
node_products -->|"queries published products"| node_supabase
node_checkout -.->|"renders"| node_payment_widget
node_checkout -.->|"starts checkout"| node_payment_actions
node_payment_actions -->|"creates pending order"| node_supabase
node_payment_widget -.->|"initiates payment"| node_portone
node_payment_actions -->|"verifies payment"| node_portone_client
node_portone_client -->|"calls payment API"| node_portone
node_portone -.->|"sends events"| node_webhook
node_webhook -->|"validates signature"| node_signature
node_webhook -->|"retrieves payment"| node_portone_client
node_webhook -->|"records purchase or refund"| node_supabase
node_purchases -->|"loads purchases"| node_payment_actions
node_payment_actions -->|"sends purchase receipt"| node_email
node_webhook -->|"sends receipt or refund notice"| node_email
node_email -.->|"delivers email"| node_resend
node_visitor -.->|"reads posts"| node_blog
node_blog -->|"loads posts"| node_supabase
node_visitor -.->|"browses downloads"| node_downloads
node_downloads -->|"loads download records"| node_supabase
node_download_file -->|"authorizes file access"| node_supabase
node_admin_ui -.->|"checks admin access"| node_admin_auth
node_admin_auth -->|"reads role claims"| node_supabase
node_admin_downloads -->|"requires admin"| node_admin_auth
node_admin_downloads -->|"manages downloads"| node_supabase
node_bootstrap -->|"assigns initial role"| node_supabase

click node_home "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/page.tsx"
click node_auth "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/auth/actions.ts"
click node_auth_callback "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/auth/callback/route.ts"
click node_account "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/actions.ts"
click node_profile "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/profile/page.tsx"
click node_inquiries "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/inquiries/actions.ts"
click node_products "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/products/actions.ts"
click node_checkout "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/products/%5Bslug%5D/checkout/page.tsx"
click node_payment_widget "https://github.com/kimflip-dev/vibebase-essential/blob/main/components/products/portone-payment-widget.tsx"
click node_payment_actions "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/products/actions.ts"
click node_portone_client "https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/portone/client.ts"
click node_webhook "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/api/webhooks/portone/route.ts"
click node_signature "https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/portone/webhook.ts"
click node_purchases "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/purchases/page.tsx"
click node_blog "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/blog/actions.ts"
click node_downloads "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/download/actions.ts"
click node_download_file "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/api/downloads/%5Bid%5D/file/route.ts"
click node_admin_ui "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/admin/dashboard/page.tsx"
click node_admin_downloads "https://github.com/kimflip-dev/vibebase-essential/blob/main/app/admin/downloads/actions.ts"
click node_admin_auth "https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/admin/auth.ts"
click node_bootstrap "https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/admin/bootstrap.ts"
click node_email "https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/email/send.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home toneBlue
class node_auth,node_auth_callback,node_account,node_profile,node_inquiries toneAmber
class node_products,node_checkout,node_payment_widget,node_payment_actions,node_portone_client,node_webhook,node_signature,node_purchases toneMint
class node_blog,node_downloads,node_download_file toneRose
class node_admin_ui,node_admin_downloads,node_admin_auth,node_bootstrap,node_visitor,node_resend,node_portone toneIndigo
class node_supabase,node_email toneTeal
```

## Components

### Public experience

- [Landing page](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/page.tsx): `app/page.tsx`

### Identity and account

- [Authentication](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/auth/actions.ts): `app/auth/actions.ts`
- [OAuth callback](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/auth/callback/route.ts): `app/auth/callback/route.ts`
- [Member account](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/actions.ts): `app/mypage/actions.ts`
- [Profile settings](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/profile/page.tsx): `app/mypage/profile/page.tsx`
- [Member inquiries](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/inquiries/actions.ts): `app/mypage/inquiries/actions.ts`

### Commerce and payments

- [Product catalog](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/products/actions.ts): `app/products/actions.ts`
- [Checkout](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/products/%5Bslug%5D/checkout/page.tsx): `app/products/[slug]/checkout/page.tsx`
- [Payment widget](https://github.com/kimflip-dev/vibebase-essential/blob/main/components/products/portone-payment-widget.tsx): `components/products/portone-payment-widget.tsx`
- [Payment actions](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/products/actions.ts): `app/products/actions.ts`
- [PortOne API client](https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/portone/client.ts): `lib/portone/client.ts`
- [Payment webhook](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/api/webhooks/portone/route.ts): `app/api/webhooks/portone/route.ts`
- [Webhook verification](https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/portone/webhook.ts): `lib/portone/webhook.ts`
- [Purchase history](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/mypage/purchases/page.tsx): `app/mypage/purchases/page.tsx`

### Content and downloads

- [Public blog](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/blog/actions.ts): `app/blog/actions.ts`
- [Download catalog](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/download/actions.ts): `app/download/actions.ts`
- [Gated file delivery](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/api/downloads/%5Bid%5D/file/route.ts): `app/api/downloads/[id]/file/route.ts`

### Administration

- [Admin workspace](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/admin/dashboard/page.tsx): `app/admin/dashboard/page.tsx`
- [Download management](https://github.com/kimflip-dev/vibebase-essential/blob/main/app/admin/downloads/actions.ts): `app/admin/downloads/actions.ts`
- [Admin authorization](https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/admin/auth.ts): `lib/admin/auth.ts`
- [First-admin bootstrap](https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/admin/bootstrap.ts): `lib/admin/bootstrap.ts`

### Shared services

- **Supabase**
- [Email delivery](https://github.com/kimflip-dev/vibebase-essential/blob/main/lib/email/send.ts): `lib/email/send.ts`

### Other components

- **Visitor or member**
- **Resend**
- **PortOne**

## Connections

- Visitor or member → Landing page: visits (evidence: `app/page.tsx`)
- Visitor or member → Authentication: registers or logs in
- OAuth callback → First-admin bootstrap: checks first admin (evidence: `app/auth/callback/route.ts`)
- OAuth callback → Supabase: exchanges session (evidence: `app/auth/callback/route.ts`)
- Member account → Supabase: reads and updates account
- Profile settings → Member account: invokes profile actions (evidence: `app/mypage/profile/page.tsx`)
- Profile settings → Supabase: loads current user (evidence: `app/mypage/profile/page.tsx`)
- Visitor or member → Product catalog: browses products
- Product catalog → Supabase: queries published products (evidence: `app/products/actions.ts`)
- Checkout → Payment widget: renders
- Checkout → Payment actions: starts checkout
- Payment actions → Supabase: creates pending order (evidence: `app/products/actions.ts`)
- Payment widget → PortOne: initiates payment
- Payment actions → PortOne API client: verifies payment (evidence: `app/products/actions.ts`)
- PortOne API client → PortOne: calls payment API (evidence: `lib/portone/client.ts`)
- PortOne → Payment webhook: sends events
- Payment webhook → Webhook verification: validates signature (evidence: `app/api/webhooks/portone/route.ts`)
- Payment webhook → PortOne API client: retrieves payment (evidence: `app/api/webhooks/portone/route.ts`)
- Payment webhook → Supabase: records purchase or refund (evidence: `app/api/webhooks/portone/route.ts`)
- Purchase history → Payment actions: loads purchases (evidence: `app/mypage/purchases/page.tsx`)
- Payment actions → Email delivery: sends purchase receipt (evidence: `app/products/actions.ts`)
- Payment webhook → Email delivery: sends receipt or refund notice (evidence: `app/api/webhooks/portone/route.ts`)
- Email delivery → Resend: delivers email
- Visitor or member → Public blog: reads posts
- Public blog → Supabase: loads posts (evidence: `app/blog/actions.ts`)
- Visitor or member → Download catalog: browses downloads
- Download catalog → Supabase: loads download records (evidence: `app/download/actions.ts`)
- Gated file delivery → Supabase: authorizes file access (evidence: `app/api/downloads/[id]/file/route.ts`)
- Admin workspace → Admin authorization: checks admin access
- Admin authorization → Supabase: reads role claims (evidence: `lib/admin/auth.ts`)
- Download management → Admin authorization: requires admin (evidence: `app/admin/downloads/actions.ts`)
- Download management → Supabase: manages downloads (evidence: `app/admin/downloads/actions.ts`)
- First-admin bootstrap → Supabase: assigns initial role (evidence: `lib/admin/bootstrap.ts`)
