trykimu/videoeditor
repository·main·Indexed 24 days ago
https://github.com/trykimu/videoeditorAn AI-powered open-source video editor featuring multi-track editing, real-time preview, and a 'Vibe AI Assistant'. The project utilizes a FastAPI backend, a Vite-powered frontend, and Remotion for video rendering, with authentication handled by BetterAuth and AI features powered by Gemini.
What's inside videoeditor
- If your software interacts with users remotely through a computer network (such as a web application), the AGPL requires that you provide a way for users to obtain the source code. A common implementation is to include a "Source" link in the application interface that leads users to an archive of the code.
Apply GNU AGPLv3 notices to new programs
mainTo distribute a new program under the GNU Affero General Public License (AGPL), you should attach specific notices to the start of each source file. This effectively states the exclusion of warranty and provides a pointer to the full license. Each file should include at least a copyright line and a pointer to the full notice. Additionally, you should include contact information via electronic and paper mail.
Open-Source Video Editor Copyright (C) 2025 Kimu Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.Deploy to production using Docker
mainIn production, the entire stack runs in Docker behind an Nginx proxy. Nginx handles routing for the backend, the video renderer, and the frontend. By default, it listens on ports 80 (redirecting to 443) and 443.
Nginx Routing:
/backend/*→ FastAPI/renderer/*→ Renderer (video rendering)/*→ Frontend (React Router SSR)
Deployment Commands:
Standard deployment:
docker compose up -dDeployment with a custom domain:
PROD_DOMAIN=yourdomain.com docker compose up -dSet up the backend development environment
mainTo set up the backend, use
uvto synchronize all dependency groups and install the pre-commit hooks. This ensures the environment is consistent and code quality checks are active.uv sync --all-groups uv run pre-commit installRun the backend server
mainOnce the environment is set up, you can start the backend service usinguv run main.py.uv run main.pySet up local development environment
mainTo run the video editor locally, you need to install dependencies for both the frontend/renderer (via
pnpm) and the backend (viauv). The development setup involves running four distinct processes: a Dockerized Postgres instance, a FastAPI backend, a video renderer, and a Vite-powered frontend. Vite handles proxying requests to the backend and renderer automatically.Requirements:
- Node.js 20+
- Python 3.12+
- pnpm
- Docker (for postgres only)
Proxy Routing (via Vite):
/backend/*→ FastAPI at:3000/renderer/*→ Renderer at:8000/*→ React Router SSR (Vite)
Access the application at
http://localhost:5173.# Install dependencies pnpm i cd backend && uv sync && cd .. # 1. Start postgres docker compose -f docker-compose.dev.yml up -d # 2. Start FastAPI (terminal 1) cd backend && uv run uvicorn main:app --reload --port 3000 # 3. Start renderer (terminal 2) pnpm dlx tsx app/videorender/videorender.ts # 4. Start frontend (terminal 3) pnpm devConfigure environment variables
mainCreate a
.envfile by copying.env.example. The following configuration categories are required or optional:Database
DATABASE_URL: PostgreSQL connection string. Use local Docker URL for dev/self-hosted, or Supabase Session Pooler for cloud.DATABASE_SSL: Set totruefor Supabase or remote DBs requiring SSL. Omit for local/Docker Postgres.
Authentication (BetterAuth)
BETTER_AUTH_SECRET: A random secret for signing sessions. Generate usingopenssl rand -hex 32.BETTER_AUTH_URL: The public URL of the app (e.g.,http://localhost:5173for dev).GOOGLE_CLIENT_ID: Google OAuth client ID.GOOGLE_CLIENT_SECRET: Google OAuth client secret.
AI Features
GEMINI_API_KEY: Required for AI-powered video editing features.
# Local/Docker Postgres (dev or self-hosted prod): DATABASE_URL=postgresql://videoeditor:videoeditor@localhost:5432/videoeditor # — OR — Supabase Session Pooler (cloud): DATABASE_URL=postgresql://postgres.REF:password@aws-0-REGION.pooler.supabase.com:5432/postgres DATABASE_SSL=true # required for Supabase; omit for local/Docker Postgres # BetterAuth BETTER_AUTH_SECRET= # generate with: openssl rand -hex 32 BETTER_AUTH_URL=https://yourdomain.com # http://localhost:5173 for dev # Google OAuth GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret # AI Features (optional) GEMINI_API_KEY=your_gemini_api_keyConfigure backend environment variables
mainThe application usespython-dotenvto load environment variables from a.envfile located two levels up frombackend/main.py. Ensure your.envfile is correctly placed to allow the application to load necessary configurations before the routes are imported.Configure BetterAuth environment variables
mainTo successfully initialize the
authinstance, the following environment variables must be set:Variable Description DATABASE_URLPostgreSQL connection string DATABASE_SSLSet to "true"to enable SSL (withrejectUnauthorized: false)BETTER_AUTH_URLThe base URL for the authentication service BETTER_AUTH_SECRETThe secret key for BetterAuth GOOGLE_CLIENT_IDGoogle OAuth Client ID GOOGLE_CLIENT_SECRETGoogle OAuth Client Secret Configure Single Page Application (SPA) mode in react-router.config.ts
mainBy default, the project uses Server-Side Rendering (SSR). To switch the application to Single Page Application (SPA) mode, set the
ssroption tofalsein thereact-router.config.tsfile.import type { Config } from "@react-router/dev/config"; export default { // Config options... // Server-side render by default, to enable SPA mode set this to `false` ssr: false, } satisfies Config;Configure Nginx for SSL and reverse proxying
mainThe
nginxservice acts as the entry point, handling traffic on ports 80 and 443. It requires a localnginx.confand a mounted directory for SSL certificates (e.g., from Let's Encrypt). It depends on the health of theredis,frontend,backend, andfastapiservices.nginx: image: nginx:alpine container_name: videoeditor-nginx ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf - /etc/letsencrypt:/etc/letsencrypt:roConfigure the backend service resource limits
mainThe
backendservice performs video stitching using Remotion and FFmpeg. To preventSIGKILLerrors during 1080p or 4K video processing, ensure the container has sufficient memory headroom. The current configuration sets a memory limit of 4GB and a shared memory size of 2GB.backend: # ... mem_limit: 4g memswap_limit: 4g shm_size: 2g