How gabrielrra/upload-ai works
Project Type and Purpose
• The project is a full-stack web application where users can upload videos for transcription and use AI to generate assistive content (titles, descriptions, keywords, and promotional texts).
• The backend (API) is built with Fastify (Node.js framework) and uses Prisma for database migrations and interactions.
• The frontend (WebApp) is built with Vite and leverages React (with .tsx files) along with integrated FFmpeg components for handling video-to-audio conversions.
Main Components
a. Frontend (Web):
– Represents the UI, located in the “web” directory.
– Contains components for video input, prompt selection, transcription dialogs, and FFmpeg integration (WebAssembly and worker scripts).
– Uses libraries (via axios, Vite) to communicate with the backend API.
b. Backend (API):
– Found in the “api” directory.
– Houses the server code with route definitions for endpoints (upload-video, create-transcription, generate-ai-completion, get-prompts).
– Uses Fastify to serve API requests.
– Manages database operations through Prisma (with migration scripts and seed data).
– Contains Dockerfile(s) and scripts to support containerized deployment.
c. Database:
– Managed through Prisma (the “prisma” directory) with migrations and seed scripts.
– The .env file specifies the DATABASE_URL, which is key to database access.
d. Docker and Deployment:
– Docker configuration files (Dockerfile, docker-compose files) are provided for both development and production environments, indicating containerization.
e. External and Utilities:
– FFmpeg files in the frontend are crucial for video processing.
– Utility libraries and helper functions present in both parts of the project (e.g., axios and ffmpeg logic in web/src/lib, and prisma.ts in api/src/lib).
Relationships and Interactions
• The frontend initiating API requests (uploading videos, requesting transcriptions, and AI completions).
• The API processing those requests and interacting with the database via Prisma.
• The API returning responses to the frontend.
• The use of external FFmpeg libraries within the frontend for converting video files.
• That Docker and docker-compose facilitate deployment by containerizing both the API and web components.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly mark out the distinct responsibilities of the frontend (UI/experience) and backend (business logic, data handling).
• API-Driven Communication: Show that the frontend communicates with the backend through well-defined API endpoints.
• Use of Domain-Driven Design: Although not explicitly mentioned, the separation of functionalities (video upload/transcription vs. AI text generation) suggests distinct roles within the API endpoints.
Relevant Technologies and Frameworks
• Frontend: Vite, React (with TypeScript .tsx files), FFmpeg core, FFmpeg worker, axios.
• Backend: Node.js, Fastify, Prisma ORM, migration tools (Prisma migrations).
• Database: Likely a SQLite (or similar) database as suggested by the DATABASE_URL in .env, along with migration files.
• Docker-related tools: Dockerfile, docker-compose.