Skip to content

chayan-1906/IntelliCourse-Next.js

Repository files navigation

πŸŽ“ IntelliCourse - AI-Powered Voice Learning Platform

Next.js React TypeScript Supabase VAPI Clerk Tailwind CSS License

Revolutionize your learning with AI voice companions. Real-time voice conversations, personalized tutors, and gamified learningβ€”all powered by cutting-edge AI. πŸš€ Voice AI β€’ πŸ“Š Analytics β€’ 🎨 Glassmorphism UI β€’ πŸ”₯ Streak Tracking

logo

Interactive voice learning session with AI companion

🌐 Live Demo β€’ πŸ“– Documentation β€’ πŸ› Report Bug β€’ ✨ Request Feature


✨ Key Features

πŸŽ™οΈ Voice-First Learning Experience

  • πŸ—£οΈ Real-Time Voice Conversations - Natural, AI-powered tutoring sessions via VAPI SDK
  • 🎯 Subject-Specific Companions - Create custom AI tutors for Math, Science, Coding, Languages, History, Economics
  • 🎭 Personality Customization - Choose voice gender (Male/Female) and teaching style (Formal/Casual)
  • πŸ“ Live Transcription - Real-time conversation capture with full session transcripts

πŸ“Š Advanced Progress Analytics

  • πŸ“… Activity Heatmap - GitHub-style learning visualization with weekly, monthly, and yearly views
  • πŸ”₯ Streak Counter - Track daily learning consistency and longest streaks
  • πŸ“‰ Bar Charts & Calendars - Multi-view data visualization for insights
  • πŸ† Gamification - Achievement badges and progress milestones

πŸ€– AI Companion Management

  • βž• Create Custom Companions - Multi-step form with topic, subject, voice, and duration selection
  • πŸ“š Companion Library - Browse popular companions and recently completed sessions
  • πŸ’Ύ Bookmarking System - Save favorite companions for quick access
  • πŸ”„ Reusable Templates - Share companion configurations via shareable links
  • 🎨 Subject-Themed UI - Color-coded companions by subject (Math: Yellow, Science: Purple, etc.)

πŸ’» Modern Tech Stack

  • ⚑ Next.js 15 - React 19, Server Components, Turbopack for blazing-fast performance
  • 🎨 Glassmorphism UI - Frosted glass effects with Tailwind CSS 4.0
  • 🌊 Framer Motion - Smooth animations and micro-interactions
  • 🎞️ Lottie Animations - Loading states, success animations, and empty states

πŸ” Secure & Scalable

  • πŸ”’ Clerk Authentication - Google OAuth, social login, and session management
  • πŸ—„οΈ Supabase Backend - PostgreSQL database with real-time subscriptions
  • πŸš€ Edge-Optimized - Sentry error tracking and performance monitoring
  • πŸ”„ Server-Side Caching - React Cache API for optimized data fetching
  • πŸ›‘οΈ Type-Safe - Full TypeScript coverage with Zod validation

πŸ“± Screenshots & Demo

πŸŽ“ Dashboard Overview

IntelliCourse Dashboard showing popular companions and recent sessions

Dashboard showcasing popular companions across subjects and recent learning sessions


πŸ“Έ Feature Highlights

Companion Creation Form
🎨 Companion Creation
Multi-step form for creating AI tutors with custom voice and style
Voice Session with Soundwave
πŸŽ™οΈ Live Voice Session
Real-time conversation with soundwave visualization and transcription
Pre-Session Loading Animation
⏳ Connecting Animation
Smooth loading state while establishing voice connection
Session Completion Success Animation
βœ… Completion Animation
Success feedback with lesson saved confirmation
Activity Heatmap Visualization - Yearly
Activity Heatmap Visualization - Monthly
Activity Heatmap Visualization - Weekly
πŸ“Š Activity Heatmap
GitHub-style learning tracker with yearly/monthly/weekly views
My Journey Dashboard
πŸ”₯ My Journey Dashboard
Progress analytics, streak counter, and session history

πŸ—οΈ Tech Stack & Architecture

πŸ–₯️ Frontend

Technology Version Purpose
Next.js 15.4.7 React framework with App Router, Server Components, and Turbopack
React 19.1.0 UI library with latest concurrent features
TypeScript 5.x Type-safe development with strict mode
Tailwind CSS 4.0 Utility-first CSS with custom glassmorphism design system
Framer Motion 12.23.12 Animation library for smooth transitions and micro-interactions
Lottie React 2.4.1 JSON-based animations for loading and success states

πŸ”Š Voice AI & Integration

Technology Version Purpose
VAPI SDK 2.3.0 Real-time voice conversation AI with WebRTC
React Hook Form 7.62.0 Form state management with Zod validation
Zod 3.25.76 Runtime type validation and schema parsing

πŸ—„οΈ Backend & Database

Technology Version Purpose
Supabase 2.56.0 PostgreSQL database with real-time subscriptions and RLS
Clerk 6.31.4 Authentication and user management with OAuth providers
Prisma (implied) Latest Type-safe database ORM (if used)

🎨 UI Components & Libraries

Technology Purpose
Radix UI Accessible component primitives (Accordion, Select, Label)
Lucide React Modern icon library with 1000+ icons
React Calendar Heatmap GitHub-style activity visualization
React Tooltip Interactive tooltips for data points
Shadcn UI Customizable component system

πŸ› οΈ Developer Tools

Technology Purpose
Sentry Error tracking and performance monitoring
ESLint Code linting with Next.js config
class-variance-authority Type-safe variant styling
clsx + tailwind-merge Conditional className utilities

πŸ›οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Client Layer                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Next.js 15  β”‚  β”‚  React 19    β”‚  β”‚ Tailwind CSS β”‚  β”‚
β”‚  β”‚  App Router  β”‚  β”‚  Components  β”‚  β”‚  Styling     β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Authentication Layer                    β”‚
β”‚                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                        β”‚
β”‚                  β”‚  Clerk Auth  β”‚                        β”‚
β”‚                  β”‚  OAuth 2.0   β”‚                        β”‚
β”‚                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Voice AI Layer        β”‚  β”‚    Database Layer        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  VAPI SDK          β”‚  β”‚  β”‚  β”‚  Supabase          β”‚  β”‚
β”‚  β”‚  - Voice Recognitionβ”‚  β”‚  β”‚  β”‚  - PostgreSQL DB   β”‚  β”‚
β”‚  β”‚  - Text-to-Speech  β”‚  β”‚  β”‚  β”‚  - Real-time APIs  β”‚  β”‚
β”‚  β”‚  - Conversation AI β”‚  β”‚  β”‚  β”‚  - Storage Buckets β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚                           β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Monitoring Layer                        β”‚
β”‚                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                        β”‚
β”‚                  β”‚    Sentry    β”‚                        β”‚
β”‚                  β”‚  Error/Perf  β”‚                        β”‚
β”‚                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Getting Started

πŸ“‹ Prerequisites

Ensure you have the following installed:

  • Node.js 18.0+ (Download) 🟒
  • npm package manager πŸ“¦
  • Git for version control πŸ”§
  • Supabase account (Sign up) πŸ—„οΈ
  • Clerk account (Sign up) πŸ”
  • VAPI account (Sign up) πŸŽ™οΈ

πŸ“₯ Installation Steps

  1. Clone the repository

    git clone https://github.com/chayan-1906/IntelliCourse-Next.js.git
    cd IntelliCourse-Next.js
  2. Install dependencies

    npm install
  3. Configure environment variables

    Create a .env file in the root directory:

    cp .env.example .env

    Add the following variables:

    # Clerk Authentication
    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxx
    CLERK_SECRET_KEY=sk_test_xxxxx
    
    # Clerk - Custom Auth
    NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
    NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/
    NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/
    
    # Supabase Configuration
    NEXT_PUBLIC_SUPABASE_URL=https://xxxxx.supabase.co
    NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
    
    # VAPI Configuration
    NEXT_PUBLIC_VAPI_WEB_TOKEN=xxxxx-xxxxx-xxxxx-xxxxx
    
    # Sentry (Optional - for production monitoring)
    SENTRY_AUTH_TOKEN=xxxxx
  4. Set up Supabase database

    Run the following SQL in your Supabase SQL Editor:

    -- Create companions table
    CREATE TABLE companions (
      id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
      name TEXT NOT NULL,
      subject TEXT NOT NULL,
      topic TEXT NOT NULL,
      voice TEXT NOT NULL,
      style TEXT NOT NULL,
      duration INTEGER NOT NULL,
      author TEXT NOT NULL,
      created_at TIMESTAMPTZ DEFAULT NOW(),
      updated_at TIMESTAMPTZ DEFAULT NOW()
    );
    
    -- Create session_history table
    CREATE TABLE session_history (
      id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
      companion_id UUID REFERENCES companions(id) ON DELETE CASCADE,
      user_id TEXT NOT NULL,
      duration_minutes INTEGER DEFAULT 0,
      transcript TEXT,
      created_at TIMESTAMPTZ DEFAULT NOW(),
      completed_at TIMESTAMPTZ
    );
    
    -- Create bookmarks table
    CREATE TABLE bookmarks (
      id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
      companion_id UUID REFERENCES companions(id) ON DELETE CASCADE,
      user_id TEXT NOT NULL,
      created_at TIMESTAMPTZ DEFAULT NOW(),
      UNIQUE(companion_id, user_id)
    );
    
    -- Enable Row Level Security
    ALTER TABLE companions ENABLE ROW LEVEL SECURITY;
    ALTER TABLE session_history ENABLE ROW LEVEL SECURITY;
    ALTER TABLE bookmarks ENABLE ROW LEVEL SECURITY;
    
    -- Create policies (adjust based on your auth setup)
    CREATE POLICY "Enable read for all users" ON companions FOR SELECT USING (true);
    CREATE POLICY "Enable insert for authenticated users" ON companions FOR INSERT WITH CHECK (true);
    CREATE POLICY "Enable update for owner" ON companions FOR UPDATE USING (auth.uid() = author);
    CREATE POLICY "Enable delete for owner" ON companions FOR DELETE USING (auth.uid() = author);
  5. Configure VAPI Assistant

    In your VAPI dashboard:

    • Create a new assistant
    • Configure voice settings (male/female options)
    • Set up system prompts for educational tutoring
    • Enable conversation transcription
    • Copy the Assistant ID to your .env
  6. Run development server

    npm run dev
  7. Open browser

    Navigate to http://localhost:3000 πŸŽ‰


πŸ“ Project Structure

IntelliCourse-Next.js/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                        # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ api/                    # API routes
β”‚   β”‚   β”‚   └── sentry-example-api/ # Sentry integration
β”‚   β”‚   β”œβ”€β”€ companions/             # Companion pages
β”‚   β”‚   β”‚   β”œβ”€β”€ [id]/              # Dynamic companion detail
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx       # Session page
β”‚   β”‚   β”‚   β”‚   └── loading.tsx    # Loading skeleton
β”‚   β”‚   β”‚   β”œβ”€β”€ new/               # Create companion
β”‚   β”‚   β”‚   └── page.tsx           # Companions list
β”‚   β”‚   β”œβ”€β”€ my-journey/            # User analytics dashboard
β”‚   β”‚   β”œβ”€β”€ subscription/          # Subscription management
β”‚   β”‚   β”œβ”€β”€ sign-in/               # Authentication pages
β”‚   β”‚   β”œβ”€β”€ layout.tsx             # Root layout with providers
β”‚   β”‚   β”œβ”€β”€ page.tsx               # Home page
β”‚   β”‚   └── globals.css            # Global styles
β”‚   β”‚
β”‚   β”œβ”€β”€ components/                 # Reusable components
β”‚   β”‚   β”œβ”€β”€ ui/                    # Shadcn UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ button.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ form.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ input.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ select.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ skeleton.tsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ skeletons/             # Loading skeletons
β”‚   β”‚   β”‚   β”œβ”€β”€ ActivityHeatmapSkeleton.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CompanionCardSkeleton.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SessionHistorySkeleton.tsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ ActivityHeatmap.tsx    # Heatmap visualization
β”‚   β”‚   β”œβ”€β”€ AnimatedMyJourney.tsx  # Animated dashboard
β”‚   β”‚   β”œβ”€β”€ AnimationModal.tsx     # Loading/success modals
β”‚   β”‚   β”œβ”€β”€ CompanionCard.tsx      # Companion display card
β”‚   β”‚   β”œβ”€β”€ CompanionComponent.tsx # Voice session handler
β”‚   β”‚   β”œβ”€β”€ CompanionForm.tsx      # Multi-step creation form
β”‚   β”‚   β”œβ”€β”€ CompanionList.tsx      # List with filtering
β”‚   β”‚   β”œβ”€β”€ MonthlyCalendarGrid.tsx # Calendar view
β”‚   β”‚   β”œβ”€β”€ Navbar.tsx             # Navigation bar
β”‚   β”‚   β”œβ”€β”€ SessionHistory.tsx     # Session log with export
β”‚   β”‚   β”œβ”€β”€ StreakCounter.tsx      # Gamification component
β”‚   β”‚   β”œβ”€β”€ TranscriptViewer.tsx   # Session transcript display
β”‚   β”‚   β”œβ”€β”€ WeeklyBarChart.tsx     # Bar chart visualization
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ lib/                       # Utility libraries
β”‚   β”‚   β”œβ”€β”€ actions/               # Server actions
β”‚   β”‚   β”‚   └── companion.actions.ts # CRUD operations
β”‚   β”‚   β”œβ”€β”€ routes.ts              # Route constants
β”‚   β”‚   β”œβ”€β”€ share.ts               # Share functionality
β”‚   β”‚   β”œβ”€β”€ supabase.ts            # Supabase client
β”‚   β”‚   β”œβ”€β”€ utils.ts               # Utility functions
β”‚   β”‚   └── vapi.sdk.ts            # VAPI SDK wrapper
β”‚   β”‚
β”‚   β”œβ”€β”€ types/                     # TypeScript definitions
β”‚   β”‚   β”œβ”€β”€ companion.ts           # Companion types
β”‚   β”‚   β”œβ”€β”€ index.d.ts             # Global types
β”‚   β”‚   β”œβ”€β”€ navigation.ts          # Navigation types
β”‚   β”‚   └── vapi.d.ts              # VAPI types
β”‚   β”‚
β”‚   β”œβ”€β”€ hooks/                     # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useAnimationModal.ts   # Modal state management
β”‚   β”‚   └── useBreadcrumbs.ts      # Navigation breadcrumbs
β”‚   β”‚
β”‚   β”œβ”€β”€ config/                    # Configuration files
β”‚   β”‚   β”œβ”€β”€ config.ts              # App configuration
β”‚   β”‚   └── navigation.ts          # Navigation config
β”‚   β”‚
β”‚   β”œβ”€β”€ constants/                 # App constants
β”‚   β”‚   β”œβ”€β”€ animations.ts          # Lottie animation paths
β”‚   β”‚   β”œβ”€β”€ icons.ts               # Icon mappings
β”‚   β”‚   β”œβ”€β”€ index.ts               # General constants
β”‚   β”‚   └── soundwaves.json        # Soundwave animation
β”‚   β”‚
β”‚   β”œβ”€β”€ middleware.ts              # Auth & route middleware
β”‚   └── instrumentation.ts         # Sentry instrumentation
β”‚
β”œβ”€β”€ public/                        # Static assets
β”‚   β”œβ”€β”€ animations/                # Lottie JSON files
β”‚   β”‚   β”œβ”€β”€ neural-network.json
β”‚   β”‚   └── no-data.json
β”‚   β”œβ”€β”€ icons/                     # SVG icons
β”‚   β”‚   β”œβ”€β”€ bookmark.svg
β”‚   β”‚   β”œβ”€β”€ mic-on.svg
β”‚   β”‚   β”œβ”€β”€ mic-off.svg
β”‚   β”‚   └── ...
β”‚   └── images/                    # Static images
β”‚       β”œβ”€β”€ logo.svg
β”‚       β”œβ”€β”€ cta.svg
β”‚       └── limit.svg
β”‚
β”œβ”€β”€ .env                           # Environment variables (gitignored)
β”œβ”€β”€ components.json                # Shadcn UI config
β”œβ”€β”€ next.config.ts                 # Next.js configuration
β”œβ”€β”€ package.json                   # Dependencies
β”œβ”€β”€ postcss.config.mjs             # PostCSS config
β”œβ”€β”€ tailwind.config.ts             # Tailwind configuration
β”œβ”€β”€ tsconfig.json                  # TypeScript config
β”œβ”€β”€ sentry.server.config.ts        # Sentry server config
β”œβ”€β”€ sentry.edge.config.ts          # Sentry edge config
└── README.md                      # The repository README

🎯 Core Features Deep Dive

πŸŽ™οΈ Voice Session Management

How it Works:

  1. User creates a companion with subject, topic, voice, and style
  2. Session starts via CompanionComponent.tsx using VAPI SDK
  3. Real-time transcription captures conversation
  4. Timer tracks session duration (auto-saved)
  5. Transcript saved to Supabase on session end
  6. Activity data updates the heatmap and streak counter

Key Components:

  • CompanionComponent.tsx - Handles VAPI lifecycle, mic control, and state
  • vapi.sdk.ts - VAPI client initialization and event handlers
  • companion.actions.ts - Server actions for session CRUD operations

Voice Features:

  • Microphone mute/unmute toggle
  • Live speech-to-text transcription
  • Soundwave visualization during speech
  • Session duration tracking with live timer
  • Automatic session history saving

πŸ“Š Analytics & Gamification

Activity Heatmap:

  • Weekly View - Bar chart with session counts
  • Monthly View - Calendar grid with daily minutes
  • Yearly View - GitHub-style contribution graph
  • Export Functionality - Download as PNG/SVG

Streak Counter:

  • Current streak tracking (consecutive days)
  • Longest streak record
  • "Active Today" indicator with fire emoji
  • Last activity date display
  • Real-time updates on session completion

Session History:

  • Tabular view with companion name, subject, date, duration
  • Export to CSV functionality
  • Transcript viewer modal
  • Sorting and filtering options

πŸ€– Companion Creation Flow

Multi-Step Form (CompanionForm.tsx):

  1. Name - Companion display name
  2. Subject - Select from 6 categories (Math, Science, Coding, etc.)
  3. Topic - What should the companion teach? (Textarea)
  4. Voice - Male or Female voice selection
  5. Style - Formal or Casual teaching approach
  6. Duration - Estimated session length (minutes)

Validation:

  • Zod schema validation
  • Real-time error messages
  • Form state management via React Hook Form
  • Loading animations during creation
  • Success modal with auto-redirect

πŸ—„οΈ Database Schema

Companions Table

{
	id: UUID                // Primary key
	name: string            // Companion name
	subject: string         // Subject category (maths, science, etc.)
	topic: string           // Learning topic description
	voice: string           // Voice preference (male/female)
	style: string           // Teaching style (formal/casual)
	duration: number        // Estimated session duration (minutes)
	author: string          // User ID (Clerk)
	created_at: timestamp   // Creation date
	updated_at: timestamp   // Last update date
}

Session History Table

{
	id: UUID                // Primary key
	companion_id: UUID      // Foreign key β†’ companions.id
	user_id: string         // User ID (Clerk)
	duration_minutes: number // Actual session duration
	transcript: text        // Full conversation transcript
	created_at: timestamp   // Session start time
	completed_at: timestamp // Session end time
}

Bookmarks Table

{
	id: UUID                // Primary key
	companion_id: UUID      // Foreign key β†’ companions.id
	user_id: string         // User ID (Clerk)
	created_at: timestamp   // Bookmark date
	UNIQUE(companion_id, user_id) // One bookmark per user/companion
}

🎨 Design System

Color Palette (Subject-Based)

Science: #E5D0FF

(
Purple

)
Maths: #FFDA6E

(
Yellow

)
Language: #BDE7FF

(
Blue

)
Coding: #FFC8E4

(
Pink

)
History: #FFECC8

(
Beige

)
Economics: #C8FFDF

(
Green

)

Glassmorphism Theme

  • Backdrop Blur: backdrop-blur-lg
  • Border: border border-white/20
  • Background: bg-white/10
  • Shadow: shadow-[0_8px_32px_0_rgba(31,38,135,0.37)]

Typography

  • Font Family: Geist
  • Headings: Bold, 2xl-4xl sizes
  • Body Text: Regular, sm-lg sizes
  • Code: Monospace for session timers

Animations

  • Framer Motion: Page transitions, accordions, hover effects
  • Lottie: Loading spinners, success checkmarks, empty states
  • Custom Soundwaves: Real-time visualization during voice sessions

πŸš€ Performance Optimizations

🏎️ Speed & Efficiency

  • Server-Side Caching - React Cache API for database queries
  • Dynamic Imports - Code splitting for Lottie and heavy components
  • Skeleton Loading - Perceived performance with loading states
  • Image Optimization - Next.js Image component with lazy loading
  • Turbopack - 700x faster than Webpack for local development

πŸ”„ Revalidation Strategy

// Page revalidation times
export const revalidate = 180;  // 3 minutes (companion detail pages)
export const revalidate = 300;  // 5 minutes (my-journey page)

πŸ”’ Security & Authentication

πŸ›‘οΈ Security Measures

  • Clerk Authentication - OAuth 2.0 with Google, GitHub, email
  • Row-Level Security (RLS) - Supabase policies for data access
  • Input Validation - Zod schemas for all form inputs
  • CSRF Protection - Next.js built-in protection
  • Environment Variables - Secrets stored in .env (gitignored)
  • Sentry Monitoring - Real-time error tracking and alerting

πŸ” Authentication Flow

User Login β†’ Clerk OAuth β†’ JWT Token β†’ Supabase Client β†’ RLS Policies β†’ Data Access

πŸ‘₯ User Roles & Permissions

  • Free Users: 3 companions limit, 10 sessions/month
  • Pro Users: Unlimited companions, unlimited sessions
  • Admin: (Future) Companion moderation and analytics

πŸ“Š API Routes

Method Endpoint Description Auth Required
GET /api/sentry-example-api Sentry test endpoint ❌

Note: Most data operations use Server Actions (.actions.ts) instead of API routes for type safety and better performance.

Server Actions (companion.actions.ts)

// Companion CRUD
createCompanion(formData
:
CreateCompanion
):
Promise<Companion>
getAllCompanions(options
:
GetAllCompanions
):
Promise<Companion[]>
getCompanion(id
:
string
):
Promise<Companion>

// Session Management
addToSessionHistory(companionId
:
string
):
Promise<string>
updateSessionDuration(companionId
:
string, duration
:
number
):
Promise<void>
saveSessionTranscript(sessionId
:
string, transcript
:
string
):
Promise<void>
getRecentSessions(limit
:
number
):
Promise<Companion[]>
getUserSessions(userId
:
string, limit
:
number
):
Promise<Companion[]>

// Analytics
getHeatmapData(userId
:
string
):
Promise<HeatmapValue[]>
getWeeklyData(userId
:
string
):
Promise<WeeklyData[]>
getMonthlyData(userId
:
string
):
Promise<MonthlyData[]>
getUserStreakData(userId
:
string
):
Promise<StreakData>

// Bookmarks
toggleBookmark(companionId
:
string, isBookmarked
:
boolean, path
:
string
)
getBookmarkedCompanions(userId
:
string
):
Promise<Companion[]>

🌐 Deployment

πŸš€ Deploy to Vercel (Recommended)

  1. Push to GitHub

    git add .
    git commit -m "Initial commit"
    git push origin master
  2. Connect to Vercel

    • Go to Vercel Dashboard
    • Import IntelliCourse-Next.js repository
    • Configure environment variables (copy from .env)
    • Deploy! πŸŽ‰
  3. Post-Deployment

    • Update Clerk redirect URLs with production domain
    • Update VAPI webhook URLs (if applicable)
    • Configure Sentry DSN for production monitoring

πŸ§ͺ Development Scripts

# Development server with Turbopack
npm run dev

# Production build
npm run build

# Start production server
npm run start

🀝 Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository 🍴
  2. Create a feature branch (git checkout -b feature/amazing-feature) 🌟
  3. Commit changes (git commit -m 'feat: Add amazing feature') πŸ’Ύ
  4. Push to branch (git push origin feature/amazing-feature) πŸš€
  5. Open a Pull Request πŸ“

πŸ“ Commit Convention

Follow Conventional Commits:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation update
  • style: Code style change (formatting)
  • refactor: Code refactoring
  • perf: Performance improvement
  • test: Adding tests
  • chore: Maintenance tasks

πŸ› Known Issues & Limitations

  • Voice Session Stability: VAPI connection may drop on slow networks (~<1 Mbps)
  • Safari Audio Issues: Microphone permissions require HTTPS in production
  • Mobile Transcript View: Long transcripts may cause scroll performance issues

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author & Contact

Padmanabha Das

GitHub LinkedIn Email Portfolio

Full-Stack Developer | AI Integration Specialist


πŸ™ Acknowledgments

  • Next.js Team - For the incredible React framework πŸš€
  • Vercel - For seamless hosting and deployment ☁️
  • VAPI - For cutting-edge voice AI technology πŸŽ™οΈ
  • Supabase - For the powerful open-source Firebase alternative πŸ—„οΈ
  • Clerk - For hassle-free authentication πŸ”
  • Tailwind Labs - For utility-first CSS framework 🎨
  • Framer - For smooth animation library 🌊
  • Sentry - For production monitoring and debugging πŸ›
  • Open Source Community - For endless inspiration and support πŸ’™

⭐ Show Your Support

If you found this project helpful or learned something new, please consider:

  • ⭐ Starring this repository
  • πŸ› Reporting bugs via Issues
  • πŸ’¬ Sharing feedback and suggestions
  • 🀝 Contributing to the codebase

πŸŽ“ Made with ❀️ and Next.js by Padmanabha Das

Revolutionizing education through AI-powered voice learning

Visitors Stars Forks