# Render Zero / AI Studio — Recovered Product Requirements (from chat + code snapshots)

## 1) What this reconstruction is based on

This is reconstructed from:
- The **full available chat history captured by the assistant** for Telegram group `Renderzero id:-5038635282` (Mar 25, 2026).
- Recovered code snapshots from that same debugging session (repo path that was used then: `/home/usr1/code2/gumroadProducts/studio-app`, now deleted).

> Important: only assistant-visible/group-mentioned messages were available in logs, so this is a **high-confidence technical reconstruction**, but may still miss business context that happened in non-captured chat.

---

## 2) Product identity

- Working product name in UI: **AI Studio**
- Group/project context name: **Render Zero / Renderzero**
- Product type: **AI media generation studio** (image + video) with **library/gallery management**
- Platform:
  - Primary: **Electron desktop app**
  - Also supports web/dev mode behavior for API keys and generation calls

---

## 3) Main user-facing areas

## 3.1 Global navigation (header)
Top navigation includes:
- **Studio**
- **Gallery**
- **Settings**

Header also shows API status badge:
- `API Connected` when at least one provider key exists
- `No API Keys` otherwise

## 3.2 Studio view
Studio has tabbed modes:
- **Image** mode (Prompt Builder + Canvas)
- **Video** mode (VideoGenerator panel)

### Image mode layout
- Left sidebar: Prompt Builder controls
- Right/main: generation canvas and result area

### Prompt Builder sections (explicit component structure)
- Subject/Framing
- Lighting/Mood
- Camera/Gear
- Style/Aesthetics
- Output Settings

### Canvas states
- Empty state: “No image generated yet”
- Loading state: spinner + progress bar
- Error state: “Generation failed” + error message
- Success state: primary generated image with action buttons

### Canvas actions
- **Generate** (main button)
- **Scene Variations** (button + thumbnail section)
- **Copy Prompt**
- **Copy JSON** (prompt parts)
- On generated image:
  - **Enlarge** (open modal/lightbox)
  - **Download**

---

## 4) Generation requirements

## 4.1 Providers supported
Three image providers are integrated:
- **Fal.ai**
- **Google**
- **OpenRouter**

Provider selection logic:
- Uses preferred provider setting if present.
- Otherwise fallback priority: `fal` -> `openrouter` -> `google` (based on available keys).

## 4.2 API key behavior
- Electron mode: API key lookup via IPC/store + env fallbacks.
- Web mode: API keys from localStorage (`apikey_fal`, `apikey_google`, `apikey_openrouter`).

## 4.3 Image generation constraints
- Generate is enabled only when:
  - At least one API key exists, and
  - Prompt subject is non-empty.

Generation parameters include:
- prompt
- model
- resolution (1K / 2K / 4K)
- aspect ratio (includes 1:1, 16:9, 9:16, 4:3, 3:4, 21:9)

Default models seen in logic:
- Fal: `fal-ai/flux/dev`
- OpenRouter: `google/gemini-2.5-flash-image`
- Google: `google/imagen-3.0-generate-001` (selection layer) + Imagen endpoint usage in service layer

## 4.4 Video generation
Fal video models listed:
- `fal-ai/kling-video/v3/pro/text-to-video`
- `fal-ai/kling-video/v3/standard/text-to-video`
- `fal-ai/ltx-2/text-to-video`

Video generation supports:
- prompt
- model
- optional image input (for some paths)
- duration
- audio generation flag
- polling for async completion

---

## 5) Gallery / Library requirements

## 5.1 Gallery structure
- Left panel: **ProjectFolder** (project/library navigation)
- Right panel: **GalleryGrid**
- Image lightbox on image selection

## 5.2 Projects
Project panel requirements:
- Show **All Images** bucket
- Show list of projects with image counts
- Allow creating project from:
  - header “New” button
  - empty-state “+ Create Project” button
- Select project to filter gallery

Project model fields:
- `id`
- `name`
- `createdAt`
- `imageCount`

## 5.3 Gallery grid/list behavior
- View modes: grid/list
- Search by prompt/model
- Filter by model
- Sort options:
  - Newest First
  - Oldest First
  - Name A-Z
  - Name Z-A
- Card actions:
  - favorite/unfavorite
  - expand/lightbox
  - delete

Image model fields:
- `id`
- `filepath`
- `thumbnail`
- `prompt`
- `provider`
- `model`
- `resolution`
- `aspectRatio`
- `createdAt`
- `projectId`
- `isFavorite`
- `metadata`

## 5.4 Library population requirement (critical)
From recovered fix behavior:
- On successful generation, generated image must be added to library.
- If no project selected, create/use default project **“My Library”** (`project-default`) and attach image there.

This directly addresses the user complaint: projects/library appearing empty despite generation.

---

## 6) Electron/IPC and local persistence requirements

Electron API surface includes:
- API key get/set/delete/has
- File operations: save/load/list/delete images
- Project create/list
- app data path
- generation: image/video/variations
- settings get/set/getAll

Filesystem conventions (from IPC handlers):
- App data root: `<userData>/studio-data`
- Images: `<root>/images[/<projectId>]`
- Projects metadata: `<root>/projects/<project>/meta.json`

---

## 7) Known bugs from recovered chat + fixes applied at that time

## Bug A — Enlarge/Download buttons in image generation canvas not working
User report: top-right icons in generated image did nothing.

Recovered root cause:
- Canvas rendered icon buttons visually but without handlers in that area.

Recovered fix:
- Switched to `ImageCanvas` component with wired handlers.
- Added download implementation:
  - fetch image
  - blob -> object URL
  - anchor click download (`renderzero-<timestamp>.png`)
  - fallback open in new tab

## Bug B — No clear way to add projects / library looked empty
User report: no visible option to add projects in gallery/library.

Recovered fix:
- Project panel made explicit (`Library Projects` + visible `New` action + empty-state create CTA).
- Generated images auto-added to library (default “My Library” if none selected).

---

## 8) Rebuild checklist (practical)

1. Recreate app shell (Header + 3 views: Studio/Gallery/Settings).
2. Rebuild prompt builder and prompt engine.
3. Rebuild image generation flow with Fal/OpenRouter/Google support.
4. Implement canvas states + image actions (enlarge/download/copy prompt/json).
5. Rebuild video generation path via Fal queue polling.
6. Rebuild gallery store + project folder + grid/list + lightbox.
7. Ensure generation -> gallery/library insertion logic is working.
8. Implement Electron IPC bridge and file/project persistence.
9. Add API key settings and provider fallback logic.
10. Verify with E2E cases:
   - Enlarge works
   - Download works
   - Generate creates gallery image
   - Default project auto-created when needed

---

## 9) Gaps / unknowns to confirm with team

- Full business/product narrative (branding, roadmap, target customer).
- Any premium/auth/account model (not present in recovered snapshot).
- Any backend beyond direct provider APIs.
- Exact persistence expectations for gallery (in-memory vs mandatory disk sync in all paths).

---

## 10) Confidence rating

- **High confidence**: UI structure, provider stack, generation flow, gallery/project behavior, and bug/fix history above.
- **Medium confidence**: long-term persistence semantics and non-captured business requirements.
