How orelchalfon/raayentiai works
Project type and purpose
• RaayentiAI is a full-stack, Next.js (App Router) application written in TypeScript that delivers an AI-powered tutoring platform.
• It offers user-facing pages (React components under the app and components directories), server-side API routes (app/api/sentry-example-api/route.ts), and integrates with a database (Supabase) and external AI services for personalized tutoring.
File structure
• Top-level “app” folder: Next.js 13 App Router structure containing page.tsx, layout.tsx, global CSS, error handling, and nested routes (e.g., /companions, /my-journey, /sign-in, /subscription).
• app/api/...: Serverless API route(s) executed on Next.js server/Edge.
• components: Reusable UI primitives, layouts, forms, cards, navigation; grouped by function (e.g., ui for design system atoms).
• lib: Business logic and integrations – Supabase client (lib/supabase.ts), companion actions (lib/actions/companion.action.ts), utility functions, and a VAPI SDK wrapper.
• Configuration & instrumentation: next.config.ts, middleware.ts, Sentry edge/server configs, instrumentation.ts, and Tailwind/PostCSS configs.
• Types, constants, and environment: TypeScript declarations and JSON constants.
Extract architectural insights from the README
• Confirms multi-subject AI tutoring, interactive Q&A, progress tracking.
• Technology callouts include TypeScript, Next.js (implied React/Node), and external AI/analytics services.
Main components and interactions
a. Client Layer
– Web Browser / Mobile Browser (Next.js SSR + CSR)
– React Server & Client Components (pages under app/…)
b. Edge / API Layer
– Next.js App Router server runtime (Edge Functions or Node)
– API endpoints (e.g., /api/sentry-example-api)
c. Business Logic / Service Layer
– Companion actions and tutoring workflows (lib/actions)
– Supabase SDK (lib/supabase.ts) for user data, progress, session management
– VAPI SDK (lib/vapi.sdk.ts) as AI integration wrapper
d. Data & External Services
– Supabase Database (Postgres)
– AI Service (e.g., OpenAI or custom model via VAPI)
– Sentry (Error/Performance Monitoring)
e. Static Assets & CDN
– Next.js Static file serving (under public/)
– CSS & Tailwind/PostCSS pipeline
Architectural patterns and design principles
• Component-based UI (atomic design in components/ui)
• Separation of concerns: UI vs. business logic vs. data layer
• Serverless/Edge functions for API routes and monitoring (Sentry)
• Modular state & actions in lib/actions for testability and reuse
• App Router for nested routing and layouts (Next.js 13 conventions)
– Clear labels for each component (e.g., “Next.js App Router”, “Supabase DB”, “OpenAI API”)
– Notes on technologies: “Node.js runtime”, “TypeScript”, “React Server Components”, “Edge Function”
– Deployment artifacts: Next.js build, static export, Edge configuration