How khai-pi/co-oder works
Main System Components
A. Frontend Layer
• Sub-components for:
• Pages (src/app/*)
• Components (src/components/)
• Context (auth-context)
• UI Components (src/components/ui/)
B. API Layer
• Distinct sections for:
• Auth APIs (/api/auth/*)
• User APIs (/api/users)
• Project APIs (/api/projects)
C. Service Layer
• Services for:
• Auth Services
• User Services
• Project Services
D. Database Layer
• Main entities:
• Users
• Projects
• Auth Tables
Component Relationships
• Client → API Routes (HTTP requests)
• API Routes → Service Layer (Internal calls)
• Service Layer → Database (Prisma queries)
• Auth Context → Auth APIs (Session management)
Key Architectural Elements
Important architectural patterns:
• Next.js App Router architecture
• API Route handlers
• Service-based architecture
• Prisma ORM integration
┌─ Client Layer ─────────────────┐
• Pages │
• Components │
• Auth Context │
• UI Components │
• ┬───────────────┘
• ↓
┌─ API Layer ────────────────────┐
• Auth Routes │
• User Routes │
• Project Routes │
• ┬───────────────┘
• ↓
┌─ Service Layer ────────────────┐
• Auth Services │
• User Services │
• Project Services │
• ┬───────────────┘
• ↓
┌─ Database Layer ───────────────┐
• Users │
• Projects │
• Auth Tables │
• ┘