How paul-19658/ai_video works
Purpose and Runtime Entry Points
DreamWeaver is a local-first AI video-creation platform: a user topic progresses through outline, story, keyframe, and video generation, with editable project state and version history. The frontend is a React 18/TypeScript Vite SPA, entered through dreamweaver-frontend/src/main.tsx and composed by dreamweaver-frontend/src/App.tsx. The backend is a FastAPI service launched as app.main:app from dreamweaver-backend/app/main.py.
Frontend Application Shell and State
The SPA presents a staged generation workflow and account/project UI. Generation-wide state is centralized in dreamweaver-frontend/src/contexts/GenerationContext.tsx; authentication/session state is handled by dreamweaver-frontend/src/contexts/AuthContext.tsx. The step UI maps directly to pipeline phases:
• Topic input: dreamweaver-frontend/src/components/steps/InputStep.tsx
• Outline and story editing: dreamweaver-frontend/src/components/steps/OutlineStep.tsx, dreamweaver-frontend/src/components/steps/StoryStep.tsx
• Keyframe and final-video presentation: dreamweaver-frontend/src/components/steps/KeyframesStep.tsx, dreamweaver-frontend/src/components/steps/VideoStep.tsx
API Boundary and Authentication
The frontend API client in dreamweaver-frontend/src/services/api.ts communicates through the Vite /dreamweaver-api/* proxy to FastAPI on port 8000. Backend route groups separate identity, persisted project operations, and AI work: dreamweaver-backend/app/routers/auth.py, dreamweaver-backend/app/routers/projects.py, and dreamweaver-backend/app/routers/generation.py. Protected operations use Bearer tokens; auth covers registration, login, current-user retrieval, avatar, and password-related flows.
Generation Orchestration
Generation endpoints implement the ordered control flow: topic → AI outline → story → keyframes → video. dreamweaver-backend/app/routers/generation.py exposes each stage to the client and delegates model interactions to dreamweaver-backend/app/services/llm_service.py. DeepSeek supplies text-generation models for outline, story, and keyframe descriptions; MiniMax supplies image and video generation. API keys, selected models, secret material, and service settings are configured in dreamweaver-backend/app/config.py.
Persistence, Projects, and Versions
SQLite via SQLAlchemy is the system of record for users, projects, generated artifacts, and versioned edited content. Database setup and startup-oriented schema evolution live in dreamweaver-backend/app/database/db.py; relational entities live in dreamweaver-backend/app/database/models.py; request/response contracts live in dreamweaver-backend/app/models/schemas.py. Project APIs allow listing and loading saved work, while frontend project/version UX is concentrated in dreamweaver-frontend/src/pages/ProjectsPage.tsx and dreamweaver-frontend/src/components/modals/VersionHistoryModal.tsx.
Media and External-Service Boundary
Generated images/videos and user avatars are managed by dreamweaver-backend/app/services/file_service.py and exposed as static media from the backend’s media/ area. The backend is containerizable through dreamweaver-backend/Dockerfile, while its primary development deployment is Uvicorn with SQLite. External dependencies are DeepSeek (text) and MiniMax (image/video); their asynchronous or remote-generation behavior is isolated behind backend generation endpoints rather than accessed directly by the browser.
Main entry points: main.py FastAPI application · App.tsx Application shell · generation.py Generation routes · api.ts API client
Components 19
React SPA
- SPA entry
dreamweaver-frontend/src/main.tsx - Application shell
dreamweaver-frontend/src/App.tsx - Generation state · Coordinates the staged creation workflow.
dreamweaver-frontend/src/contexts/GenerationContext.tsx - Auth session
dreamweaver-frontend/src/contexts/AuthContext.tsx - Generation steps · Topic, outline, story, keyframes, and video views.
dreamweaver-frontend/src/components/steps/InputStep.tsx - Projects and versions · Saved-project and version-history experience.
dreamweaver-frontend/src/pages/ProjectsPage.tsx - API client · Uses the Vite /dreamweaver-api proxy.
dreamweaver-frontend/src/services/api.ts
FastAPI backend
- FastAPI application
dreamweaver-backend/app/main.py - Identity routes · Bearer-token authentication and account flows.
dreamweaver-backend/app/routers/auth.py - Project routes · Loads and persists project work.
dreamweaver-backend/app/routers/projects.py - Generation routes · Exposes ordered topic-to-video stages.
dreamweaver-backend/app/routers/generation.py - AI orchestration · Dispatches text, image, and video model work.
dreamweaver-backend/app/services/llm_service.py - Media service · Manages generated media and avatars.
dreamweaver-backend/app/services/file_service.py - SQLAlchemy database · SQLite system of record with startup schema evolution.
dreamweaver-backend/app/database/db.py - Relational entities · Users, projects, artifacts, and versions.
dreamweaver-backend/app/database/models.py - API contracts
dreamweaver-backend/app/models/schemas.py - Static media · Generated files and avatars are served by the application.
External services
- DeepSeek · Generates outlines, stories, and keyframe descriptions.
- MiniMax · Generates images and videos.
Connections 22
- SPA entry → Application shell: mounts
- Application shell → Generation state: provides
- Application shell → Auth session: provides
- Generation state → Generation steps: drives
- Application shell → Projects and versions: renders
- Generation steps → API client: requests stages
- Projects and versions → API client: loads and saves
- Auth session → API client: supplies Bearer token
- API client → FastAPI application: proxied HTTP
- FastAPI application → Identity routes: routes
- FastAPI application → Project routes: routes
- FastAPI application → Generation routes: routes
- Identity routes → SQLAlchemy database: accounts
- Project routes → SQLAlchemy database: projects and versions
- Generation routes → AI orchestration: delegates AI work
- Generation routes → SQLAlchemy database: persists artifacts
- Generation routes → Media service: stores outputs
- AI orchestration → DeepSeek: text generation
- AI orchestration → MiniMax: image and video generation
- Media service → Static media: writes and serves
- SQLAlchemy database → Relational entities: maps
- FastAPI application → API contracts: validates payloads