How aaryan6/ai-mini-apps works
Main System Components
a) Frontend Layer:
• Pages (PDF Chat, Regular Chat, Auth pages)
• UI Components
• Theme Provider
• Client-side Utilities
b) Next.js Application Layer:
• API Routes
• Server Components
• Client Components
• Middleware
c) Backend Services:
• Distinct services:
• Authentication Service (NextAuth.js)
• PDF Processing Service
• Chat/AI Service
• Database Layer (Drizzle ORM)
Component Relationships
a) Client-Server Communication:
• API routes (/api/chat, /api/pdf-chat, /api/files/*)
• Authentication flow
• WebSocket or streaming connections for chat functionality
b) Data Flow:
• PDF processing pipeline
• Chat message flow
• Authentication flow
• Database interactions
Specific Implementation Details
Technical elements:
Frontend:
• Public Routes
• Home Page
• Protected Routes
• Chat Interface
• PDF Chat Interface
• Shared Components
• UI Components
• Theme System
API Layer:
• Auth Routes (/api/auth/*)
• Chat Routes (/api/chat)
• PDF Routes
• Upload
• Delete
• List
• PDF Chat Routes
Backend Services:
• Authentication (NextAuth.js)
• Database (Drizzle)
• PDF Processing
• AI/Chat Processing
Key Architectural Patterns to Highlight
• Next.js App Router architecture
• Authentication flow with NextAuth.js
• PDF processing pipeline
• Real-time chat functionality
• Database schema and relationships