Avatar

Roushan

Software Engineer

Let's Chat

Success 369: AI Learning Platform with Real-Time Chatbot (SOUL)

Interactive AI learning platform with real-time chatbot (SOUL) that provides personalized educational experiences through natural text and voice conversations.

Next.jsPythonAI/MLWebSocket
Success 369: AI Learning Platform with Real-Time Chatbot (SOUL)

Interactive AI Learning Platform with Real-Time Chatbot

Project Overview

I developed a comprehensive interactive learning platform that brings together cutting-edge AI technology with real-time communication to create an engaging, personalized educational experience. At the heart of this platform is SOUL, an AI mentor that guides users through their learning journey with natural conversations in both text and voice.

The Challenge

Traditional online learning platforms often feel disconnected and impersonal. Users struggle with static content, lack of real-time feedback, and no sense of continuity in their learning journey. We wanted to create something different—a platform where users could have natural, flowing conversations with an AI mentor that remembers their progress, celebrates their achievements, and adapts to their learning style.

The Solution

We built a full-stack learning platform that combines three powerful technologies working together seamlessly:

Real-Time Interactive Chatbot

The platform features a sophisticated chatbot that users can interact with through both text and voice. What makes this special is how it works in real-time—there's no waiting, no delays. When you speak or type, the AI responds instantly, creating a natural conversation flow that feels like talking to a real mentor.

The technical magic behind this involves WebSocket technology, which creates a persistent connection between your device and our servers. Think of it like a phone call that stays open—instead of hanging up after each message, the connection remains active, allowing for instant back-and-forth communication. This enables features like:

  • Voice Activity Detection: The system knows when you're speaking and when you've finished, so it can respond at the perfect moment
  • Streaming Responses: You see and hear the AI's responses as they're being generated, not after it's completely finished
  • Session Persistence: If your connection drops momentarily, the conversation picks up exactly where you left off—the AI remembers everything you discussed

Advanced WebSocket Architecture

Building a reliable real-time system required solving complex challenges. We implemented multiple layers of connection management:

Connection Monitoring: The system continuously checks if the connection is healthy, sending small "heartbeat" messages every 30 seconds. If something goes wrong, it automatically detects the issue and reconnects without you even noticing.

Session Resumption: One of the most impressive features is how the system handles interruptions. If your internet connection drops or you close your browser, when you come back, the AI remembers your entire conversation. It's like resuming a book at the exact page you left off—nothing is lost.

Keepalive Mechanism: To prevent the AI session from timing out during quiet moments, the system sends subtle signals every two minutes. This ensures that even if you pause to think, the conversation stays active and ready when you return.

Multi-Modal Communication: The platform handles both audio and text simultaneously. You can speak your questions and receive audio responses, or type and get text replies. The system intelligently manages both formats, switching between them seamlessly based on your preferences.

Gamification and Achievement System

To make learning engaging and motivating, we built a comprehensive badges and awards system. Users earn achievements for various milestones:

  • Streak Master: Rewards consistent learning over multiple weeks
  • High Achiever: Celebrates exceptional performance on tasks
  • Profile Pro: Encourages users to complete their profile
  • Objective Achiever: Recognizes completion of learning objectives
  • Chapter Completion: Tracks progress through different learning modules
  • Journey Completion: The ultimate achievement for completing the entire program

Each badge comes with points, visual rewards, and a sense of accomplishment. The system automatically tracks your progress and awards badges when you meet the criteria, creating a game-like experience that keeps users motivated and engaged.

Memory and Personalization

What truly sets this platform apart is how the AI remembers your journey. Unlike typical chatbots that forget everything after each conversation, SOUL maintains a comprehensive memory of:

  • Your past conversations and insights
  • Your personal goals and definitions of success
  • Your struggles and breakthroughs
  • Your performance across different tasks
  • Your values and what matters to you

This memory system allows SOUL to reference past conversations naturally. When you're working on a new task, the AI might say, "Remember when you defined success as achieving work-life balance? Let's build on that." This creates a sense of continuity and personalization that makes the learning experience feel truly tailored to you.

The technical implementation involves storing conversation data in a vector database, which allows the AI to search through your entire learning history to find relevant context. When you start a new conversation, the system retrieves your past interactions and weaves them into the current discussion, creating a seamless learning journey.

Payment Integration with Razorpay

To support a sustainable business model, we integrated Razorpay, a leading payment gateway, to handle subscriptions and one-time payments. The implementation goes beyond simple payment processing to create a seamless, secure experience.

Smart Currency Detection: The system automatically detects the user's location and suggests the appropriate currency (USD, INR, etc.), making payments feel natural regardless of where users are located. This detection is cached intelligently to avoid unnecessary API calls while ensuring accuracy.

Payment Link Generation: When users select a subscription plan, the system generates a secure payment link that's pre-filled with their information. This link can be shared, saved for later, or used immediately. The system supports partial payments, allowing flexibility for users who need it.

Webhook Security: All payment confirmations are verified using cryptographic signatures. This ensures that only legitimate payments from Razorpay are processed, protecting both the platform and users from fraud.

Subscription Management: The system tracks subscription status, payment history, and automatically updates user access levels when payments are confirmed. Users can see their subscription details, payment history, and manage their plans all in one place.

Payment Recovery: For payments that are initiated but not completed, the system maintains records and allows users to claim or complete payments later. This reduces lost revenue from abandoned payment flows.

Multi-Currency Support: The platform handles multiple currencies seamlessly, converting amounts appropriately and ensuring users see prices in their local currency. This makes the platform accessible to a global audience.

Diverse Task Types and Intelligent Evaluation

The platform supports four distinct types of learning tasks, each designed for different learning objectives and evaluated using appropriate methods:

1. Read & Learn Tasks (Read-Only) These are informational tasks where users engage with content—reading materials, watching videos, or exploring resources. Completion is straightforward: once users have viewed the content, the task is marked complete. This type is perfect for introducing new concepts or providing foundational knowledge before more interactive tasks.

2. Action Form Tasks These tasks require users to fill out structured forms with specific questions. The AI evaluates the responses based on predefined criteria, looking for depth, completeness, and alignment with learning objectives. Users receive detailed feedback on their submissions, and the task is only marked complete when the AI determines the responses meet the quality threshold.

The evaluation considers:

  • Completeness of responses
  • Depth of understanding demonstrated
  • Alignment with task objectives
  • Quality of reflection and thought

3. AI Conversation Evaluation Tasks These are open-ended learning experiences where users engage in extended conversations with SOUL. The AI continuously assesses the user's engagement, comprehension, and application of knowledge throughout the conversation. Completion isn't based on specific answers but on the AI's holistic assessment that the user has sufficiently engaged with and understood the concepts.

The AI evaluates:

  • Quality of questions asked
  • Depth of understanding shown through responses
  • Application of concepts in discussion
  • Overall engagement and participation

4. Reflection & AI Assessment Tasks These tasks prompt users for specific reflections on their learning. The AI then evaluates these reflections for depth, understanding, and adherence to the prompt. This type is ideal for helping users synthesize their learning and demonstrate comprehension through personal reflection.

The evaluation focuses on:

  • Depth of reflection
  • Personal insights and connections made
  • Understanding demonstrated through examples
  • Alignment with the reflection prompt

Intelligent Scoring System

All evaluated tasks use a scoring system (0-100%) with configurable thresholds. Tasks can have different passing thresholds—some might require 80% while others are more lenient at 50%. The AI provides detailed feedback explaining the score, highlighting strengths, and suggesting areas for improvement.

When users don't meet the threshold, they receive constructive feedback and can retry the task. The system tracks all attempts, allowing users and administrators to see progress over time. High-scoring completions are flagged and can unlock special badges, creating additional motivation for excellence.

Technical Architecture

The platform is built using a modern, scalable architecture:

Frontend (React/TypeScript): A responsive web application that provides the user interface. It handles real-time WebSocket connections, manages audio playback, and creates an intuitive user experience.

Backend (Laravel/PHP): A robust server that manages user accounts, tracks progress, handles authentication, and coordinates between different services. It stores all user data, conversation history, and achievement records.

AI Service (Python): A specialized service that handles the AI interactions. It connects to Google's Gemini AI, manages the conversation flow, processes audio streams, and implements the memory retrieval system.

Vector Database (Pinecone): Stores user memories and conversation history in a format that allows for intelligent searching and retrieval, enabling the AI to find relevant past interactions quickly.

Key Features and Innovations

Seamless User Experience

The platform feels incredibly smooth because of how all these technologies work together. When you interact with SOUL, you're not aware of the complex systems running behind the scenes—you just experience natural, flowing conversations. Whether you're browsing subscription plans, completing a task, or chatting with the AI, everything flows naturally.

Complete Learning Journey Management

The platform manages the entire learning lifecycle:

  • Onboarding: New users are guided through profile setup, which helps personalize their experience
  • Content Discovery: Users can browse chapters and tasks, seeing their progress and what's next
  • Task Execution: Different task types provide varied learning experiences, from passive reading to active reflection
  • Progress Tracking: Every interaction is tracked, allowing users to see their journey and administrators to understand engagement
  • Achievement Recognition: Badges and points celebrate milestones and motivate continued learning

Payment and Subscription Management

The payment system is designed for trust and convenience:

  • Secure payment processing with industry-standard encryption
  • Automatic subscription management and renewal tracking
  • Clear pricing display in user's local currency
  • Payment history and receipt management
  • Graceful handling of payment failures and retries

Intelligent Task Evaluation

The AI evaluation system adapts to different task types:

  • Form Tasks: Structured evaluation against specific criteria with detailed feedback
  • Conversation Tasks: Holistic assessment of understanding through natural dialogue
  • Reflection Tasks: Deep analysis of personal insights and learning synthesis
  • Adaptive Thresholds: Different tasks have different passing requirements based on difficulty
  • Retry Support: Users can improve and retry tasks, with all attempts tracked for learning analytics

Reliability and Resilience

We built the system to handle real-world conditions. Network interruptions, browser crashes, or temporary disconnections don't disrupt your learning. The system automatically recovers, reconnects, and continues your conversation without losing context. Payment processing includes retry mechanisms and webhook verification to ensure no payments are lost.

Scalability

The architecture is designed to handle thousands of concurrent users. The WebSocket implementation efficiently manages multiple connections, the payment system handles high transaction volumes, and the backend services can scale horizontally as the user base grows.

Personalization at Scale

Each user gets a personalized experience, but the system handles this efficiently. The memory retrieval system is optimized to find relevant information quickly, even as users accumulate months of conversation history. Task recommendations and difficulty adjustments are personalized based on past performance.

Impact and Results

This platform demonstrates advanced understanding of:

  • Real-Time Communication: Implementing WebSocket connections that handle complex scenarios like reconnection, session management, and multi-modal data streams
  • AI Integration: Seamlessly connecting with AI services while maintaining conversation context, implementing memory systems, and creating intelligent evaluation mechanisms
  • Payment Processing: Building secure, scalable payment systems with multi-currency support, webhook verification, and subscription management
  • Task Management: Creating flexible systems that support multiple task types with appropriate evaluation methods for each
  • User Experience Design: Creating an interface that feels natural and intuitive despite the complex technology underneath
  • System Architecture: Building a distributed system where multiple services (frontend, backend, AI service, payment gateway) communicate reliably and efficiently
  • Gamification: Implementing achievement systems that motivate users and track progress meaningfully
  • Data Management: Efficiently storing and retrieving user data, conversation history, payment records, and learning analytics

Technical Highlights

While the user experience is smooth and simple, the technical implementation required solving challenging problems:

Real-Time Communication:

  • Managing persistent WebSocket connections with automatic reconnection
  • Implementing session resumption that maintains full conversation context
  • Handling both audio and text communication simultaneously
  • Building connection monitoring and health checks that detect issues before users notice

AI and Memory Systems:

  • Building a memory system that efficiently retrieves relevant past interactions from vector databases
  • Implementing context-aware AI responses that reference user history naturally
  • Creating evaluation algorithms that assess different types of tasks appropriately
  • Optimizing token usage to keep AI responses fast and cost-effective

Payment Processing:

  • Integrating Razorpay payment gateway with secure webhook verification
  • Implementing currency detection and multi-currency support
  • Building payment link generation with pre-filled user information
  • Creating subscription management that handles renewals, cancellations, and upgrades
  • Implementing payment recovery systems for abandoned transactions

Task Management:

  • Creating flexible task type system that supports multiple evaluation methods
  • Building AI evaluation tools that assess form submissions, conversations, and reflections
  • Implementing scoring systems with configurable thresholds
  • Tracking task attempts and progress across the entire learning journey
  • Building retry mechanisms that allow users to improve and try again

Gamification:

  • Creating a reliable achievement tracking system that works across multiple user sessions
  • Implementing badge assignment logic that checks various criteria (streaks, scores, completions)
  • Building progress tracking that updates in real-time as users complete tasks

Performance and Scalability:

  • Optimizing performance to ensure real-time responsiveness
  • Building caching systems for currency detection and frequently accessed data
  • Creating efficient database queries that handle large amounts of user data
  • Implementing background job processing for heavy operations like AI evaluation

Conclusion

This project represents a complete, production-ready learning platform that combines cutting-edge AI technology with robust real-time communication systems, secure payment processing, and intelligent task evaluation. It demonstrates the ability to build complex, multi-service applications that feel simple and intuitive to users while solving sophisticated technical challenges behind the scenes.

The platform encompasses the entire user journey—from discovering and subscribing to the service, through engaging with diverse learning tasks, to tracking progress and earning achievements. Every aspect, from payment processing to AI conversations, is designed to work seamlessly together.

The platform showcases expertise in:

  • Full-Stack Development: Building cohesive systems across frontend, backend, and AI services
  • Real-Time Systems: Implementing WebSocket architectures that handle complex connection scenarios
  • AI Integration: Creating intelligent systems that evaluate, remember, and personalize experiences
  • Payment Processing: Integrating secure payment gateways with proper security and error handling
  • Task Management: Building flexible systems that support multiple learning modalities
  • User Experience Design: Creating interfaces that hide complexity and feel natural
  • System Integration: Coordinating multiple services and third-party APIs reliably

It's a testament to how modern web technologies can create truly engaging, personalized, and commercially viable digital experiences that serve both users and business objectives.

© 2025 Roushan. All rights reserved.