caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

153 lines
10 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ReelForge — Documentation Index
ReelForge is a production UGC (user-generated-content) avatar-video generator,
forked in-place onto [MoneyPrinterTurbo](https://github.com/harry0703/MoneyPrinterTurbo)
(MPT). It turns a creator's **screen recording** plus an optional prompt into a
viral-style vertical (1080×1920) reel: a hook-first AI script (TR/EN and more), an
ElevenLabs voiceover with word-level timing, a lip-synced talking-head avatar,
CapCut-style burned-in karaoke captions, and an optional cross-post to
TikTok / Instagram / YouTube Shorts — wrapped in a full SaaS layer (credits,
multi-provider billing, teams, scheduling, and growth surfaces).
The render runs as a **Celery chain of six stages**
(`app/workers/pipeline.py::build_chain`, each stage in `app/services/reelforge.py`),
parameterised by the immutable `ReelForgeParams` dataclass:
```
script → tts → {avatar ∥ captions} → compose → upload
```
The **ElevenLabs `/with-timestamps`** response is the single source of truth for
timing: the same word timestamps drive both the karaoke captions and the
avatar-duration drift gate, so audio, lips, and captions never diverge. A job is
created and credit-debited **atomically**, then enqueued; failures produce a clean
`failed` status that is retryable from the failed stage with no credit burned.
The stack is FastAPI (`app/asgi.py`, routes under `/api/v1`) + a Celery worker
over Redis, SQLAlchemy 2.0 / Alembic on **Neon Postgres**, and **Cloudflare R2**
object storage.
---
## Quickstart
To take a clean machine to a running stack (API + worker + beat + Redis, applied
schema, first rendered job) in **≤30 minutes**, follow
[**`DEPLOYMENT.md`**](./DEPLOYMENT.md). It also covers deploying the Next.js web
app to Cloudflare Pages and the Expo mobile client. Local (non-Docker) dev setup
lives in [`DEVELOPMENT.md`](./DEVELOPMENT.md).
---
## Documentation map
Every document below exists in `docs/reelforge/`.
| Doc | What it covers |
|---|---|
| [CURRENT_STATE.md](./CURRENT_STATE.md) | **Authoritative measured snapshot:** live API/schema/test/build counts, workspace state, and production defaults. |
| [STATUS.md](./STATUS.md) | Concise verification-gate report and credential-gated operational work. |
| [PLATFORM_ARCHITECTURE_SPEC.md](./PLATFORM_ARCHITECTURE_SPEC.md) | **Cross-app platform contract:** implemented ownership, deployables, data flows, API/client/worker connections, dependency rules, and remaining migration stages. |
| [REPOSITORY_LAYOUT_SPEC.md](./REPOSITORY_LAYOUT_SPEC.md) | **Folder/file ownership plan:** implemented structure and incremental destination for API, web, mobile, Rust desktop, packages, engine, editor, and external boundaries. |
| [ARCHITECTURE.md](./ARCHITECTURE.md) | Runtime topology, the six-stage Celery pipeline, single-source-of-truth timing, queues, and data flow. |
| [API.md](./API.md) | Complete `/api/v1` REST reference — every route, request/response shape, auth, and the MPT response envelope. |
| [FEATURES.md](./FEATURES.md) | Verified feature catalog (pipeline, monetization, Creator Studio, voice, content, growth, teams, batch, scheduling). |
| [DATA_MODEL.md](./DATA_MODEL.md) | SQLAlchemy 2.0 ORM / Alembic schema on Neon Postgres (SQLite in test): tables, columns, ledgers, ownership. |
| [CONFIG.md](./CONFIG.md) | The two config layers (`config.toml` + env) read by `app/config/config.py`, every key, and secret handling. |
| [DEPLOYMENT.md](./DEPLOYMENT.md) | **Quickstart.** Fresh-machine deploy, accounts/keys, Docker Compose stack, web/mobile deploy. |
| [LAUNCH_RUNBOOK.md](./LAUNCH_RUNBOOK.md) | Fail-closed public launch switches, release gate, provider credential handoff, and rollback. |
| [MOBILE_CREATOR_PATH.md](./MOBILE_CREATOR_PATH.md) | Real Expo compose → review → same-job render → device export/share path, failure recovery, state ownership, and physical-device checks. |
| [GENERATION_ENGINE.md](./GENERATION_ENGINE.md) | GPU-worker-only engine ownership across acceleration, pipeline, diffusion, and model layers. |
| [NEXT_APP_PHASES.md](./NEXT_APP_PHASES.md) | Historical/forward plan for API/client phases and target page maps. |
| [PROVIDER_MARKETPLACE_PLAN.md](./PROVIDER_MARKETPLACE_PLAN.md) | Pay-as-you-go wallet, model catalog, provider routing, transparent purchase fee, and app/API rollout plan. |
| [ALL_APPS_IMPLEMENTATION_PLAN.md](./ALL_APPS_IMPLEMENTATION_PLAN.md) | Detailed API, web, Expo mobile, Rust/GPUI desktop, package, route, screen, and release implementation blueprint. |
| [API_DIRECTORY_ARCHITECTURE_PLAN.md](./API_DIRECTORY_ARCHITECTURE_PLAN.md) | API-only file/directory ownership, runtime process boundaries, engine/assets/tools disposition, and migration plan. |
| [DEVELOPMENT.md](./DEVELOPMENT.md) | Contributor guide — local dev, `Makefile.reelforge` targets, tests, lint, project layout. |
| [INTEGRATION_CONTRACT.md](./INTEGRATION_CONTRACT.md) | Authoritative module/signature spec — the single source of truth builders must follow. |
| [PLAN_COVERAGE.md](./PLAN_COVERAGE.md) | Read-only audit mapping every deliverable in the two source plans to actual code. |
| [SECURITY_AUDIT.md](./SECURITY_AUDIT.md) | Adversarial audit of the money path, tenant isolation, R2 storage, and the FFmpeg compositor. |
| [NEXT_PHASES.md](./NEXT_PHASES.md) | Delivered phases, the shipped-feature roadmap, and fresh next ideas. |
| [ROADMAP_V2.md](./ROADMAP_V2.md) | Forward roadmap (Phases 8–11) reconciled against the actual tree; supersedes `NEXT_PHASES.md`. |
| [ARCHITECTURE_NEXT.md](./ARCHITECTURE_NEXT.md) | Target production topology `ROADMAP_V2` builds toward — Redis-backed shared state, priority queues, GPU warm-pool, event/webhook bus, BI pipeline. |
| [RESEARCH_COMPETITORS_OSS.md](./RESEARCH_COMPETITORS_OSS.md) | Competitor feature research + permissively-licensed OSS repos to clone/port to build them faster. |
External source governance, checked commits, licensing inventory, adoption
states, and the provider-adoption checklist live in
[`external/REGISTRY.md`](../../external/REGISTRY.md).
**Source plans** (repo root): [`ugc-video-tool-build-plan.md`](../../ugc-video-tool-build-plan.md)
and [`ugc-tool-cto-plan.md`](../../ugc-tool-cto-plan.md).
---
## Feature summary
Full detail and code citations are in [FEATURES.md](./FEATURES.md); the headline
count by area:
| Area | Count | Highlights |
|---|---:|---|
| Core pipeline | 6 stages | `script → tts → avatar ∥ captions → compose → upload` |
| Monetization | 3 plans, 4 providers | Credit ledger; Free / Starter / Pro; Stripe, iyzico, Creem, Polar |
| Creator Studio | 8 | Caption presets, music library, AI music, re-run, previews, cover generator, brand watermark, completion webhooks |
| Voice | 3 | Curated ElevenLabs catalog, Brand Voice cloning (IVC), Bring-Your-Own-Voiceover |
| Content | 6 | Spark idea engine, templates, dubbing, AI B-roll, social caption/hashtags, custom photo avatar |
| Growth | 4 | Referrals, insights dashboard, saved presets / brand kits, notifications |
| Teams | 3 | Workspaces & roles, shared credit pool, shared brand kits |
| Batch | 2 | A/B variants (N=1..3), batch review |
| Scheduling | 1 | Scheduled auto-publish (Celery-beat due-runner) |
| Analytics | 1 | Creator Analytics — per-user BI (funnel / cost / credits / render) off `job_events` |
| Marketplace | 1 | Template Marketplace — publish/browse/clone/rate, win-score ranking, remix trees |
| Performance loop | 1 | Hook Performance Loop — self-reported outcomes → win scores that feed the Spark idea engine |
| Public API | 1 | Per-user API keys with per-key quotas + rate limits (`429` on exceed) |
| Direct publish | 1 | OAuth account-connect + publish to TikTok / Instagram / YouTube (tokens Fernet-encrypted at rest via `SOCIAL_TOKEN_KEY`) |
| Sharing | 1 | Public watermarked share pages (owner create/revoke + PUBLIC `/public/r`) |
| Social graph | 1 | Creator profiles + follow graph + leaderboards |
All product API operations — **281 operations across 247 OpenAPI paths** — are mounted under
`/api/v1`, authenticated per user via a Clerk `Bearer` JWT or the SHA-256 of an
`x-api-key` header, and return the shared MPT envelope
`utils.get_response(status, data, message)`.
---
## Build health
Numbers below are measured as of **2026-08-22**; see
[CURRENT_STATE.md](./CURRENT_STATE.md) for the full breakdown.
| Signal | Value |
|---|---|
| Test suite | **3,312 collected: 3,308 passed, 4 skipped** — `make -f Makefile.reelforge test` |
| Migrations | **48** files in `migrations/versions/`, single head **`e1f2a3b4c5d6`** |
| DB tables | 70 SQLAlchemy table mappings |
| API | 247 paths, 281 operations, 303 schemas |
GitHub Actions workflows cover image builds, deployment, security, performance,
release, and the broader app matrix. Before landing, also run the local gate:
`ruff --select F,E9` + `python -m pytest tests/reelforge` + `alembic upgrade head` /
`alembic check` + the golden-acceptance check. Test env expects `NEON_DATABASE_URL`
pointed at SQLite, dummy `R2_*` values, and `SOCIAL_TOKEN_KEY` set.
---
## Built on open source
ReelForge is **forked in-place from MoneyPrinterTurbo** and reuses MPT's `/api/v1`
router, config loader, response envelope, and TTS/compose helpers — see
[`README-mpt.md`](../../README-mpt.md) and `LICENSE`. On top of that base it
composes several open-source and third-party building blocks:
- **ElevenLabs Music** — AI background-track generation (`app/services/elevenlabs_music.py`).
- **Pexels** — default source for AI B-roll suggestions (`app/services/broll.py`).
- **faster-whisper** — local transcription for Bring-Your-Own-Voiceover word timings (`app/services/transcribe.py`).
- **Social metadata** — platform-tailored captions/hashtags (`app/services/llm.py::generate_social_metadata`).
Note: MPT's original Pexels/Pixabay **stock-footage sourcing path** is intentionally
**bypassed** by the ReelForge pipeline (the background is always the uploaded screen
recording); the Pexels integration above is scoped to optional B-roll intro/outro
clips only. See the "No stock footage" note in [DEPLOYMENT.md](./DEPLOYMENT.md) and
the enforcing test `tests/reelforge/test_no_stock_sourcing.py`.
Bundled fonts ship under the SIL Open Font License (`resource/fonts/` with
`OFL-Montserrat.txt` / `OFL-Inter.txt`).