How kethmark/optimize works
Main System Components
a) Frontend Layer:
• Next.js App Router architecture
• Client-side components (under /components)
• Theme and UI components system
• Authentication flows
b) Backend Layer:
• API Routes (under /app/api)
• Authentication system
• RAG (Retrieval-Augmented Generation) AI middleware
• Database interactions
c) External Services:
• Supabase integration
• AI service integration
┌─────────────────────────────────────────┐
• Client Layer │
• Pages (app/*) │
• Components │
• UI Component Library │
• ┘
┌─────────────────────────────────────────┐
• API Layer │
• Auth Routes │
• Chat Routes │
• Document Routes │
• Profile Routes │
• ┘
┌─────────────────────────────────────────┐
• Service Layer │
• Supabase │
• RAG AI System │
• Database (Drizzle ORM) │
• ┘
Key Relationships to Highlight
• User authentication flow
• Chat message flow
• Document upload and embedding process
• AI interaction pipeline
Technical Stack Callouts
• Next.js 13+ (App Router)
• TypeScript
• Tailwind CSS
• Drizzle ORM
• Supabase
• AI Integration
Data Flow Patterns
Highlight:
• Server-side rendering paths
• Client-side interactions
• API route handling
• Database queries
• AI processing pipeline
Remember to include:
• Error handling flows
• Authentication state management
• Data persistence patterns
• Real-time update mechanisms
• AI processing pipeline
This will give other engineers a clear understanding of how the application works from both a high-level architectural perspective and a detailed implementation view.