GossiperAI is a real-time captioning and translation platform that enables students to receive live captions in their preferred language during educational sessions. The platform integrates Solana blockchain for micro-payments and AssemblyAI for speech-to-text transcription, creating an accessible and collaborative learning environment.
- Frontend: Next.js 14 (App Router), TypeScript, Tailwind CSS
- Authentication: Supabase Auth with wallet integration
- Blockchain: Solana (Phantom/Solflare wallets)
- AI/ML: AssemblyAI for speech-to-text transcription
- Database: Supabase PostgreSQL
- Real-time: WebSocket connections for live updates
- Deployment: Vercel
- Real-time Transcription: Live speech-to-text with sub-second latency
- Multi-language Support: 50+ languages including African languages (Yoruba, Swahili, Hausa)
- Wallet Authentication: No passwords required - just connect Solana wallet
- Collaborative Funding: Students contribute micro-payments (β¦50+) to fund sessions
- Accessibility First: WCAG 2.1 AA compliant with screen reader support
- Session Management: Create, join, and manage educational sessions
The system supports both traditional email/password and wallet-based authentication:
```typescript // Traditional auth flow signUp(email, password, { name, role }) signIn(email, password)
// Wallet auth flow
signUpWithWallet(walletAddress, { name, role })
signInWithWallet(walletAddress)
```
```sql -- Profiles table with auto-creation trigger CREATE TABLE profiles ( id UUID REFERENCES auth.users(id) PRIMARY KEY, email TEXT, full_name TEXT, role TEXT CHECK (role IN ('lecturer','student')), wallet_address TEXT, wallet_connected BOOLEAN DEFAULT false, preferred_language TEXT DEFAULT 'en', created_at TIMESTAMPTZ DEFAULT NOW() ); ```
hooks/use-auth.tsx: Main authentication context and logiclib/supabase-auth.ts: Server-side auth helperscomponents/solana-wallet-provider.tsx: Solana wallet integrationcomponents/auth-guard.tsx: Route protection wrapper
- Creation: Lecturer creates session with title, language, and payment goal
- Joining: Students enter 6-character join code
- Active: Real-time transcription and participant management
- Ended: Session concludes with data preservation
```sql CREATE TABLE sessions ( id UUID PRIMARY KEY, title TEXT NOT NULL, code TEXT UNIQUE NOT NULL, -- 6-character join code created_by UUID REFERENCES profiles(id), status TEXT CHECK (status IN ('scheduled', 'active', 'ended')), original_language TEXT DEFAULT 'en', available_languages TEXT[] DEFAULT ARRAY['en'], mode TEXT CHECK (mode IN ('classroom', 'conference', 'podcast', 'livestream')), payment_goal INTEGER DEFAULT 0, created_at TIMESTAMPTZ DEFAULT NOW() );
CREATE TABLE session_participants ( id UUID PRIMARY KEY, session_id UUID REFERENCES sessions(id), user_id UUID REFERENCES profiles(id), selected_language TEXT DEFAULT 'en', joined_at TIMESTAMPTZ DEFAULT NOW(), is_active BOOLEAN DEFAULT true ); ```
app/api/sessions/create/route.ts: Session creation endpointapp/api/sessions/join/route.ts: Session joining endpointapp/session/[id]/page.tsx: Main session interfacelib/session-service-server.ts: Server-side session logiclib/session-service-client.ts: Client-side session management
``` Audio Recording β AssemblyAI API β Webhook β Database β WebSocket β UI ```
- Audio Capture: Lecturer's microphone records in 5-second chunks
- AssemblyAI Processing: Audio sent to AssemblyAI for transcription
- Webhook Handling: Results received via webhook callback
- Database Storage: Transcriptions stored with session association
- Real-time Updates: WebSocket broadcasts to all participants
- Multi-language Translation: Original text translated to participant languages
```sql CREATE TABLE transcriptions ( id UUID PRIMARY KEY, session_id UUID REFERENCES sessions(id), text TEXT, assembly_ai_job_id TEXT, created_at TIMESTAMPTZ DEFAULT NOW() ); ```
services/transcription/: Standalone transcription serviceapp/api/transcription/transcribe/route.ts: Main transcription endpointapp/api/transcription/callback/route.ts: Webhook handlercomponents/transcription-display.tsx: Real-time caption displayhooks/use-transcription.ts: Transcription data managementhooks/use-websocket.ts: Real-time communication
The system includes a mock mode for development and testing: ```typescript // Enable mock transcription in development ENABLE_MOCK_TRANSCRIPTION=true ```
- Wallet Support: Phantom and Solflare wallets
- Micro-payments: Starting from 0.01 SOL (~β¦50)
- Transaction Handling: Real-time payment processing
- Pool Funding: Collaborative funding model
- Wallet Connection: Student connects Solana wallet
- Amount Selection: Choose from preset amounts or custom
- Transaction Creation: Solana transaction with recipient address
- Confirmation: Wait for blockchain confirmation
- Pool Update: Session funding pool updated in real-time
hooks/use-solana.ts: Solana wallet and payment logiccomponents/payment-modal.tsx: Payment interfacecomponents/wallet-multi-button.tsx: Wallet connection UI
- Component Library: Radix UI primitives with custom styling
- Accessibility: WCAG 2.1 AA compliant components
- Theme Support: Light/dark mode with system preference detection
- Responsive Design: Mobile-first approach with desktop optimization
- Screen Reader Support: ARIA labels and semantic HTML
- High Contrast Mode: Enhanced visibility for visual impairments
- Keyboard Navigation: Full keyboard accessibility
- Font Scaling: Adjustable text sizes
- Reduced Motion: Respects user motion preferences
components/ui/: Reusable UI componentscomponents/accessibility-provider.tsx: Accessibility contextcomponents/accessibility-toolbar.tsx: User controlscomponents/live-announcer.tsx: Screen reader announcements
- Connection Management: Auto-reconnect with exponential backoff
- Message Types: Caption updates, participant changes, session status
- Error Handling: Graceful degradation when WebSocket unavailable
- Mock Support: Simulated real-time updates for development
```typescript interface WebSocketMessage { type: "caption" | "translation" | "session_update" | "participant_update" sessionId: string data: any timestamp: Date } ```
- Authentication: Connect wallet or sign in
- Session Creation: Set title, language, payment goal
- Session Management: Start/stop recording, manage participants
- Real-time Monitoring: View live captions and participant activity
- Authentication: Connect wallet or sign in
- Session Joining: Enter 6-character join code
- Language Selection: Choose preferred caption language
- Live Captions: View real-time transcriptions
- Payment Contribution: Optional funding contribution
```env
NEXT_PUBLIC_SOLANA_NETWORK=devnet NEXT_PUBLIC_APP_URL=http://localhost:3000
ASSEMBLYAI_API_KEY=your_api_key
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
ENABLE_MOCK_TRANSCRIPTION=true ```
- Supabase Project: Create new Supabase project
- Schema Migration: Run provided SQL scripts
- RLS Policies: Configure row-level security
- Triggers: Set up auto-profile creation
- Repository Connection: Connect GitHub repository
- Environment Variables: Configure all required variables
- Build Settings: Next.js framework detection
- Domain Configuration: Custom domain setup
The system includes comprehensive mock functionality:
- Mock Transcription: Simulated AssemblyAI responses
- Mock WebSocket: Simulated real-time updates
- Mock Payments: Simulated Solana transactions
- Mock Sessions: Sample session data
```bash pnpm run dev # Start development server pnpm run build # Build for production pnpm run start # Start production server pnpm run lint # Run ESLint ```
- Server Components: Better performance and SEO
- API Routes: Integrated backend functionality
- Middleware: Authentication and routing logic
- Real-time Subscriptions: Built-in WebSocket support
- Row Level Security: Database-level access control
- Auto-generated APIs: Type-safe database operations
- Wallet Adapter: Standardized wallet interface
- Transaction Handling: Robust error handling and confirmation
- User Experience: Seamless wallet connection flow
- Webhook Architecture: Asynchronous processing
- File Upload: Direct audio file processing
- Error Handling: Comprehensive error management
- Code Splitting: Dynamic imports for large components
- Image Optimization: Next.js Image component
- Caching: Supabase query caching
- Bundle Analysis: Regular bundle size monitoring
- Database Indexing: Optimized queries for large datasets
- CDN Integration: Static asset delivery
- Rate Limiting: API endpoint protection
- Error Boundaries: Graceful error handling
- JWT Tokens: Secure session management
- Wallet Verification: Cryptographic signature validation
- Rate Limiting: Prevent brute force attacks
- Input Validation: Comprehensive data sanitization
- Encryption: Sensitive data encryption at rest
- HTTPS: Secure communication channels
- CORS: Cross-origin request protection
- SQL Injection: Parameterized queries
- Advanced Analytics: Session performance metrics
- Mobile App: React Native implementation
- Offline Support: Progressive Web App features
- AI Translation: Real-time language translation
- Recording Playback: Session recording and replay
- Microservices: Service decomposition
- Caching Layer: Redis integration
- Monitoring: Application performance monitoring
- Testing: Comprehensive test coverage
``` gossiper/ βββ app/ # Next.js App Router β βββ api/ # API routes β β βββ auth/ # Authentication endpoints β β βββ sessions/ # Session management β β βββ transcription/ # Transcription service β βββ create-session/ # Session creation page β βββ session/[id]/ # Live session pages β βββ join-session/ # Session joining β βββ dashboard/ # User dashboard βββ components/ # React components β βββ ui/ # Radix UI components β βββ accessibility-.tsx # Accessibility features β βββ auth-guard.tsx # Route protection β βββ payment-modal.tsx # Payment interface β βββ transcription-.tsx # Transcription display βββ hooks/ # Custom React hooks β βββ use-auth.tsx # Authentication logic β βββ use-solana.ts # Solana integration β βββ use-transcription.ts # Transcription management β βββ use-websocket.ts # Real-time communication βββ lib/ # Utility functions β βββ supabase-.ts # Database clients β βββ session-service-.ts # Session management β βββ types.ts # TypeScript definitions βββ services/ # External service integrations β βββ transcription/ # AssemblyAI integration βββ Database_Schema/ # Database schema files βββ public/ # Static assets ```
- Strict Mode: Enabled for type safety
- Path Mapping: Clean import statements
- Type Definitions: Comprehensive type coverage
- ESLint Integration: Code quality enforcement
- Feature-based Structure: Components grouped by functionality
- Separation of Concerns: Clear separation between UI, logic, and data
- Reusable Components: DRY principle implementation
- Custom Hooks: Logic extraction for reusability
- Primary Languages: English, Yoruba, French, Spanish
- African Languages: Yoruba, Swahili, Hausa
- Translation Pipeline: Real-time language conversion
- Cultural Considerations: Region-specific formatting
- Screen Reader Support: Multiple language support
- RTL Languages: Right-to-left text support
- Cultural Sensitivity: Appropriate terminology and imagery
- Session Metrics: Duration, participant count, engagement
- Transcription Quality: Accuracy scores, language distribution
- Payment Analytics: Contribution patterns, funding success
- Accessibility Usage: Feature adoption rates
- Performance Metrics: Load times, API response times
- Error Tracking: Application errors and exceptions
- Usage Patterns: Feature utilization and user behavior
- System Health: Database performance, external service status
- Error Boundaries: React error boundary implementation
- User Feedback: Toast notifications and error messages
- Graceful Degradation: Fallback functionality when services fail
- Retry Logic: Automatic retry for transient failures
- API Error Responses: Consistent error response format
- Logging: Comprehensive error logging and monitoring
- Rate Limiting: Protection against abuse and overload
- Validation: Input validation and sanitization
- Context API: Global authentication state
- Persistence: Local storage for session persistence
- Synchronization: Real-time state updates across tabs
- Error Recovery: Automatic re-authentication on token expiry
- Real-time Updates: WebSocket-based state synchronization
- Optimistic Updates: Immediate UI updates with server confirmation
- Conflict Resolution: Handling concurrent state changes
- Data Consistency: Ensuring data integrity across components
- Atomic Design: Atoms, molecules, organisms, templates
- Composition: Flexible component composition patterns
- Theming: Consistent design token system
- Variants: Multiple component variants for different use cases
- Color Contrast: WCAG AA compliant color combinations
- Focus Management: Clear focus indicators and navigation
- Screen Reader Support: Semantic HTML and ARIA attributes
- Keyboard Navigation: Full keyboard accessibility
- Feature Branches: Isolated feature development
- Pull Requests: Code review and quality assurance
- Automated Testing: CI/CD pipeline integration
- Deployment: Automated deployment to staging and production
- Pull Request Templates: Standardized PR descriptions
- Code Quality Checks: Automated linting and formatting
- Testing Requirements: Test coverage and quality gates
- Documentation: Code documentation and comments
- JSDoc Comments: Function and component documentation
- Type Definitions: Comprehensive TypeScript interfaces
- README Files: Project and component documentation
- API Documentation: Endpoint and service documentation
- Getting Started: Setup and installation guides
- User Guides: Feature usage and best practices
- Troubleshooting: Common issues and solutions
- FAQ: Frequently asked questions and answers
This comprehensive documentation provides a complete overview of the GossiperAI system architecture, implementation details, and technical decisions. The codebase demonstrates modern web development practices with a focus on accessibility, real-time functionality, and blockchain integration.
- Modern Architecture: Built with Next.js 14, TypeScript, and modern React patterns
- Accessibility First: WCAG 2.1 AA compliant with comprehensive accessibility features
- Real-time Capabilities: WebSocket integration for live transcription and updates
- Blockchain Integration: Solana wallet integration for micro-payments
- AI/ML Integration: AssemblyAI for speech-to-text transcription
- Scalable Design: Modular architecture supporting future enhancements
- Developer Experience: Comprehensive tooling and development workflow
- Production Ready: Robust error handling, security measures, and monitoring
The system successfully addresses the core problem of making educational content accessible to students with hearing impairments or language barriers, while providing a sustainable funding model through collaborative micro-payments.