videogen/docs/reelforge/NEXT_APP_PHASES.md
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

15 KiB

ReelForge next application phases

Purpose: executable architecture and product plan for apps/api, apps/web, apps/mobile, and Rust/GPUI apps/desktop.

Non-negotiable: ReelForge has one product backend. Web, Expo mobile, and GPUI desktop are clients of the same /api/v1 contract; they do not own independent job, credit, provider, or media rules.

1. Target product topology

 Next.js web ───────────────┐
 Expo mobile ───────────────┼── HTTPS /api/v1 ── FastAPI domain routers
 Rust / GPUI desktop ───────┘                         │
        │ direct signed uploads                         ├── Neon/Postgres
        └────────────────────────────── R2 ◄───────────┼── Redis/Celery
                                                         │      │
                                             normal/render/generation workers
                                                         │
                             Claude · ElevenLabs · HeyGen · Comfy/Pixelle · social APIs

The API is authoritative for identity, workspaces, credits, idempotency, provider selection, asset ownership, job state, and signed preview URLs. R2 receives direct client uploads only after an API-issued presign; it never authorizes users itself.

Cross-client operating rules

Concern Single owner Client behavior
Authentication API auth/core + Clerk mapping Web uses Clerk session; mobile/desktop use a user API key in secure storage.
API contract FastAPI OpenAPI → packages/api-contract Generated DTOs are used by web/mobile; desktop maintains reviewed Rust mappings.
Create replay safety API idempotency Every reel, B-roll, editor export, and upload registration retains an idempotency key across an ambiguous retry.
Media API media domain + R2 Request presign → direct upload → register asset → submit its returned key.
Progress API/worker job row Poll canonical job/B-roll resource; stop on completed/failed; signed URLs are ephemeral.
B-roll attachment Reel request owned by API Select a completed broll_key; client carries it into the reel draft, API validates ownership.
Providers and GPU engine API worker only Clients select only server-advertised capabilities and approved workflow IDs.

2. API phases and contract plan

Phase A — Finish domain internals without breaking routes

The root router is already domain-composed. Next, migrate each compatibility adapter internally while retaining its existing path and envelope:

domains/<name>/
├── router.py       HTTP parsing and response mapping
├── schemas.py      Pydantic request/response DTOs
├── repository.py   queries, row locks, persistence
├── service.py      transactions and business behavior
├── policy.py       pure access/cost/retry decisions
└── providers/      upstream-specific protocol adapters, when needed

Order: billing → publishing → identity/workspaces → creator/content → developer/insights/compliance. Do not move URLs, DB tables, or client payload fields as part of the extraction. The old controller becomes a thin module alias only after the domain router/service own the implementation.

Phase B — Make API resources uniformly client-ready

Every asynchronous resource must expose the additive common shape:

{
  "id": "…",
  "state": "queued | running | completed | failed",
  "progress": 0,
  "error": "",
  "result_url": "signed URL when complete",
  "correlation_id": "…",
  "retry_eligible": false
}

Canonical endpoints:

Capability Create/list/status/action
Reels POST /jobs, GET /jobs, GET /jobs/{id}, retry/rerun actions
B-roll POST /generation/broll/generate, GET /generation/broll/generations, GET /generation/broll/generations/{id}
Uploads POST /uploads/presign, direct R2 PUT, POST /uploads/register
Editor exports POST /jobs/{id}/exports, canonical job polling
Capability/launch GET /pilot/capabilities, GET /launch/status
Billing plans/providers/read-only status, checkout only behind launch gate
Publishing OAuth and publish/schedule only behind launch gate

Legacy /api/v1/broll/* stays an alias of the canonical B-roll handlers until an approved deprecation release. No client may add a new dependency on it.

Phase C — Provider and engine lifecycle

apps/api/engine is a private GPU-worker capability, not a second API. Its acceleration, pipelines, k_diffusion, and models layers feed the managed-video runtime profile. assets supplies reviewed workflow manifests, fonts, hooks, voice catalog, and bundled music. runtime/storage is temporary worker storage and must be ready before jobs are accepted. tools/ops owns preflight and smoke checks.

Only reviewed provider adapters may become product paths:

  1. Add an immutable workflow manifest and license/security approval.
  2. Add a provider adapter with typed input/result, timeouts, correlation, and refund behavior.
  3. Add it to the server capability document behind a launch flag.
  4. Add UI selection only after the API capability advertises it.

Candidate workflows, Gradio demos, upstream engine utilities, and external/ remain operator/evaluation material, never client routes.

3. Client phases

Phase 1 — Shared workflow parity

Deliver the same core journey in all three clients:

configure/authenticate
→ request upload presign → upload → register asset
→ create reel or B-roll with idempotency key
→ poll with lifecycle-safe cancellation/resume
→ signed preview
→ attach completed B-roll to reel draft
→ create reel / view result / retry eligible failure

Acceptance requires the same API paths, terminal-state meanings, credit-error messages, correlation ID display, and ownership behavior. UX may differ.

Phase 2 — Platform-specialized product depth

  • Web: complete SaaS/control-plane functionality, large editor, teams, billing, analytics, publishing, admin, and public pages.
  • Mobile: fast capture/upload, create, B-roll, queue/review, push/deep-link return. Defer dense admin, full editor timeline, and enterprise configuration to web.
  • Desktop: native long-form creation workspace, file/screen capture, durable library, preview, B-roll-to-reel handoff, and secure settings. Do not add Electron; electron-legacy is read-only migration reference.

Phase 3 — Public-launch sequencing

  1. Internal pilot: allowlisted generation; no public signup, checkout, or direct publishing.
  2. Open signup only after pilot reliability and abuse controls pass.
  3. Enable one payment rail after its sandbox/live webhook smoke passes.
  4. Enable one social provider after its sandbox OAuth/publish smoke passes.
  5. Keep per-provider and B-roll kill switches independent of reel generation.

4. Target folders and connection points

apps/web — Next.js browser product

apps/web/
├── app/                         route composition, layouts, metadata only
│   ├── (marketing)/             landing, pricing, ToS, privacy
│   ├── (product)/               authenticated product shell
│   ├── admin/                   staff-only shell
│   ├── r/[token]/               public share route
│   └── sign-in/, sign-up/
├── src/
│   ├── features/
│   │   ├── reel-create/         wizard, upload and B-roll attachment
│   │   ├── broll-studio/        create/history/poll/preview
│   │   ├── jobs-library/        jobs, details, retry/rerun
│   │   ├── editor/              non-destructive editor and export polling
│   │   ├── publishing/          connections, schedule, calendar
│   │   ├── billing/             plans, checkout handoff, invoices/usage
│   │   ├── workspace/           team, RBAC, audit, SSO
│   │   ├── creator/             brand, voice, avatars, ideas, notifications
│   │   ├── discovery/           marketplace, profiles, leaderboard
│   │   └── admin/               staff operations views
│   └── shared/
│       ├── api/                 API base, auth headers, errors, contract DTOs
│       ├── media/               upload/register + signed preview helpers
│       ├── telemetry/           client correlation/error reporting
│       └── components/          product-neutral UI primitives
├── editor-module/               temporary editor extraction source
└── editor-bff/                  stateless editor transport only

app/* pages import one feature entry point. Raw fetch, provider URLs, secrets, and business decisions do not appear in page files.

apps/mobile — Expo companion product

apps/mobile/
├── app/                         Expo Router route files only
│   ├── (tabs)/                  Create, B-roll, Jobs, Me
│   ├── job/[id].tsx             deep-linked job review
│   ├── creator/[id].tsx         public creator profile
│   └── settings-like screens    pushed from Me
├── src/
│   ├── features/
│   │   ├── reel-create/
│   │   ├── broll-studio/
│   │   ├── jobs-library/
│   │   ├── account/             plan, API key, privacy, team summary
│   │   └── notifications/
│   └── shared/
│       ├── api/                 contract client and error mapping
│       ├── auth/                secure API-key/session lifecycle
│       ├── lifecycle/           foreground/background poll policy
│       ├── media/               pickers, presign upload, native video player
│       └── telemetry/
└── components/                  native visual primitives, not business logic

Mobile caches drafts and job snapshots for UX only. It refreshes authoritative state when foregrounded; it does not persist signed URLs or provider keys.

apps/desktop — Rust/GPUI native workspace

apps/desktop/src/
├── api/                         typed HTTP, models, uploads, polling, errors
├── config/                      non-secret API-base preference + capabilities
├── security/                    Keychain/Credential Manager/Secret Service
├── domain/                      ReelDraft, BrollDraft, JobSnapshot, library
├── media/                       file/screen capture, probing, native playback
├── workspace/                   worker channel, reducer, cached non-secret state
├── ui/
│   ├── shell.rs                 native application navigation
│   ├── create/                  reel/B-roll forms and attach handoff
│   ├── library/                 result collection and selection
│   ├── preview/                 playback/download/export actions
│   ├── settings/                endpoint/keychain/connection diagnostics
│   └── components/              GPUI primitives
└── telemetry/                   correlation-aware local failure events

All network and secure-store work runs in workspace/worker.rs; GPUI views render reduced state only. Secure-store failure blocks credential saving—there is no plaintext configuration fallback.

5. Page and screen map

Web pages

Route group Pages Phase
Marketing /, /pricing, /sign-in, /sign-up, add /terms, /privacy, /acceptable-use launch readiness
Core /dashboard, /new, /broll, /jobs, /jobs/[id], /editor complete first
Creator /avatars, /voices, /brand, /ideas, /presets, /notifications, /analytics, /insights, /performance web depth
Publishing /connections, /scheduled, /calendar gated by launch capabilities
Billing/team /billing, /billing/success, /billing/cancel, /team, /usage, /settings/billing gated checkout
Enterprise/developer settings API keys/audit/privacy/SSO/team, /developer web-only control plane
Discovery/admin marketplace, creator profile, leaderboard, referral, share route, /admin/* phase after core parity

Mobile screens

Navigation Screen Required behavior
Tab: Create Reel form recording picker → presign/register → create/poll; B-roll attachment retained
Tab: B-roll B-roll studio text/i2v creation, history persistence, inline video preview, attach to Create
Tab: Jobs Library active/completed/failed filters, deep-link job detail, retry eligible errors
Tab: Me Account capability/launch state, API key, plan summary, settings entry points
Push Job detail state/progress/result/retry/correlation ID
Push Account utilities avatars, voices, brand, plan, privacy, team summary, notifications
Deferred analytics, marketplace, calendar, developer, SSO concise read-only views or web handoff; do not reproduce dense web UIs

Desktop GPUI sections

Section Views and actions
Create Reel form, local file/screen capture, asset upload, B-roll prompt/i2v reference, approved workflow picker, attach selection, submit
Library active queue, completed reels/B-roll/editor outputs, retry eligible failures, sort/search/filter
Preview native playback, result download/open, B-roll attach-to-current-reel, correlation/error details
Settings API base, secure credential save/clear, connection check, capability/launch state, keychain error state

Desktop does not need marketing, public checkout, staff admin, or external OAuth browser implementation in the first product release. It opens a browser only for approved web-owned actions such as OAuth or billing handoff.

6. Delivery order

  1. Contract and parity: generated API contract, all create/poll/preview/ attach paths, capability-driven UI gating, correlation/error presentation.
  2. Desktop completion: capability workflow picker, full preview playback, upload progress, keychain diagnostics, workspace cache recovery.
  3. Web completion: route-to-feature cleanup, editor export, teams/billing/ publishing feature boundaries, accessible empty/error/loading states.
  4. Mobile completion: background-resume poll behavior, offline draft/history, deep links and notification-to-job routing.
  5. Operations: provider manifest approval, real golden suite, deployment preflight/smoke, launch switches, staged public enablement.

No phase permits a client to add direct provider credentials, call the GPU engine, access R2 without an API presign, or duplicate ledger/job logic.

For the next business-model evolution—wallet credits, model/provider selection, price snapshots, reservations, settlement, and app surfaces—see PROVIDER_MARKETPLACE_PLAN.md.

OpenRouter may be added as one reviewed upstream gateway; it does not replace the ReelForge API, wallet, routing policy, or client contract.