How phukon/clack works
Main System Components
a) Client Layer:
• Next.js Frontend (src/app directory)
• Authentication UI (src/app/auth)
• Dashboard Interface (src/app/dash)
• Rich Text Editor (src/app/note)
b) API Layer:
• Authentication Endpoints (src/app/api/auth)
• Integration Endpoints (Google, Notion)
• Webhook Handlers (Stripe)
• Cron Job Endpoints
c) Service Layer:
• Authentication Service (NextAuth.js)
• Document Processing
• Encryption Service (AES-256-CBC)
• Payment Processing (Stripe)
• Email Service (Resend)
d) Data Layer:
• Neon PostgreSQL Database
• Vercel KV (Redis)
• Cloudflare Workers KV
Key Relationships to Highlight
a) Authentication Flow:
User → Auth UI → NextAuth.js → Database
• ↘ Email Service
b) Document Processing Flow:
User → Editor UI → API Layer → Encryption Service → Database
• ↘ Integration Services (Notion/Google)
c) Data Synchronization:
Cron Jobs → API Layer → KV Stores
• ↘ Database
Performance Optimization Points
Highlight:
• Cloudflare Workers KV for low-latency data
• Vercel KV for caching
• Redundant cron jobs (Vercel + EC2)
Architectural Patterns to Emphasize
• Server-side rendering with Next.js
• API route handlers
• Database schema relationships
• Middleware implementation
• Service layer abstraction
Remember to:
• Version information
• Document all external service dependencies
• Error handling flows
• Data encryption points
• Public vs. protected routes
Keep the abstraction level high enough to be understandable but detailed enough to show the crucial architectural decisions, especially around data encryption, integration points, and the cron job system for word count tracking.