How democratiseresearch/saral works
Project type and purpose
• SARAL AI is a full-stack web application that automates converting research papers into educational videos.
• Frontend: React + Tailwind CSS (single-page app)
• Backend: Python FastAPI (monolithic service with modular “services” layers)
File structure
• Top-level directories:
– backend/ (FastAPI app, services, routes, utils, temp file store)
– frontend/ (React app, components, pages, contexts, hooks)
• backend/app/
– routes/ define API endpoints (/papers, /scripts, /slides, /media, /images)
– services/ implement discrete processing steps (arxiv_scraper, latex_processor, script_generator, beamer_generator, tts_service, video_service, storage_manager)
– utils/ helper functions (e.g., LaTeX→images)
– dependencies/ manage auth and session injection
• frontend/src/
– components/ (forms, workflow, navigation, common UI)
– contexts/ manage global state (API config, auth, workflow progress)
– services/api.js wraps REST calls to backend
– pages/ represent each step of the pipeline
README for additional insights
• Workflow stages are explicitly described:
1. API key config
2. Paper upload (LaTeX ZIP or arXiv link)
3. Script generation (AI via Google Gemini)
4. Slide generation (beamer + extracted figures)
5. Video production (TTS + FFmpeg)
• External dependencies: poppler-utils, pdflatex, FFmpeg, Google Gemini, Sarvam TTS
a. Main components
– User Browser (React SPA)
– Frontend App (UI, state management, service calls)
– Backend API Gateway (FastAPI)
– Processing Modules (services folder):
• ArXiv Scraper
• LaTeX Processor
• Script Generator
• Slide (Beamer) Generator
• TTS Service
• Video Synthesizer
• Storage Manager
– Temporary File Store (backend/temp/)
– External Services: ArXiv, Google Gemini API, Sarvam TTS API
b. Relationships & data flow
1. User uploads paper or inputs arXiv URL in Frontend
2. Frontend calls backend /papers endpoint
3. Backend invokes ArXiv Scraper or LaTeX Processor → stores raw assets in temp
4. Frontend requests script via /scripts → backend calls Script Generator (Google Gemini)
5. Frontend requests slides via /slides → backend calls Beamer Generator + utils → PDF + PNG slides
6. Frontend requests media via /media → backend calls TTS Service + Video Synthesizer (FFmpeg)
7. Storage Manager collects final media and returns download URLs to Frontend
c. Architectural patterns & principles
– Layered architecture (API → services → utils → storage)
– Dependency injection for auth & session (FastAPI dependencies)
– Single Responsibility per service module
d. Key technologies & libraries
– Frontend: React, Tailwind CSS, React Context, REST
– Backend: FastAPI, Pydantic models, Python services
– Processing: pdflatex, poppler-utils, FFmpeg
– AI: Google Gemini API, Sarvam TTS
Detail
• Temp directory as a staging area between modules
• How the Storage Manager interfaces with the file system and returns URLs
• Auth flow (AuthContext ↔ /auth endpoints) if needed