How raj-28/tohorizonsai works
Main Components
a) Client-Side Layer:
• Next.js Frontend (App Router based)
• UI Components (shadcn/ui based)
• Authentication Interface
• Chat Interface
• File Upload Interface
b) Server-Side Layer:
• Next.js Server Components
• Server Actions
• Authentication System (NextAuth.js)
• API Routes
c) External Services:
• AI Models Integration (AI SDK)
• Vercel Postgres Database
• Vercel Blob Storage
• Authentication Providers
┌─ Client Layer ─────────────────────┐
• React Components │
• UI Components │
• Client-side State Management │
• ┬───────────────────┘
• ↕
┌─ Server Layer ─────────────────────┐
• ┌─ Next.js App Router ───────────┐ │
• Server Components │ │
• API Routes │ │
• Server Actions │ │
• ┘ │
• ┌─ Authentication ──────────────┐ │
• NextAuth.js │ │
• ┘ │
• ┬───────────────────┘
• ↕
┌─ External Services ────────────────┐
• AI Models (via AI SDK) │
• Vercel Postgres │
• Vercel Blob Storage │
• ┘
Detailed Component Breakdown
a) Chat Implementation:
• Flow from /app/(chat) through the AI SDK to the model providers
• Message stream handling (components/block-stream-handler.tsx)
• File upload flow through Vercel Blob
b) Authentication Flow:
• Flow from /app/(auth) through NextAuth.js
• Integration with the database for user management
c) Database Schema:
• A simplified version of the schema from lib/db/schema.ts
• Relationships between users, chats, and messages
Implementation Details
• API routes under /app/(chat)/api/
• Authentication routes under /app/(auth)/api/
• Database migrations and queries
• UI component hierarchy
• Server action flows
The real-time chat functionality
Remember to include version information and any relevant environment configurations that affect the architecture.