Overview
The frontend is a single-page application built with React 18 and Vite, featuring real-time progress tracking through Server-Sent Events (SSE) and a responsive UI powered by TailwindCSS.Tech Stack
React 18
Modern React with Hooks for component logic
Vite
Lightning-fast dev server and build tool
TailwindCSS
Utility-first styling with custom gradients
Axios
Promise-based HTTP client for API calls
Component Hierarchy
Key Components
App.jsx
Purpose: Root component managing application state and routing between views State Management:- Switch between Home (input form) and Preview (video player) views
- Store generated presentation data
- Pass callbacks to child components
frontend/src/App.jsx
Home.jsx
Purpose: Input form for video generation with real-time progress tracking State Variables:Form Inputs
Form Inputs
- Topic: Text input with Enter key support
- Number of Slides: Range 3-10
- Language: Select (English, Hindi, Kannada, Telugu)
- Tone: Select (Formal, Casual, Enthusiastic)
Progress Tracking
Progress Tracking
Uses
useSSEProgress hook to display real-time generation status via StepProgress componentGeneration Flow
Generation Flow
- Sanitize topic for ID generation
- Trigger SSE connection
- Call
/api/generateendpoint - Display progress
- On completion, call
onGenerationComplete(data)
frontend/src/components/Home.jsx:733-1060
StepProgress.jsx
Purpose: Visual progress tracker displaying pipeline stages Props:- Color-coded step indicators (gray → blue → green)
- Animated progress bar with gradient
- Connection status indicator
- Current message display
- Completed/Active/Pending states
frontend/src/components/StepProgress.jsx:1-241
VideoPlayer.jsx
Purpose: Video playback with slide timeline navigation Key Features:- HTML5
<video>element with custom controls - Timeline with slide markers
- Slide navigation buttons
- Current slide highlight
- Video download option
frontend/src/components/VideoPlayer.jsx
SlideEditor.jsx
Purpose: Slide-by-slide preview and editing interface Features:- Slide carousel navigation
- Individual slide preview
- Export to PowerPoint (via
pptExport.js) - Slide metadata display
frontend/src/components/SlideEditor.jsx
State Management
The application uses React Hooks for state management - no Redux or external state libraries needed due to simple data flow.State Flow Pattern
Prop Drilling Pattern
Custom Hooks
useSSEProgress
Purpose: Manage Server-Sent Events connection for real-time progress Location:frontend/src/hooks/useSSEProgress.jsx
Usage:
Key Code:
API Integration
API Client: utils/api.js
Location:frontend/src/utils/api.js
Configuration:
- Server errors: Display error message from response
- Network errors: Show “backend not running” message
- Timeout errors: 60-second timeout with clear feedback
Real-time Progress with SSE
Why SSE over WebSockets?
Advantages
- Built-in browser API (EventSource)
- Automatic reconnection
- Simpler server implementation
- One-way communication sufficient
Trade-offs
- No bidirectional communication
- Text-based only (JSON)
- Limited browser support (IE)
SSE Flow Diagram
Styling Approach
TailwindCSS Utilities
Gradient Backgrounds:frontend/src/styles/theme.css
Performance Optimizations
Component Memoization
Component Memoization
Use React.memo for expensive renders (not currently needed due to simple structure)
Event Throttling
Event Throttling
SSE messages throttled to 0.5s intervals to prevent UI overload
Lazy Loading
Lazy Loading
Video player loads on-demand in preview view
Video Streaming
Video Streaming
Range request support allows video seeking without full download
Development Workflow
Next Steps
Backend Architecture
Learn about FastAPI structure and generators
Pipeline Flow
Understand the complete generation process
Dependencies
Frontend dependencies and versions