How rorkai/21st works
High-Level Architecture Overview
a) Frontend Layer (Next.js Application)
• Key areas:
• Public facing pages (/app directory)
• Component preview system
• Publishing interface
• Authentication flows
b) Backend Services Layer
• In the middle, showing connections to:
• Clerk (Authentication)
• Supabase (Database)
• Cloudflare R2 (Component Storage)
• CodeSandbox/Sandpack (Component Preview)
c) Storage Layer
• At the bottom, showing:
• Supabase Database
• R2 Storage Bucket
Component Relationships
a) Client-Side Flow:
User Interface → Authentication → Component Registry → Preview System
b) Publishing Flow:
Upload → Validation → Storage → Registry Update
Detailed Component Breakdown
Frontend (Next.js):
• Public Pages
• Component Browser
• User Profiles
• Publishing Interface
• API Routes
• Component Registry
• Webhooks
• Cache Management
• Shared Components
• UI Components
• Preview System
Backend Services:
• Authentication (Clerk)
• Database (Supabase)
• Storage (Cloudflare R2)
• Preview (Sandpack)
Key Workflows to Highlight
a) Component Installation:
npx shadcn → Registry API → Component Retrieval → Local Installation
b) Component Publishing:
Upload → Validation → Storage → Registry Update → Preview Generation
Integration Points
Clear connections for:
• Clerk webhook integration with Supabase
• R2 storage integration with component registry
• Sandpack preview system integration
• shadcn CLI integration points
Scale and Performance
Highlight:
• CDN integration points
• Cache layers
• Database optimization points