Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
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.
925 lines
54 KiB
Markdown
925 lines
54 KiB
Markdown
# ReelForge Vision 2026 — `apps/mobile` Architecture (Additive)
|
||
|
||
> **Scope of this document.** This is an *additive* architecture manifest for the Expo
|
||
> (`expo-router`) mobile client. It designs the NEW work required to turn the current
|
||
> capture-and-review companion into a full **capture-first creation + shot-template reels +
|
||
> review/approve + publish/schedule + on-the-go clipfarm control + trends + wallet + push**
|
||
> product. It assumes everything already shipped exists (sign-in with API key in
|
||
> `expo-secure-store`, the 4-tab shell, `src/shared/{api,auth,lifecycle,hooks,media}`, the
|
||
> `reel-create` / `jobs-library` / `broll-studio` feature modules, and the legacy
|
||
> `components/` + `lib/api.ts` surfaces). It does **not** restate those.
|
||
>
|
||
> **The one-backend rule holds.** Mobile stays a thin client of the same `/api/v1` contract
|
||
> the web and desktop apps use. It owns *no* job, credit, provider, routing, watermark, or
|
||
> media rules — it only renders state, captures input, queues uploads, and deep-links. All
|
||
> new server subsystems referenced here (`templates/`, `captions/`, `film/`, `publishing/`,
|
||
> `gateway/`, `marketplace/`) live in `apps/api/reelforge/*` and are consumed over HTTP.
|
||
|
||
---
|
||
|
||
## 1. Overview & Design Principles
|
||
|
||
### 1.1 What we are adding
|
||
|
||
| Capability area | Mobile surface added |
|
||
| --- | --- |
|
||
| Capture-first creation | In-app camera + screen-record import + teleprompter + quick-record → one-tap upload queue |
|
||
| Quick shot-template reels | Genre template picker (7 seeded genres) with segment-slot quick-fill + per-model burn preview |
|
||
| Empty-screen-killer onboarding | Preloaded sample reel + one-tap remix, 3–5 min to first published clip, Sora-migration flow |
|
||
| Review / approve renders | Render review, hook-score + retention predictor, per-shot regenerate, approve→publish handoff |
|
||
| Publish + schedule | Multi-account OAuth connect, per-platform composer, watermark-safe note, scheduler + calendar |
|
||
| Retention & A/B | Retention-curve viewer, 1-body/N-hooks experiments, winner promotion |
|
||
| On-the-go clipfarm control | Automation runs, series/channel mode, batch queue pause/resume, cadence guardrails |
|
||
| Trends feed | Trending audio/hashtag feed with saturation score + one-tap "create from trend" |
|
||
| Wallet & billing | Balance, top-up, burn preview, transactions, provisioning-key view, plan/limits |
|
||
| Marketplace | Clipping campaigns (clipper side), submissions, earnings, affiliate dashboard |
|
||
| Notifications & push | Expo push registration, notification center, deep-link routing, job/schedule/payout alerts |
|
||
| Film-lite | Screenplay/shot-list review, storyboard approve, character-lock review on-the-go |
|
||
|
||
### 1.2 Conventions we follow (matching the existing codebase)
|
||
|
||
- **Route files are thin.** Files under `app/` only wire params + render a feature `Screen`.
|
||
All logic lives in `src/features/<domain>/`.
|
||
- **Feature module shape:** `src/features/<domain>/<Name>Screen.tsx` + `index.ts` barrel +
|
||
`components/` (200–400 line focused files) + colocated `*.ts` helpers/hooks.
|
||
- **Shared code** lives in `src/shared/<concern>/` with an `index.ts` barrel.
|
||
- **Transport** goes through the existing `src/shared/api/client.ts` (`apiRequest`, `ApiError`,
|
||
envelope unwrap, `Idempotency-Key`, `x-api-key`). New typed resource clients wrap it under
|
||
`src/shared/api/resources/`.
|
||
- **Auth token** comes from `useSession()` (`x-api-key`); passed as `{ token }`.
|
||
- **Polling** reuses `src/shared/lifecycle/polling.ts` + `app-state.ts` (foreground refresh,
|
||
stop on `completed`/`failed`). Signed URLs are never persisted.
|
||
- **Dark theme:** base `#0b0b12`, surface `#15151f`, border `#2a2a3a`, accent `#6a5bff` /
|
||
`#8b7bff`, success `#4ade80`, error `#ff6b6b`, muted `#6b6b7b`. We formalize this into a
|
||
shared `ui/` design system so the ~15 new domains stay visually consistent.
|
||
- **Immutability, small files, explicit prop types, `unknown`-narrowed errors, Zod at
|
||
boundaries** per repo rules.
|
||
- **No secrets on device** beyond the user API key (already in secure store) and short-lived
|
||
OAuth PKCE verifiers. Signed URLs and provider keys never touch the client.
|
||
|
||
### 1.3 New dependencies (added to `package.json`)
|
||
|
||
| Package | Purpose |
|
||
| --- | --- |
|
||
| `expo-camera` | In-app capture (record/photo) for capture-first creation |
|
||
| `expo-notifications` | Push registration + local notifications + categories |
|
||
| `expo-device` | Push token gating (physical device detection) |
|
||
| `expo-media-library` | Save exports / read camera roll for import |
|
||
| `expo-video` (or keep `expo-av`) | Render preview playback + scrubbing |
|
||
| `expo-haptics` | Tactile feedback on approve/publish/record |
|
||
| `expo-clipboard` | Copy captions / share links / affiliate codes |
|
||
| `expo-crypto` | PKCE verifier + idempotency-key entropy |
|
||
| `@shopify/flash-list` | Virtualized trends / jobs / campaign feeds |
|
||
| `react-native-gesture-handler` + `react-native-reanimated` | Bottom sheets, scrubber, swipe review |
|
||
| `@gorhom/bottom-sheet` | Standard sheet primitive for pickers/composers |
|
||
| `zod` | Boundary validation of API payloads + deep-link params |
|
||
| `date-fns` + `date-fns-tz` | Timezone-correct scheduler math on device |
|
||
| `posthog-react-native` | Activation-funnel + A/B onboarding instrumentation |
|
||
|
||
---
|
||
|
||
## 2. New Directory Tree
|
||
|
||
```text
|
||
apps/mobile/
|
||
├── app/ # expo-router route files (thin) — NEW routes
|
||
│ ├── (tabs)/
|
||
│ │ ├── publish.tsx # Publish tab → PublishHubScreen
|
||
│ │ ├── trends.tsx # Trends tab → TrendsFeedScreen
|
||
│ │ └── studio.tsx # Studio hub tab → StudioHubScreen
|
||
│ ├── onboarding/
|
||
│ │ ├── _layout.tsx # onboarding stack shell
|
||
│ │ ├── index.tsx # welcome / value prop
|
||
│ │ ├── remix.tsx # sample-reel one-tap remix
|
||
│ │ ├── connect.tsx # connect first social account
|
||
│ │ ├── goal.tsx # niche/genre + cadence intent
|
||
│ │ └── migrate-sora.tsx # Sora-shutdown migration onboarding
|
||
│ ├── capture/
|
||
│ │ ├── camera.tsx # in-app camera capture
|
||
│ │ ├── screen-import.tsx # screen-recording import + trim
|
||
│ │ └── teleprompter.tsx # record with scrolling script
|
||
│ ├── template/
|
||
│ │ ├── index.tsx # genre template gallery
|
||
│ │ └── [id].tsx # template detail / quick-fill
|
||
│ ├── review/
|
||
│ │ └── [jobId].tsx # render review + approve
|
||
│ ├── shot/
|
||
│ │ └── [shotId].tsx # per-shot regenerate (film)
|
||
│ ├── publish/
|
||
│ │ ├── compose.tsx # per-platform composer
|
||
│ │ ├── connections.tsx # OAuth account manager
|
||
│ │ └── [postId].tsx # scheduled/published post detail
|
||
│ ├── schedule/
|
||
│ │ ├── index.tsx # calendar/queue
|
||
│ │ └── new.tsx # schedule a post
|
||
│ ├── experiment/
|
||
│ │ ├── index.tsx # A/B experiments list
|
||
│ │ └── [id].tsx # experiment detail + winner
|
||
│ ├── retention/
|
||
│ │ └── [postId].tsx # retention-curve detail
|
||
│ ├── trend/
|
||
│ │ └── [id].tsx # trend detail → create-from-trend
|
||
│ ├── clipfarm/
|
||
│ │ ├── index.tsx # automation control room
|
||
│ │ ├── run/[id].tsx # automation run detail
|
||
│ │ └── channel/[id].tsx # single-format channel mode
|
||
│ ├── series/
|
||
│ │ ├── index.tsx # episodic series list
|
||
│ │ └── [id].tsx # series detail / next episode
|
||
│ ├── film/
|
||
│ │ ├── index.tsx # film projects list
|
||
│ │ ├── [id].tsx # screenplay/shot-list review
|
||
│ │ └── character/[id].tsx # character-lock review
|
||
│ ├── repurpose/
|
||
│ │ └── index.tsx # long→clips import + review
|
||
│ ├── wallet/
|
||
│ │ ├── index.tsx # balance + burn + topups
|
||
│ │ ├── topup.tsx # top-up checkout launcher
|
||
│ │ ├── transactions.tsx # ledger history
|
||
│ │ └── keys.tsx # provisioning key view
|
||
│ ├── plan/
|
||
│ │ └── limits.tsx # plan + rate-limit + overage
|
||
│ ├── market/
|
||
│ │ ├── index.tsx # clipping campaign feed
|
||
│ │ ├── campaign/[id].tsx # campaign detail + submit
|
||
│ │ ├── submissions.tsx # my submissions + status
|
||
│ │ └── earnings.tsx # clipper earnings/payouts
|
||
│ ├── affiliate/
|
||
│ │ └── index.tsx # affiliate dashboard
|
||
│ └── notifications/
|
||
│ └── index.tsx # notification center (full)
|
||
│
|
||
├── src/
|
||
│ ├── shared/
|
||
│ │ ├── ui/ # design system primitives (NEW)
|
||
│ │ ├── push/ # Expo push registration + routing (NEW)
|
||
│ │ ├── deep-linking/ # linking config + param parsing (NEW)
|
||
│ │ ├── net/ # retry/SSE/upload-queue/offline (NEW)
|
||
│ │ ├── cache/ # draft + snapshot + query cache (NEW)
|
||
│ │ ├── format/ # money/duration/percent/date (NEW)
|
||
│ │ ├── telemetry/ # PostHog activation instrumentation (NEW)
|
||
│ │ ├── media/ # EXTEND: capture/compress/trim/waveform
|
||
│ │ └── api/
|
||
│ │ └── resources/ # typed per-domain resource clients (NEW)
|
||
│ └── features/
|
||
│ ├── onboarding/ # empty-screen killer + Sora migration
|
||
│ ├── capture/ # camera/screen-import/teleprompter
|
||
│ ├── templates/ # genre shot-template picker + quick-fill
|
||
│ ├── review/ # render review + hook-score + approve
|
||
│ ├── publishing/ # OAuth connect + composer + hub
|
||
│ ├── scheduler/ # calendar + queue + cadence + best-time
|
||
│ ├── experiments/ # 1-body/N-hooks A/B
|
||
│ ├── retention/ # retention-curve viewer
|
||
│ ├── trends/ # trend feed + create-from-trend
|
||
│ ├── clipfarm/ # automation control room + channel mode
|
||
│ ├── series/ # episodic series manager
|
||
│ ├── film/ # screenplay/shot/character review-lite
|
||
│ ├── repurpose/ # long→clips highlight review
|
||
│ ├── wallet/ # balance/burn/topup/keys
|
||
│ ├── plans/ # tiered plan + limits
|
||
│ ├── marketplace/ # clipping campaigns + earnings
|
||
│ ├── affiliate/ # affiliate program
|
||
│ └── notifications/ # notification center (extends legacy)
|
||
```
|
||
|
||
---
|
||
|
||
## 3. Shared Foundation — `src/shared/`
|
||
|
||
New cross-cutting infrastructure every feature depends on. Small, focused, barrel-exported.
|
||
|
||
### 3.1 `src/shared/ui/` — design system
|
||
|
||
Formalizes the ad-hoc inline styles into reusable primitives so 18 new domains stay
|
||
consistent. One component per file; all theme-driven.
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/ui/theme.ts` | Central theme object (colors, spacing, radii, typography scale, z-index). |
|
||
| `src/shared/ui/colors.ts` | Named color tokens (`base`, `surface`, `border`, `accent`, `success`, `error`, `muted`, platform brand colors). |
|
||
| `src/shared/ui/spacing.ts` | 4pt spacing scale + safe-area helpers. |
|
||
| `src/shared/ui/typography.ts` | Text style presets (h1/h2/h3/body/meta/mono) + weights. |
|
||
| `src/shared/ui/Screen.tsx` | Safe-area scroll/flex screen wrapper with themed background + refresh control. |
|
||
| `src/shared/ui/Card.tsx` | Surface card container. |
|
||
| `src/shared/ui/SectionHeader.tsx` | Titled section header with optional action. |
|
||
| `src/shared/ui/Button.tsx` | Primary/secondary/ghost/danger button with loading state. |
|
||
| `src/shared/ui/IconButton.tsx` | Icon-only pressable with hit-slop. |
|
||
| `src/shared/ui/Chip.tsx` | Single selectable chip. |
|
||
| `src/shared/ui/ChipRow.tsx` | Wrapping chip row (extracted from `Chips` in CreateScreen). |
|
||
| `src/shared/ui/SegmentedControl.tsx` | Segmented single-select control. |
|
||
| `src/shared/ui/TextField.tsx` | Themed single/multiline text input with label + error. |
|
||
| `src/shared/ui/Stepper.tsx` | Numeric stepper (generalized `VariantsStepper`). |
|
||
| `src/shared/ui/Toggle.tsx` | Labeled switch row. |
|
||
| `src/shared/ui/Slider.tsx` | Themed slider (emotion dial, opacity, markup %). |
|
||
| `src/shared/ui/Sheet.tsx` | Bottom-sheet wrapper over `@gorhom/bottom-sheet`. |
|
||
| `src/shared/ui/Modal.tsx` | Centered modal dialog. |
|
||
| `src/shared/ui/Toast.tsx` | Single toast view. |
|
||
| `src/shared/ui/ToastProvider.tsx` | App-wide toast context + queue. |
|
||
| `src/shared/ui/EmptyState.tsx` | Illustration + copy + CTA for empty lists. |
|
||
| `src/shared/ui/ErrorState.tsx` | Error panel with retry (renders `ApiError.correlationId`). |
|
||
| `src/shared/ui/LoadingState.tsx` | Centered spinner + caption. |
|
||
| `src/shared/ui/Skeleton.tsx` | Shimmer placeholder block. |
|
||
| `src/shared/ui/ProgressBar.tsx` | Linear progress (generalized upload bar). |
|
||
| `src/shared/ui/CircularProgress.tsx` | Ring progress for render/upload. |
|
||
| `src/shared/ui/Badge.tsx` | Status/count badge. |
|
||
| `src/shared/ui/Pill.tsx` | Rounded status pill (queued/running/live/failed). |
|
||
| `src/shared/ui/Tag.tsx` | Small metadata tag. |
|
||
| `src/shared/ui/StatTile.tsx` | Metric tile (generalized `components/me/StatCard`). |
|
||
| `src/shared/ui/KeyValueRow.tsx` | Label/value row. |
|
||
| `src/shared/ui/ListRow.tsx` | Tappable list row with leading/trailing slots. |
|
||
| `src/shared/ui/Divider.tsx` | Hairline divider. |
|
||
| `src/shared/ui/Accordion.tsx` | Collapsible section. |
|
||
| `src/shared/ui/InPageTabs.tsx` | In-screen tab switcher. |
|
||
| `src/shared/ui/SearchBar.tsx` | Debounced search input. |
|
||
| `src/shared/ui/Avatar.tsx` | Circular avatar/thumbnail. |
|
||
| `src/shared/ui/PlatformIcon.tsx` | TikTok/IG/YouTube/X brand icon + color. |
|
||
| `src/shared/ui/MoneyText.tsx` | Microdollar → formatted currency text. |
|
||
| `src/shared/ui/CreditText.tsx` | Credits + approx-dollar rendering. |
|
||
| `src/shared/ui/RelativeTime.tsx` | "3m ago" / countdown time text. |
|
||
| `src/shared/ui/Countdown.tsx` | Live countdown to a scheduled time. |
|
||
| `src/shared/ui/Haptics.ts` | Thin `expo-haptics` wrapper (success/warn/select). |
|
||
| `src/shared/ui/index.ts` | Barrel export of all primitives + theme. |
|
||
|
||
### 3.2 `src/shared/push/` — notifications transport
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/push/permission.ts` | Request + read notification permission status. |
|
||
| `src/shared/push/registration.ts` | Acquire Expo push token (device-gated via `expo-device`). |
|
||
| `src/shared/push/token-sync.ts` | Register/refresh device token with `/api/v1/devices` (idempotent). |
|
||
| `src/shared/push/categories.ts` | Notification categories + action buttons (Approve/Reschedule/View). |
|
||
| `src/shared/push/channels.ts` | Android notification channels (jobs/publish/payouts/system). |
|
||
| `src/shared/push/handlers.ts` | Foreground/response handlers → deep-link dispatch. |
|
||
| `src/shared/push/use-push.ts` | Hook: wire permission→register→sync→listeners on mount. |
|
||
| `src/shared/push/types.ts` | Push payload types (job.completed, schedule.due, payout.paid, …). |
|
||
| `src/shared/push/index.ts` | Barrel. |
|
||
|
||
### 3.3 `src/shared/deep-linking/` — routing
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/deep-linking/linking.config.ts` | `expo-router` linking config (scheme + path map + universal links). |
|
||
| `src/shared/deep-linking/routes.ts` | Typed route builders (`reviewRoute(jobId)`, `trendRoute(id)`, …). |
|
||
| `src/shared/deep-linking/parse.ts` | Zod-validated deep-link param parsing (never trust inbound URLs). |
|
||
| `src/shared/deep-linking/dispatch.ts` | Map a push/notification payload → a route push. |
|
||
| `src/shared/deep-linking/index.ts` | Barrel. |
|
||
|
||
### 3.4 `src/shared/net/` — resilient transport helpers
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/net/retry.ts` | Exponential backoff wrapper for idempotent GETs. |
|
||
| `src/shared/net/sse.ts` | Server-sent-events / chunked stream reader (film + caption progress). |
|
||
| `src/shared/net/connectivity.ts` | Online/offline state via `@react-native-community/netinfo`. |
|
||
| `src/shared/net/upload-queue.ts` | Persistent chunked upload queue (presign→PUT→register) with resume. |
|
||
| `src/shared/net/upload-task.ts` | Single upload task lifecycle + progress events. |
|
||
| `src/shared/net/mutation-queue.ts` | Offline-safe queued mutations (approve, schedule, submit) with idempotency keys. |
|
||
| `src/shared/net/idempotency.ts` | Stable idempotency-key generation + per-fingerprint reuse (extracted from CreateScreen). |
|
||
| `src/shared/net/index.ts` | Barrel. |
|
||
|
||
### 3.5 `src/shared/cache/` — device-local state (UX only)
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/cache/store.ts` | Thin async key-value store over `expo-secure-store` + `AsyncStorage` split (secrets vs UX). |
|
||
| `src/shared/cache/draft-cache.ts` | Persist in-progress create/publish drafts across cold start. |
|
||
| `src/shared/cache/snapshot-cache.ts` | Cache last-seen job/post/trend snapshots for instant paint (refreshed on focus). |
|
||
| `src/shared/cache/query.ts` | Minimal stale-while-revalidate fetch hook (`useResource` generalization). |
|
||
| `src/shared/cache/ttl.ts` | TTL + freshness helpers; never caches signed URLs. |
|
||
| `src/shared/cache/index.ts` | Barrel. |
|
||
|
||
### 3.6 `src/shared/format/` — formatting utilities
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/format/money.ts` | Integer-microdollar → currency string. |
|
||
| `src/shared/format/credits.ts` | Credit ↔ dollar approximation + "keepers left" phrasing. |
|
||
| `src/shared/format/duration.ts` | Seconds/frames → mm:ss + timecode. |
|
||
| `src/shared/format/percent.ts` | Ratio → percent (retention, saturation). |
|
||
| `src/shared/format/datetime.ts` | Timezone-aware date/time formatting (wraps `date-fns-tz`). |
|
||
| `src/shared/format/filesize.ts` | Bytes → human size. |
|
||
| `src/shared/format/number.ts` | Compact counts (12.3K, 1.2M views). |
|
||
| `src/shared/format/index.ts` | Barrel. |
|
||
|
||
### 3.7 `src/shared/telemetry/` — activation instrumentation
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/telemetry/posthog.ts` | PostHog client init + identify (workspace/user). |
|
||
| `src/shared/telemetry/events.ts` | Typed event catalog (aha funnel: capture→create→approve→publish). |
|
||
| `src/shared/telemetry/track.ts` | `track()` + screen-view helper; no PII beyond user id. |
|
||
| `src/shared/telemetry/use-activation.ts` | Hook measuring time-to-first-published-clip. |
|
||
| `src/shared/telemetry/index.ts` | Barrel. |
|
||
|
||
### 3.8 `src/shared/media/` — EXTENDED
|
||
|
||
New files added alongside existing pickers.
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/media/capture/use-camera.ts` | `expo-camera` recording controller (start/stop/flip/torch). |
|
||
| `src/shared/media/capture/CameraView.tsx` | Camera preview surface with record controls overlay. |
|
||
| `src/shared/media/capture/permissions.ts` | Camera + mic permission flow. |
|
||
| `src/shared/media/compress.ts` | Client-side downscale/compress before upload (bandwidth-aware). |
|
||
| `src/shared/media/trim.ts` | Client-side trim range selection metadata (server does the cut). |
|
||
| `src/shared/media/thumbnail.ts` | Generate local poster frame for review lists. |
|
||
| `src/shared/media/waveform.ts` | Sample audio → waveform points for teleprompter/podcast UI. |
|
||
| `src/shared/media/scrubber-state.ts` | Playback + scrub position state for review player. |
|
||
| `src/shared/media/index.ts` | EXTEND barrel with new exports. |
|
||
|
||
### 3.9 `src/shared/api/resources/` — typed resource clients
|
||
|
||
One module per API domain; each exposes small typed functions over `apiRequest`. These
|
||
replace ad-hoc calls in the legacy `lib/api.ts` for new domains (existing calls stay).
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `src/shared/api/resources/templates.ts` | List/get genre shot-templates + segment slots + defaults. |
|
||
| `src/shared/api/resources/captions.ts` | Caption presets, WhisperX job status, ASS style options. |
|
||
| `src/shared/api/resources/burn-preview.ts` | Per-model burn preview (`POST /estimate`) → credits/$/keepers. |
|
||
| `src/shared/api/resources/routing.ts` | Model list with license class + health + deprecation metadata. |
|
||
| `src/shared/api/resources/review.ts` | Job review payload: hook-score, retention prediction, per-shot list. |
|
||
| `src/shared/api/resources/shots.ts` | Per-shot regenerate (frame/motion) + status. |
|
||
| `src/shared/api/resources/publishing.ts` | Connections, OAuth start/callback exchange, post CRUD. |
|
||
| `src/shared/api/resources/scheduler.ts` | Schedule queue, cadence, best-time, cap-awareness. |
|
||
| `src/shared/api/resources/experiments.ts` | A/B experiments create/list/winner. |
|
||
| `src/shared/api/resources/retention.ts` | Retention curves + per-second drop-off ingestion. |
|
||
| `src/shared/api/resources/trends.ts` | Trend feed (audio/hashtag) + saturation/decay score. |
|
||
| `src/shared/api/resources/clipfarm.ts` | Automation runs, batch queue, pause/resume. |
|
||
| `src/shared/api/resources/series.ts` | Episodic series + next-episode + character identity. |
|
||
| `src/shared/api/resources/film.ts` | Film projects, screenplay, shot-list, animatic status. |
|
||
| `src/shared/api/resources/characters.ts` | Character/style lock entities. |
|
||
| `src/shared/api/resources/repurpose.ts` | Long→clips highlight jobs + selected clips. |
|
||
| `src/shared/api/resources/wallet.ts` | Balance, ledger, top-up session, buckets (rollover vs monthly). |
|
||
| `src/shared/api/resources/keys.ts` | Provisioning/management keys (spend caps + resets). |
|
||
| `src/shared/api/resources/plans.ts` | Tiered plans, rate limits, overage, SLA. |
|
||
| `src/shared/api/resources/marketplace.ts` | Clipping campaigns, submissions, verification status, earnings. |
|
||
| `src/shared/api/resources/affiliate.ts` | Affiliate links, referrals, payouts. |
|
||
| `src/shared/api/resources/devices.ts` | Push device token registration. |
|
||
| `src/shared/api/resources/schemas.ts` | Zod schemas shared across resource clients (boundary validation). |
|
||
| `src/shared/api/resources/index.ts` | Barrel. |
|
||
|
||
---
|
||
|
||
## 4. Feature Modules — `src/features/`
|
||
|
||
Each domain: a `Screen` per route, an `index.ts` barrel, `components/`, and colocated
|
||
hooks/helpers. Route files under `app/` are one-liners that render these.
|
||
|
||
### 4.1 `onboarding/` — empty-screen killer + Sora migration
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `onboarding/WelcomeScreen.tsx` | Value-prop + "make your first reel in 3 minutes" CTA. |
|
||
| `onboarding/RemixScreen.tsx` | Preloaded finished sample reel → one-tap remix into Create. |
|
||
| `onboarding/GoalScreen.tsx` | Pick niche/genre + cadence intent → seeds template + scheduler defaults. |
|
||
| `onboarding/ConnectScreen.tsx` | Connect first social account (skippable). |
|
||
| `onboarding/SoraMigrationScreen.tsx` | Onboard displaced Sora creators → routed Veo/Kling/Seedance stack. |
|
||
| `onboarding/components/SampleReelCard.tsx` | Autoplaying muted sample reel with remix button. |
|
||
| `onboarding/components/StepDots.tsx` | Progress dots across onboarding stack. |
|
||
| `onboarding/components/NicheGrid.tsx` | Selectable niche/genre grid. |
|
||
| `onboarding/components/CadenceIntent.tsx` | Daily/weekly cadence picker. |
|
||
| `onboarding/components/MigrationChecklist.tsx` | Sora → ReelForge mapping checklist. |
|
||
| `onboarding/use-first-run.ts` | Detect first-run + gate onboarding + persist completion. |
|
||
| `onboarding/seed-defaults.ts` | Translate goal answers → create/scheduler seeds. |
|
||
| `onboarding/index.ts` | Barrel. |
|
||
|
||
### 4.2 `capture/` — capture-first creation
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `capture/CameraCaptureScreen.tsx` | Full-screen camera record → hands off to upload queue + Create. |
|
||
| `capture/ScreenImportScreen.tsx` | Import a screen recording from library/files + trim range. |
|
||
| `capture/TeleprompterScreen.tsx` | Record while a script scrolls; adjustable speed/size. |
|
||
| `capture/components/RecordControls.tsx` | Record/stop/flip/torch/timer overlay. |
|
||
| `capture/components/CaptureCountdown.tsx` | 3-2-1 pre-roll countdown. |
|
||
| `capture/components/TrimBar.tsx` | Scrubbable in/out trim handles over a filmstrip. |
|
||
| `capture/components/Filmstrip.tsx` | Thumbnail strip for the imported clip. |
|
||
| `capture/components/TeleprompterOverlay.tsx` | Semi-transparent scrolling script overlay. |
|
||
| `capture/components/TeleprompterControls.tsx` | Speed/font-size/mirror controls. |
|
||
| `capture/components/UploadQueueBanner.tsx` | Live upload-queue status pinned banner. |
|
||
| `capture/use-capture-session.ts` | Orchestrate record→compress→enqueue upload→return key. |
|
||
| `capture/use-teleprompter.ts` | Script scroll state + auto-speed by word count. |
|
||
| `capture/index.ts` | Barrel. |
|
||
|
||
### 4.3 `templates/` — genre shot-template picker + quick-fill
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `templates/TemplateGalleryScreen.tsx` | Genre gallery (Minecraft-Split, ASMR-Loop, Brainrot, Anime-Edit, Movie-Recap, Fake-Podcast, Gameplay-Story). |
|
||
| `templates/TemplateDetailScreen.tsx` | Template anatomy + segment slots + "use this" quick-fill. |
|
||
| `templates/components/TemplateCard.tsx` | Genre card with preview loop + burn estimate badge. |
|
||
| `templates/components/GenreFilter.tsx` | Filter by genre/faceless/effort. |
|
||
| `templates/components/SegmentSlotList.tsx` | Named slots (Hook/Proof/Payoff/Loop) with timing. |
|
||
| `templates/components/SegmentSlotEditor.tsx` | Per-slot quick-fill (text/audio/caption preset). |
|
||
| `templates/components/AudioLayerRow.tsx` | Narration/SFX/BGM layer toggles + duck hint. |
|
||
| `templates/components/CaptionPresetChip.tsx` | Hormozi/karaoke caption preset selector. |
|
||
| `templates/components/SafeZoneHint.tsx` | Per-platform caption safe-zone preview. |
|
||
| `templates/components/BurnPreviewBadge.tsx` | Credits/$/keepers-left inline estimate. |
|
||
| `templates/use-templates.ts` | Load templates + defaults for a genre. |
|
||
| `templates/use-quick-fill.ts` | Map slot inputs → a `JobCreateRequest` seed for Create. |
|
||
| `templates/genre-meta.ts` | Static genre metadata (labels, aspect, default durations). |
|
||
| `templates/index.ts` | Barrel. |
|
||
|
||
### 4.4 `review/` — render review + hook-score + approve
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `review/ReviewScreen.tsx` | Review a completed render: player, hook-score, retention prediction, approve/reject. |
|
||
| `review/components/ReviewPlayer.tsx` | Scrubbable player with first-3s marker. |
|
||
| `review/components/HookScoreGauge.tsx` | 0–100 hook-strength gauge vs 70% threshold. |
|
||
| `review/components/RetentionPredictionChart.tsx` | Predicted per-second retention curve. |
|
||
| `review/components/ColdOpenSuggestions.tsx` | Suggested cold-open rewrites when below threshold. |
|
||
| `review/components/VariantSwitcher.tsx` | Swipe between N generated variants. |
|
||
| `review/components/ShotList.tsx` | Per-shot thumbnails with "regenerate this shot" affordance. |
|
||
| `review/components/ApproveBar.tsx` | Approve→publish / reject / re-run action bar (haptic). |
|
||
| `review/components/QualityFlags.tsx` | Foreign-watermark / letterbox / safe-zone warnings. |
|
||
| `review/components/ExportPresetPicker.tsx` | Retention-optimized export preset (loop-back, keyword text). |
|
||
| `review/use-review.ts` | Load review payload + poll until ready. |
|
||
| `review/use-approve.ts` | Approve mutation (idempotent) → route to publish composer. |
|
||
| `review/index.ts` | Barrel. |
|
||
|
||
### 4.5 `publishing/` — OAuth connect + composer + hub
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `publishing/PublishHubScreen.tsx` | Publish tab: connected accounts, queued/live posts, quick-publish. |
|
||
| `publishing/ComposeScreen.tsx` | Per-platform caption/SEO/first-comment composer + preview. |
|
||
| `publishing/ConnectionsScreen.tsx` | Manage OAuth connections (add/remove/reauth). |
|
||
| `publishing/PostDetailScreen.tsx` | Single post: status, platform link, retention shortcut. |
|
||
| `publishing/components/ConnectionCard.tsx` | Account row with platform + health + token-expiry. |
|
||
| `publishing/components/OAuthButton.tsx` | Start PKCE OAuth via `expo-web-browser` per platform. |
|
||
| `publishing/components/PlatformTargets.tsx` | Multi-select publish targets with per-platform caps. |
|
||
| `publishing/components/CaptionComposer.tsx` | Caption editor with keyword-SEO hints + char limits. |
|
||
| `publishing/components/HashtagSuggest.tsx` | Trend-fed hashtag suggestions. |
|
||
| `publishing/components/FirstCommentField.tsx` | Optional pinned-first-comment field. |
|
||
| `publishing/components/PlatformPreview.tsx` | Mock per-platform feed preview (safe-zone aware). |
|
||
| `publishing/components/WatermarkSafeNote.tsx` | Confirms watermark-clean master + per-platform re-encode. |
|
||
| `publishing/components/TrendingAudioAttach.tsx` | Attach/relink native trending sound on upload. |
|
||
| `publishing/components/AdSafeAudioNote.tsx` | Cross-platform-safe (Meta-compatible) audio indicator. |
|
||
| `publishing/components/PublishModeToggle.tsx` | Publish now vs schedule vs add to A/B. |
|
||
| `publishing/oauth/pkce.ts` | PKCE verifier/challenge (via `expo-crypto`). |
|
||
| `publishing/oauth/platforms.ts` | Per-platform OAuth config (scopes, endpoints, redirect). |
|
||
| `publishing/use-connections.ts` | Load/refresh connections + reauth flow. |
|
||
| `publishing/use-compose.ts` | Composer state + validation + publish/schedule dispatch. |
|
||
| `publishing/index.ts` | Barrel. |
|
||
|
||
### 4.6 `scheduler/` — calendar + queue + cadence + best-time
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `scheduler/ScheduleScreen.tsx` | Calendar + queue of scheduled posts across accounts. |
|
||
| `scheduler/NewScheduleScreen.tsx` | Pick post + time(s) + account(s) with cap awareness. |
|
||
| `scheduler/components/CalendarStrip.tsx` | Horizontal date strip with per-day post counts. |
|
||
| `scheduler/components/QueueList.tsx` | Chronological scheduled-post list with countdowns. |
|
||
| `scheduler/components/ScheduledCard.tsx` | Scheduled post row (retry/backoff state, platform). |
|
||
| `scheduler/components/TimePicker.tsx` | Timezone-correct date/time picker. |
|
||
| `scheduler/components/BestTimeHint.tsx` | Learned best-time suggestion from first-hour data. |
|
||
| `scheduler/components/CadenceBanner.tsx` | Recommended cadence by account maturity (warmed vs new). |
|
||
| `scheduler/components/CannibalizationWarning.tsx` | Warn when same-account spacing too tight / reach dropping. |
|
||
| `scheduler/components/CapMeter.tsx` | Per-platform daily-cap remaining meter. |
|
||
| `scheduler/components/RescheduleSheet.tsx` | Bottom sheet to move a scheduled post. |
|
||
| `scheduler/use-schedule.ts` | Queue CRUD + optimistic mutation via mutation-queue. |
|
||
| `scheduler/use-cadence.ts` | Cadence + best-time recommendations loader. |
|
||
| `scheduler/tz.ts` | Device-tz ↔ account-tz conversion helpers. |
|
||
| `scheduler/index.ts` | Barrel. |
|
||
|
||
### 4.7 `experiments/` — 1-body/N-hooks A/B
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `experiments/ExperimentsScreen.tsx` | List running/finished hook experiments. |
|
||
| `experiments/ExperimentDetailScreen.tsx` | Variant comparison + retention-weighted winner. |
|
||
| `experiments/components/HookVariantCard.tsx` | Single hook variant with retention metric. |
|
||
| `experiments/components/VariantGeneratorSheet.tsx` | Generate N hook variants over one body. |
|
||
| `experiments/components/WinnerBanner.tsx` | Declared-winner banner + "promote to prompt" action. |
|
||
| `experiments/components/ScheduleSpreadPicker.tsx` | Auto-schedule variants over days/accounts. |
|
||
| `experiments/components/MetricPicker.tsx` | Choose completion vs avg-watch as winner metric. |
|
||
| `experiments/use-experiments.ts` | Experiment CRUD + winner polling. |
|
||
| `experiments/index.ts` | Barrel. |
|
||
|
||
### 4.8 `retention/` — retention-curve viewer
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `retention/RetentionScreen.tsx` | Per-post retention/completion/viewed-vs-swiped + sends/reach. |
|
||
| `retention/components/RetentionCurve.tsx` | Per-second drop-off line chart with 3s + loop markers. |
|
||
| `retention/components/ThresholdBands.tsx` | Reach-tier bands (<60% / 70–85% / >85%). |
|
||
| `retention/components/DropoffMarkers.tsx` | Annotate biggest drop-off points. |
|
||
| `retention/components/PlatformMetricRow.tsx` | Platform-specific KPI row (Qualified View, swipe-away). |
|
||
| `retention/use-retention.ts` | Load retention ingestion for a post (refresh on focus). |
|
||
| `retention/index.ts` | Barrel. |
|
||
|
||
### 4.9 `trends/` — trend feed + create-from-trend
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `trends/TrendsFeedScreen.tsx` | Trends tab: trending audio + hashtags with saturation score. |
|
||
| `trends/TrendDetailScreen.tsx` | Single trend: usage curve, saturation/decay, create-from-trend. |
|
||
| `trends/components/TrendCard.tsx` | Trend row (sound/hashtag) with rising/saturated badge. |
|
||
| `trends/components/SaturationMeter.tsx` | Rising-but-not-peaked saturation indicator. |
|
||
| `trends/components/TrendTypeTabs.tsx` | Audio / hashtag / creator tabs. |
|
||
| `trends/components/CreateFromTrendButton.tsx` | Seed a trend-audio-remix template into Create. |
|
||
| `trends/components/TrendUsageChart.tsx` | Adoption-over-time sparkline. |
|
||
| `trends/use-trends.ts` | Paginated trend feed loader (FlashList). |
|
||
| `trends/use-trend-detail.ts` | Single-trend detail + seed builder. |
|
||
| `trends/index.ts` | Barrel. |
|
||
|
||
### 4.10 `clipfarm/` — automation control room + channel mode
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `clipfarm/ClipfarmScreen.tsx` | Control room: automation runs, batch queue health, pause/resume all. |
|
||
| `clipfarm/RunDetailScreen.tsx` | Single automation run: steps, outputs, spend, errors. |
|
||
| `clipfarm/ChannelModeScreen.tsx` | Single-format channel: genre lock + daily cadence + backlog. |
|
||
| `clipfarm/components/RunCard.tsx` | Automation run summary row with state + throughput. |
|
||
| `clipfarm/components/RunStepTimeline.tsx` | Per-step timeline (generate→caption→export→publish). |
|
||
| `clipfarm/components/BatchQueueMeter.tsx` | Queue depth + success-only billing note. |
|
||
| `clipfarm/components/PauseResumeControl.tsx` | Pause/resume a run or the whole farm. |
|
||
| `clipfarm/components/ChannelBacklog.tsx` | Upcoming scheduled channel posts backlog. |
|
||
| `clipfarm/components/SpendGuardBanner.tsx` | Live spend vs cap for the automation. |
|
||
| `clipfarm/use-clipfarm.ts` | Runs list + queue polling. |
|
||
| `clipfarm/use-run.ts` | Single-run detail + control mutations. |
|
||
| `clipfarm/index.ts` | Barrel. |
|
||
|
||
### 4.11 `series/` — episodic series manager
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `series/SeriesListScreen.tsx` | List serialized channels/series with recurring identity. |
|
||
| `series/SeriesDetailScreen.tsx` | Episodes list + "generate next episode" with locked character/voice. |
|
||
| `series/components/SeriesCard.tsx` | Series row with character avatar + episode count. |
|
||
| `series/components/EpisodeRow.tsx` | Episode item with status + publish link. |
|
||
| `series/components/IdentityLockChip.tsx` | Locked voice+avatar identity indicator. |
|
||
| `series/components/NextEpisodeSheet.tsx` | Quick-generate next numbered episode. |
|
||
| `series/use-series.ts` | Series + episode loaders + next-episode mutation. |
|
||
| `series/index.ts` | Barrel. |
|
||
|
||
### 4.12 `film/` — screenplay/shot/character review-lite
|
||
|
||
Mobile is review/approve only; heavy authoring stays on web/desktop.
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `film/FilmListScreen.tsx` | Film projects list with progress by stage. |
|
||
| `film/FilmDetailScreen.tsx` | Screenplay → shot-list → animatic review with per-stage status. |
|
||
| `film/CharacterLockScreen.tsx` | Review a character/style lock (refs + identity consistency). |
|
||
| `film/components/StagePipeline.tsx` | Script→lock→shotlist→frame→motion→stitch→voice→finish tracker. |
|
||
| `film/components/ShotCard.tsx` | Shot thumbnail + intent + regenerate affordance. |
|
||
| `film/components/StoryboardStrip.tsx` | First-frame storyboard strip for pacing review. |
|
||
| `film/components/AnimaticPlayer.tsx` | Low-cost animatic playback before full generation. |
|
||
| `film/components/CharacterRefGrid.tsx` | Reference portraits for a locked character. |
|
||
| `film/components/BurnByStage.tsx` | Per-stage credit burn preview before committing GPU. |
|
||
| `film/use-film.ts` | Film project + shot loaders. |
|
||
| `film/use-character.ts` | Character-lock loader. |
|
||
| `film/index.ts` | Barrel. |
|
||
|
||
### 4.13 `film/shots/` (per-shot regenerate) — colocated
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `film/shots/ShotRegenerateScreen.tsx` | Regenerate a single off-intent frame or weak motion. |
|
||
| `film/shots/components/FramePreview.tsx` | First-frame preview + regenerate. |
|
||
| `film/shots/components/MotionPreview.tsx` | I2V motion preview + re-run motion only. |
|
||
| `film/shots/components/PromptTweakField.tsx` | Adjust the per-shot prompt (locked refs auto-injected). |
|
||
| `film/shots/components/ModelPickerRow.tsx` | Route this shot to a specific model (license/health aware). |
|
||
| `film/shots/use-shot.ts` | Shot regenerate mutations + status. |
|
||
| `film/shots/index.ts` | Barrel. |
|
||
|
||
### 4.14 `repurpose/` — long→clips highlight review
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `repurpose/RepurposeScreen.tsx` | Import long video (URL/file) → highlight clips to review/queue. |
|
||
| `repurpose/components/SourceInput.tsx` | URL/file source input (yt-dlp-backed). |
|
||
| `repurpose/components/HighlightList.tsx` | Ranked highlight clips with virality score. |
|
||
| `repurpose/components/HighlightCard.tsx` | Single clip: crop preview, score, keep/discard. |
|
||
| `repurpose/components/BatchToQueueBar.tsx` | Send kept clips to publishing queue. |
|
||
| `repurpose/use-repurpose.ts` | Submit source + poll highlight job + select clips. |
|
||
| `repurpose/index.ts` | Barrel. |
|
||
|
||
### 4.15 `wallet/` — balance/burn/topup/keys
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `wallet/WalletScreen.tsx` | Balance, rollover vs monthly buckets, recent burn, top-up CTA. |
|
||
| `wallet/TopupScreen.tsx` | Choose top-up amount → launch Creem hosted checkout (web browser). |
|
||
| `wallet/TransactionsScreen.tsx` | Paginated ledger (grants, holds, debits, refunds). |
|
||
| `wallet/KeysScreen.tsx` | View provisioning/management keys + spend caps + reset windows. |
|
||
| `wallet/components/BalanceHeader.tsx` | Big balance with approx-dollar + keepers-left. |
|
||
| `wallet/components/BucketBreakdown.tsx` | Non-rollover-monthly vs rollover-paid split. |
|
||
| `wallet/components/BurnPreviewCard.tsx` | Reusable per-model burn estimate (credits/$/keepers). |
|
||
| `wallet/components/LedgerRow.tsx` | Single ledger entry with model/provider/margin detail. |
|
||
| `wallet/components/TopupOption.tsx` | Preset top-up amount tile with fee/expiry note. |
|
||
| `wallet/components/KeyCard.tsx` | Provisioning key row: label, cap, reset, BYOK-in-limit toggle. |
|
||
| `wallet/components/SpendCapMeter.tsx` | Per-key spend-used vs cap meter. |
|
||
| `wallet/use-wallet.ts` | Balance + buckets loader (refresh on focus). |
|
||
| `wallet/use-transactions.ts` | Paginated ledger loader. |
|
||
| `wallet/use-keys.ts` | Keys list (read-only on mobile; issue/edit deferred to web). |
|
||
| `wallet/use-topup.ts` | Create top-up session + open checkout + poll on return. |
|
||
| `wallet/index.ts` | Barrel. |
|
||
|
||
### 4.16 `plans/` — tiered plan + limits
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `plans/PlanLimitsScreen.tsx` | Current plan, published rate limits, overage rates, SLA credit-back. |
|
||
| `plans/components/PlanBadge.tsx` | Free/Pro/Agency/Enterprise badge. |
|
||
| `plans/components/RateLimitRow.tsx` | req/min + req/day usage vs limit. |
|
||
| `plans/components/OverageNote.tsx` | Overage-rate explainer. |
|
||
| `plans/components/UpgradeTriggerCard.tsx` | Named upgrade triggers (editor, hook-score, no-watermark, scheduler). |
|
||
| `plans/use-plan.ts` | Plan + limits loader. |
|
||
| `plans/index.ts` | Barrel. |
|
||
|
||
### 4.17 `marketplace/` — clipping campaigns + earnings (clipper side)
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `marketplace/CampaignFeedScreen.tsx` | Browse open clipping campaigns (CPM, budget, rules). |
|
||
| `marketplace/CampaignDetailScreen.tsx` | Campaign brief + submit a clip. |
|
||
| `marketplace/SubmissionsScreen.tsx` | My submissions + approval/verification status. |
|
||
| `marketplace/EarningsScreen.tsx` | Verified-view earnings + payout history. |
|
||
| `marketplace/components/CampaignCard.tsx` | Campaign row (CPM, remaining budget, deadline). |
|
||
| `marketplace/components/CampaignRules.tsx` | Watermark/asset/approval rules panel. |
|
||
| `marketplace/components/SubmitClipSheet.tsx` | Attach a rendered reel + submit for approval. |
|
||
| `marketplace/components/SubmissionCard.tsx` | Submission status (pending/approved/72h/rejected). |
|
||
| `marketplace/components/VerifiedViewsBadge.tsx` | API-verified views + fraud-check state. |
|
||
| `marketplace/components/PayoutRow.tsx` | Payout entry (amount, method, status). |
|
||
| `marketplace/use-campaigns.ts` | Campaign feed + detail loaders. |
|
||
| `marketplace/use-submissions.ts` | Submit + status polling. |
|
||
| `marketplace/use-earnings.ts` | Earnings + payouts loader. |
|
||
| `marketplace/index.ts` | Barrel. |
|
||
|
||
### 4.18 `affiliate/` — affiliate program
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `affiliate/AffiliateScreen.tsx` | Lifetime-recurring affiliate dashboard: link, referrals, earnings. |
|
||
| `affiliate/components/DeepLinkCard.tsx` | Affiliate deep link + copy/share. |
|
||
| `affiliate/components/ReferralRow.tsx` | Referred user + recurring status. |
|
||
| `affiliate/components/CommissionSummary.tsx` | Lifetime commission totals + next payout. |
|
||
| `affiliate/use-affiliate.ts` | Affiliate link + referrals + payouts loader. |
|
||
| `affiliate/index.ts` | Barrel. |
|
||
|
||
### 4.19 `notifications/` — notification center (extends legacy `components/notifications`)
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `notifications/NotificationCenterScreen.tsx` | Full grouped notification list (jobs/publish/payouts/system). |
|
||
| `notifications/components/NotificationGroup.tsx` | Collapsible day/type group. |
|
||
| `notifications/components/NotificationRow.tsx` | Single notification with action buttons → deep link. |
|
||
| `notifications/components/PrefsSheet.tsx` | Per-category push preference toggles. |
|
||
| `notifications/use-notifications.ts` | Paginated notifications + unread + mark-read (wraps legacy hook). |
|
||
| `notifications/index.ts` | Barrel. |
|
||
|
||
### 4.20 `studio/` — Studio hub (navigational)
|
||
|
||
| Path | Responsibility |
|
||
| --- | --- |
|
||
| `studio/StudioHubScreen.tsx` | Studio tab: entry cards to Templates, Film, Series, Repurpose, Clipfarm. |
|
||
| `studio/components/HubCard.tsx` | Large nav card with icon + subtitle + count badge. |
|
||
| `studio/components/ContinueRow.tsx` | "Continue where you left off" drafts row (from draft-cache). |
|
||
| `studio/index.ts` | Barrel. |
|
||
|
||
---
|
||
|
||
## 5. Route Files (`app/`) — thin wiring
|
||
|
||
Each is a one-liner rendering the feature screen. Representative manifest:
|
||
|
||
| Path | Renders |
|
||
| --- | --- |
|
||
| `app/(tabs)/publish.tsx` | `PublishHubScreen` |
|
||
| `app/(tabs)/trends.tsx` | `TrendsFeedScreen` |
|
||
| `app/(tabs)/studio.tsx` | `StudioHubScreen` |
|
||
| `app/onboarding/_layout.tsx` | Onboarding stack `Slot` |
|
||
| `app/onboarding/index.tsx` | `WelcomeScreen` |
|
||
| `app/onboarding/remix.tsx` | `RemixScreen` |
|
||
| `app/onboarding/connect.tsx` | `ConnectScreen` |
|
||
| `app/onboarding/goal.tsx` | `GoalScreen` |
|
||
| `app/onboarding/migrate-sora.tsx` | `SoraMigrationScreen` |
|
||
| `app/capture/camera.tsx` | `CameraCaptureScreen` |
|
||
| `app/capture/screen-import.tsx` | `ScreenImportScreen` |
|
||
| `app/capture/teleprompter.tsx` | `TeleprompterScreen` |
|
||
| `app/template/index.tsx` | `TemplateGalleryScreen` |
|
||
| `app/template/[id].tsx` | `TemplateDetailScreen` (param `id`) |
|
||
| `app/review/[jobId].tsx` | `ReviewScreen` (param `jobId`) |
|
||
| `app/shot/[shotId].tsx` | `ShotRegenerateScreen` (param `shotId`) |
|
||
| `app/publish/compose.tsx` | `ComposeScreen` |
|
||
| `app/publish/connections.tsx` | `ConnectionsScreen` |
|
||
| `app/publish/[postId].tsx` | `PostDetailScreen` (param `postId`) |
|
||
| `app/schedule/index.tsx` | `ScheduleScreen` |
|
||
| `app/schedule/new.tsx` | `NewScheduleScreen` |
|
||
| `app/experiment/index.tsx` | `ExperimentsScreen` |
|
||
| `app/experiment/[id].tsx` | `ExperimentDetailScreen` |
|
||
| `app/retention/[postId].tsx` | `RetentionScreen` |
|
||
| `app/trend/[id].tsx` | `TrendDetailScreen` |
|
||
| `app/clipfarm/index.tsx` | `ClipfarmScreen` |
|
||
| `app/clipfarm/run/[id].tsx` | `RunDetailScreen` |
|
||
| `app/clipfarm/channel/[id].tsx` | `ChannelModeScreen` |
|
||
| `app/series/index.tsx` | `SeriesListScreen` |
|
||
| `app/series/[id].tsx` | `SeriesDetailScreen` |
|
||
| `app/film/index.tsx` | `FilmListScreen` |
|
||
| `app/film/[id].tsx` | `FilmDetailScreen` |
|
||
| `app/film/character/[id].tsx` | `CharacterLockScreen` |
|
||
| `app/repurpose/index.tsx` | `RepurposeScreen` |
|
||
| `app/wallet/index.tsx` | `WalletScreen` |
|
||
| `app/wallet/topup.tsx` | `TopupScreen` |
|
||
| `app/wallet/transactions.tsx` | `TransactionsScreen` |
|
||
| `app/wallet/keys.tsx` | `KeysScreen` |
|
||
| `app/plan/limits.tsx` | `PlanLimitsScreen` |
|
||
| `app/market/index.tsx` | `CampaignFeedScreen` |
|
||
| `app/market/campaign/[id].tsx` | `CampaignDetailScreen` |
|
||
| `app/market/submissions.tsx` | `SubmissionsScreen` |
|
||
| `app/market/earnings.tsx` | `EarningsScreen` |
|
||
| `app/affiliate/index.tsx` | `AffiliateScreen` |
|
||
| `app/notifications/index.tsx` | `NotificationCenterScreen` |
|
||
|
||
### 5.1 Tab restructure (additive, seam-preserving)
|
||
|
||
Current tabs: `create`, `jobs`, `broll`, `me`. Mobile now needs publish/trends/studio.
|
||
To avoid a 7-tab bar we **regroup** additively (existing route files stay; only
|
||
`app/(tabs)/_layout.tsx` is edited):
|
||
|
||
- **Create** (existing) — capture-first entry; `broll` folds under Create/Studio.
|
||
- **Studio** (new) — hub to Templates, Film, Series, Repurpose, Clipfarm, Jobs library.
|
||
- **Publish** (new) — hub + composer + connections + schedule.
|
||
- **Trends** (new) — trend feed.
|
||
- **Me** (existing) — profile, wallet, plan, affiliate, marketplace entries.
|
||
|
||
`jobs` and `broll` become reachable via the Studio hub rather than top-level tabs
|
||
(their route files are untouched). This keeps a 5-tab bar.
|
||
|
||
---
|
||
|
||
## 6. Key Data Models & API Contracts (client-side types)
|
||
|
||
All shapes are Zod-validated at the boundary (`resources/schemas.ts`) then inferred to TS.
|
||
Names mirror the API domains; only client-relevant fields shown.
|
||
|
||
```ts
|
||
// Genre shot-template (templates.ts)
|
||
interface ShotTemplate {
|
||
id: string;
|
||
genre: "minecraft-split" | "asmr-loop" | "brainrot-meme" | "anime-edit"
|
||
| "movie-recap" | "fake-podcast" | "gameplay-story";
|
||
title: string;
|
||
aspect: "9:16";
|
||
default_duration_s: number;
|
||
segments: SegmentSlot[];
|
||
caption_preset_id: string;
|
||
preview_url?: string; // ephemeral, never cached
|
||
burn_estimate?: BurnEstimate;
|
||
}
|
||
interface SegmentSlot {
|
||
key: "hook" | "proof1" | "proof2" | "payoff" | "loop" | string;
|
||
start_s: number; end_s: number;
|
||
audio_layers: ("narration" | "sfx" | "bgm")[];
|
||
caption_preset_id?: string;
|
||
}
|
||
|
||
// Per-model burn preview (burn-preview.ts)
|
||
interface BurnEstimate {
|
||
model_id: string; provider_id: string;
|
||
credits: number; approx_usd_micros: number;
|
||
keepers_left: number; // remaining renders at current balance
|
||
license_class: "commercial-safe" | "non-commercial" | "territorial";
|
||
deprecated_at?: string | null; // deprecation-aware routing hint
|
||
}
|
||
|
||
// Review payload (review.ts)
|
||
interface ReviewPayload {
|
||
job_id: string;
|
||
variants: ReviewVariant[];
|
||
hook_score: number; // 0..100
|
||
hook_pass: boolean; // >= 70 gate
|
||
predicted_retention: number[]; // per-second 0..1
|
||
cold_open_suggestions: string[];
|
||
quality_flags: ("foreign_watermark" | "letterboxed" | "safe_zone")[];
|
||
shots?: ShotSummary[]; // present for film jobs
|
||
}
|
||
|
||
// Publishing (publishing.ts)
|
||
interface Connection {
|
||
id: string;
|
||
platform: "tiktok" | "instagram" | "youtube" | "x";
|
||
handle: string; healthy: boolean; token_expires_at: string;
|
||
}
|
||
interface PublishRequest {
|
||
job_id: string; targets: string[]; // connection ids
|
||
caption: string; first_comment?: string; hashtags: string[];
|
||
mode: "now" | "schedule" | "experiment";
|
||
scheduled_for?: string; // ISO, account-tz resolved
|
||
trending_audio_id?: string; // relink native sound on upload
|
||
idempotency_key: string;
|
||
}
|
||
|
||
// Scheduler (scheduler.ts)
|
||
interface ScheduledPost {
|
||
id: string; post: PublishRequest; state:
|
||
"queued" | "sending" | "posted" | "failed" | "retrying";
|
||
next_attempt_at?: string; cap_remaining?: Record<string, number>;
|
||
}
|
||
|
||
// Trend (trends.ts)
|
||
interface Trend {
|
||
id: string; type: "audio" | "hashtag" | "creator";
|
||
label: string; saturation: number; // 0..1 rising→peaked
|
||
decay: number; adoption_series: number[];
|
||
ad_safe: boolean; // Meta-compatible for cross-post
|
||
}
|
||
|
||
// Wallet (wallet.ts)
|
||
interface WalletBalance {
|
||
total_micros: number;
|
||
rollover_micros: number; monthly_micros: number; // distinct buckets
|
||
keepers_left_est?: number;
|
||
}
|
||
interface ProvisioningKey {
|
||
id: string; label: string; spend_cap_micros: number;
|
||
spent_micros: number; reset: "daily" | "weekly" | "monthly";
|
||
byok_in_limit: boolean; disabled: boolean;
|
||
}
|
||
|
||
// Marketplace (marketplace.ts)
|
||
interface Campaign {
|
||
id: string; brand: string; cpm_usd_micros: number;
|
||
budget_remaining_micros: number; deadline: string;
|
||
rules: { watermark_required: boolean; asset_url?: string };
|
||
}
|
||
```
|
||
|
||
### 6.1 Endpoints consumed (all `GET`/`POST` over `/api/v1`, envelope-wrapped)
|
||
|
||
| Domain | Representative endpoints |
|
||
| --- | --- |
|
||
| Templates | `GET /templates`, `GET /templates/{id}` |
|
||
| Burn preview | `POST /estimate` |
|
||
| Review | `GET /jobs/{id}/review`, `POST /jobs/{id}/approve` |
|
||
| Shots | `POST /shots/{id}/regenerate` |
|
||
| Publishing | `GET /publishing/connections`, `POST /publishing/oauth/{platform}/start`, `POST /publishing/posts` |
|
||
| Scheduler | `GET /publishing/schedule`, `POST /publishing/schedule`, `GET /publishing/cadence` |
|
||
| Experiments | `GET/POST /experiments`, `GET /experiments/{id}` |
|
||
| Retention | `GET /publishing/posts/{id}/retention` |
|
||
| Trends | `GET /trends`, `GET /trends/{id}` |
|
||
| Clipfarm | `GET /automations/runs`, `POST /automations/runs/{id}/pause` |
|
||
| Series | `GET /series`, `POST /series/{id}/episodes` |
|
||
| Film | `GET /film/projects/{id}`, `GET /film/characters/{id}` |
|
||
| Repurpose | `POST /repurpose`, `GET /repurpose/{id}` |
|
||
| Wallet | `GET /wallet`, `GET /wallet/ledger`, `POST /wallet/topup` |
|
||
| Keys | `GET /gateway/keys` |
|
||
| Plans | `GET /gateway/plan` |
|
||
| Marketplace | `GET /marketplace/campaigns`, `POST /marketplace/submissions`, `GET /marketplace/earnings` |
|
||
| Affiliate | `GET /affiliate` |
|
||
| Devices | `POST /devices` (push token) |
|
||
|
||
---
|
||
|
||
## 7. Integration Seams (into what already exists)
|
||
|
||
| Seam | How new work connects |
|
||
| --- | --- |
|
||
| Transport | All new `resources/*.ts` call the existing `apiRequest`/`ApiError` in `src/shared/api/client.ts`; no new transport. |
|
||
| Auth | Every resource takes `{ token }` from `useSession()`; unchanged `x-api-key` model. |
|
||
| Idempotency | New mutations (approve, publish, schedule, submit, topup) reuse the per-fingerprint idempotency-key pattern extracted from `CreateScreen` into `src/shared/net/idempotency.ts`. |
|
||
| Uploads | Capture feeds the existing presign→PUT→register flow (`lib/api.ts#presignAndUpload`) via the new persistent `upload-queue.ts`; keys flow into `reel-create`. |
|
||
| Create handoff | Templates + trends + review "re-run" build a `JobCreateRequest` seed and route into the existing `reel-create` `CreateScreen` (already accepts prefill params). |
|
||
| Jobs/B-roll | Existing `jobs-library` + `broll-studio` are reachable from the new Studio hub; unchanged. Review deep-links from a job. |
|
||
| Polling | Review/clipfarm/schedule reuse `src/shared/lifecycle/polling.ts` + `app-state.ts` foreground refresh; stop on terminal states. |
|
||
| Notifications | New `push/` + notification center build on the legacy `components/notifications/*` (bell, unread hook) rather than replacing them. |
|
||
| Legacy screens | Existing standalone routes (`app/wallet.tsx`, `app/analytics.tsx`, `app/connections.tsx`, `app/scheduled.tsx`, `app/marketplace.tsx`) are superseded by the richer feature modules; they can redirect to the new routes during migration (kept, not deleted). |
|
||
| Design system | New `src/shared/ui/` centralizes the palette already used inline; legacy `components/me/theme.ts` re-exports from it for consistency. |
|
||
| Contract types | Shared DTOs continue to come from `@reelforge/api-contract`; `resources/schemas.ts` validates + narrows at the device boundary. |
|
||
| One-backend rule | Mobile computes nothing authoritative (no credit math, no watermark logic, no routing) — it renders server truth and refreshes on foreground. |
|
||
|
||
---
|
||
|
||
## 8. Phasing
|
||
|
||
Mirrors the backend build sequencing so the client lands with each server subsystem.
|
||
|
||
- **Phase M1 — Foundation + capture + templates.** `src/shared/ui`, `net`, `cache`, `format`,
|
||
`media/capture`, `resources/{templates,burn-preview,routing}`, `capture/`, `templates/`,
|
||
`onboarding/`. Reuses existing compose/Create. Fastest ROI; ships the empty-screen killer.
|
||
- **Phase M2 — Publish loop.** `push/`, `deep-linking/`, `resources/{publishing,scheduler,
|
||
experiments,retention,devices}`, `publishing/`, `scheduler/`, `experiments/`, `retention/`,
|
||
`notifications/`, `review/`. Completes create→publish→measure→regenerate on device (the wedge).
|
||
- **Phase M3 — Wallet + gateway + growth.** `resources/{wallet,keys,plans,affiliate}`,
|
||
`wallet/`, `plans/`, `affiliate/`, `telemetry/`, `trends/`. Turns the app into a
|
||
self-serve billed platform + top-of-funnel.
|
||
- **Phase M4 — Film-lite + series.** `resources/{film,characters,shots,series}`, `film/`,
|
||
`film/shots/`, `series/`, `studio/` hub. Deep moat; review/approve of the film pipeline.
|
||
- **Phase M5 — Clipfarm + marketplace.** `resources/{clipfarm,marketplace,repurpose}`,
|
||
`clipfarm/`, `marketplace/`, `repurpose/`. Compounding acquisition + on-the-go automation control.
|
||
|
||
---
|
||
|
||
## 9. Testing & Quality (per repo rules, ≥80%)
|
||
|
||
- **Unit:** helpers/hooks (`idempotency`, `tz`, `saturation`, `format/*`, `seed-defaults`,
|
||
`use-quick-fill`, `parse` deep-link Zod) with Jest + `@testing-library/react-native`.
|
||
- **Integration:** resource clients against a mocked `apiRequest` (envelope + error + correlation-id).
|
||
- **E2E:** Maestro/Detox flows for the aha funnel (capture→template→create→review→publish),
|
||
onboarding remix, and schedule-a-post; instrumented via `telemetry/` to assert
|
||
time-to-first-published-clip ≤ 3–5 min.
|