AI-assisted planning for video content — generating prompts, SEO captions, and feeding DiffusionBear (images) and Phosphene (video).
Video Planner is a single-section web application that helps a user plan video content with AI assistance. For now it contains one section — Video Planner — where the user can generate structured prompts and SEO-ready copy for a video project:
Videos are organized under Categories. A category carries a complete, user-written description of its theme/genre. When creating a project, the user selects a category and can ask the AI to explore the category and suggest a main scenario based on it.
Animated preview of a project's end-to-end planning flow (looping).
Google OAuth — allowlisted account only.
Create a category with its full description and optional style guide.
Title, overview, platforms, target duration, and language.
Suggest 3 from the category, or generate from explicit inputs.
Add characters and generate each character prompt.
Generate ordered scene prompts using scenario + character context.
Generate one SEO-optimized caption per selected platform.
Refine, version, revert, and approve the final set.
Access is restricted to a single Google account ([email protected]) during this phase.
AI generation is powered by DeepSeek Flash using a user-supplied API key.
planner.hlmn.app/docs.Three primary components behind an Nginx reverse proxy, all on the same server:
Browser
│
├── https://planner.hlmn.app ──► Nginx ──► Frontend (static SPA)
│ │
│ └──► /docs ──► static HTML (this plan)
│
└── https://api.planner.hlmn.app ─► Nginx ──► Backend API (Node.js)
│
├──► PostgreSQL (localhost)
└──► DeepSeek API (outbound HTTPS)
api.planner.hlmn.app (CORS allowlisted to planner.hlmn.app).| Layer | Choice (proposed) | Notes |
|---|---|---|
| Frontend | React + Vite (TypeScript) | SPA; static build served by Nginx. Routing with React Router. |
| Backend | Node.js + Fastify (TypeScript) | Lightweight, typed. Alternative: Express. |
| Database | PostgreSQL 16 | Hosted on this server; accessed over localhost. |
| ORM | Prisma (or Drizzle) | Schema-first migrations. |
| Auth | Google OAuth 2.0 (Authorization Code flow) | Session via signed httpOnly cookie. |
| AI | DeepSeek API (Flash) | Key from environment; model id configurable. |
| Reverse proxy | Nginx + Let's Encrypt (TLS) | Terminates TLS for both domains. |
| Process manager | PM2 or systemd | Keeps backend running; restart on crash. |
| Item | Value | Purpose |
|---|---|---|
| Frontend domain | planner.hlmn.app | SPA + /docs static page. |
| Backend domain | api.planner.hlmn.app | REST API. |
| PostgreSQL | localhost:5432 | Not publicly exposed. |
| TLS | Let's Encrypt | HTTPS on both domains. |
planner.hlmn.app → not authenticated → redirected to api.planner.hlmn.app/auth/google.api.planner.hlmn.app/auth/google/callback?code=....email against the allowlist.ALLOWED_EMAILS="[email protected]"
Comparison is case-insensitive and trimmed. The allowlist is a comma-separated environment variable so future accounts can be added without code changes.
httpOnly, SameSite=Lax, Secure in production).GET /auth/me returns the current user; the frontend calls it on load.users
id uuid PK
email text UNIQUE NOT NULL
name text
google_sub text UNIQUE -- Google account subject id
avatar_url text
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
categories -- user-defined grouping; also acts as a style template
id uuid PK
user_id uuid FK → users.id
name text NOT NULL
description text NOT NULL -- complete description of the category (drives AI exploration)
style_guide text -- visual/tonal guide applied to every generation in this category
tone text -- default tone (e.g. 'dramatic', 'playful', 'documentary')
default_template text -- optional reusable prompt-structure template
default_language text DEFAULT 'en'
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
projects
id uuid PK
user_id uuid FK → users.id
category_id uuid FK → categories.id -- selected at project creation
title text NOT NULL
overview text -- high-level description / input context
platforms text[] -- selected social media (one or more): 'youtube' | 'tiktok' | 'instagram' | 'shorts' | 'reels'
aspect_ratio text DEFAULT '16:9'-- '16:9' | '9:16' | '1:1'
target_duration_sec integer -- target total runtime
language text DEFAULT 'en' -- output language (inherits category default)
status text DEFAULT 'draft'
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
scenarios -- main scenario (one per project); current/approved version
id uuid PK
project_id uuid FK → projects.id UNIQUE
input jsonb -- user inputs used for generation
prompt text -- current main-scenario prompt
status text DEFAULT 'draft' -- 'draft' | 'approved'
model text -- model id used
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
scenario_suggestions -- AI candidates from a category-based suggest request
id uuid PK
project_id uuid FK → projects.id
content text -- candidate scenario (logline + pitch)
status text DEFAULT 'draft' -- 'draft' | 'accepted' | 'rejected'
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
characters
id uuid PK
project_id uuid FK → projects.id
name text
input jsonb -- user inputs (role, traits, etc.)
prompt text -- current character prompt
status text DEFAULT 'draft' -- 'draft' | 'approved'
model text
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
scenes
id uuid PK
project_id uuid FK → projects.id
scenario_id uuid FK → scenarios.id -- optional link
title text
order_index integer NOT NULL DEFAULT 0
duration_sec integer -- planned scene length
input jsonb
prompt text -- current scene prompt
status text DEFAULT 'draft' -- 'draft' | 'approved'
model text
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
captions -- one SEO caption per selected platform
id uuid PK
project_id uuid FK → projects.id
platform text NOT NULL -- 'youtube' | 'tiktok' | 'instagram' | 'shorts' | 'reels'
content text -- SEO-optimized caption (hook + body + CTA)
hashtags text[] -- suggested hashtags
keywords text[] -- SEO keywords used
status text DEFAULT 'draft' -- 'draft' | 'approved'
model text
created_at timestamptz NOT NULL DEFAULT now()
updated_at timestamptz NOT NULL DEFAULT now()
UNIQUE (project_id, platform)
prompt_versions -- full history for every artifact (refine / revert)
id uuid PK
project_id uuid FK → projects.id
artifact_type text -- 'scenario' | 'character' | 'scene' | 'caption'
artifact_id uuid -- id of the artifact row
version_no integer NOT NULL
content text NOT NULL
instruction text -- refine instruction that produced this version (null = initial)
model text
created_at timestamptz NOT NULL DEFAULT now()
generation_logs -- optional audit/history of AI calls
id uuid PK
project_id uuid FK → projects.id
user_id uuid FK → users.id
type text -- 'scenario' | 'scenario_suggestion' | 'character' | 'scene'
model text
prompt_tokens integer
completion_tokens integer
created_at timestamptz NOT NULL DEFAULT now()
User
├── Category (0..N) -- user-defined; carries a full description
│
└── Project (video project)
├── Category (selected) -- chosen at project creation
├── Scenario (main scenario, 1 per project)
├── Character (0..N)
├── Scene (0..N, ordered, optionally linked to the scenario)
└── Caption (0..N, one per selected platform)
A Category holds a complete description of a video theme/genre and is reusable across
projects; it also carries the style template (style guide, tone, default template, default
language). A Project is the top-level container and references one category at creation,
plus the platform/aspect/duration/language targets; the main scenario can be suggested from that category.
Generating a scene can reference the project's scenario and selected characters as context, so
scene prompts stay consistent with the story. Captions are generated per selected platform
with platform-specific SEO rules. Every artifact (including each platform caption) keeps a full
version history (prompt_versions) so it can be refined and reverted.
DEEPSEEK_API_KEY.DEEPSEEK_API_KEY="sk-..."
DEEPSEEK_BASE_URL="https://api.deepseek.com" # default
DEEPSEEK_MODEL="deepseek-flash" # confirm exact id
Each artifact type uses a dedicated system prompt (template) plus the user's inputs. The templates live server-side so they can be tuned without a frontend deploy.
Inputs: topic/theme, genre, audience, tone, duration, any reference notes.
Output: a structured scenario prompt (logline, setting, conflict, acts/beats).
Inputs: the project's selected category (full description) + the project overview. Each request returns 3 candidate scenarios by default.
The AI explores the category description (themes, audience, conventions, angles) and proposes one or more main-scenario directions. The user picks a suggestion, then refines and saves it as the project's main scenario. This is a separate action from the manual "Generate" in 10.1.
Output: candidate scenario(s) (logline + short pitch); the accepted one becomes the project scenario.
Inputs: name, role, appearance, personality, motivation, relation to story.
Output: a character prompt (identity, visual description, personality, arc).
Inputs: title, location, action summary, characters involved, mood; plus optional scenario context.
Output: a scene prompt (setting, action, dialogue direction, camera/visual style).
Inputs: the project's scenario + character/scene context, the category style, the output language, and the selected platform.
One caption is generated per selected platform, structured as hook → body → call-to-action → hashtags and optimized for search/discovery on that platform:
Output: caption text + extracted keywords + hashtags, stored per platform; editable, versioned, and approvable like other artifacts.
Every generation, edit, or refinement writes a new row to prompt_versions; the artifact keeps
the current content while the full history is retained.
Every generation is enriched with project/category context so output stays consistent:
style_guide and tone (plus optional default_template) are injected into every prompt. A style guide is optional; when absent, generation relies on the category description alone.platforms (multi-select), aspect_ratio, and target_duration_sec shape pacing and structure. Presets: YouTube (16:9, long-form) and Shorts / TikTok / Instagram Reels (9:16, 15–60s). Choosing a platform auto-sets aspect ratio + typical duration (still editable).language, which defaults to the category's default_language; the project can override it.target_duration_sec the UI shows a non-blocking warning (never blocks saving).draft; only an explicit "Accept" promotes one to the project scenario. The same draft → approved status applies to characters, scenes, and captions.Base URL: https://api.planner.hlmn.app. All routes except auth require a valid session.
| Method | Path | Description |
|---|---|---|
| GET | /auth/google | Start Google OAuth. |
| GET | /auth/google/callback | OAuth callback + allowlist check. |
| GET | /auth/me | Current user. |
| POST | /auth/logout | Destroy session. |
| GET | /api/categories | List categories. |
| POST | /api/categories | Create category (name, description, style guide, tone, template, language). |
| PATCH | /api/categories/:id | Update category. |
| DELETE | /api/categories/:id | Delete category. |
| GET | /api/projects | List user's projects. |
| POST | /api/projects | Create project (category, platform, aspect ratio, target duration, language). |
| GET | /api/projects/:id | Get project + artifacts. |
| PATCH | /api/projects/:id | Update project. |
| DELETE | /api/projects/:id | Delete project (cascades). |
| GET | /api/projects/:id/scenario | Get main scenario. |
| POST | /api/projects/:id/scenario/generate | Generate/regenerate scenario from explicit inputs. |
| POST | /api/projects/:id/scenario/suggest | AI explores the category and returns draft suggestion(s). |
| GET | /api/projects/:id/scenario/suggestions | List scenario suggestions + status. |
| POST | /api/projects/:id/scenario/suggestions/:sid/accept | Accept a suggestion as the project scenario. |
| POST | /api/projects/:id/scenario/refine | Refine scenario with an instruction (new version). |
| GET | /api/projects/:id/scenario/versions | List scenario versions. |
| POST | /api/projects/:id/scenario/versions/:vid/revert | Revert scenario to a version. |
| POST | /api/projects/:id/scenario/approve | Mark scenario approved. |
| PATCH | /api/projects/:id/scenario | Save a manual edit (recorded as a new version). |
| GET | /api/projects/:id/characters | List characters. |
| POST | /api/projects/:id/characters | Create character. |
| POST | /api/projects/:id/characters/:cid/generate | Generate character prompt. |
| POST | /api/projects/:id/characters/:cid/refine | Refine the character prompt (new version). |
| GET | /api/projects/:id/characters/:cid/versions | List character prompt versions. |
| POST | /api/projects/:id/characters/:cid/approve | Mark character approved. |
| PATCH | /api/projects/:id/characters/:cid | Save a manual edit (recorded as a new version). |
| GET | /api/projects/:id/scenes | List scenes (ordered). |
| POST | /api/projects/:id/scenes | Create scene. |
| POST | /api/projects/:id/scenes/:sid/generate | Generate scene prompt. |
| POST | /api/projects/:id/scenes/:sid/refine | Refine the scene prompt (new version). |
| GET | /api/projects/:id/scenes/:sid/versions | List scene prompt versions. |
| POST | /api/projects/:id/scenes/:sid/approve | Mark scene approved. |
| PATCH | /api/projects/:id/scenes/:sid | Save a manual edit (recorded as a new version). |
| PATCH | /api/projects/:id/scenes/reorder | Reorder scenes. |
| GET | /api/projects/:id/captions | List captions (one per selected platform). |
| POST | /api/projects/:id/captions/generate | Generate SEO captions for the selected platform(s). |
| POST | /api/projects/:id/captions/:platform/refine | Refine a platform caption (new version). |
| GET | /api/projects/:id/captions/:platform/versions | List caption versions. |
| POST | /api/projects/:id/captions/:platform/approve | Mark caption approved. |
| PATCH | /api/projects/:id/captions/:platform | Save a manual caption edit (new version). |
| Route | Content |
|---|---|
/login | Sign in with Google button (or auto-redirect). |
/ | Dashboard: list of projects, "New project" action. |
/categories | Manage categories: name, description, style guide, tone, default template, default language. |
/projects/:id | Editor with tabs: Scenario (inputs, "Suggest from category" → 3 drafts, accept/reject, refine, manual edit), Characters, Scenes, Captions (one SEO caption per selected platform). Shared header: platforms (multi-select, auto-fills aspect ratio + typical duration) / target duration / language; per-artifact version history and approve toggle; non-blocking duration warning when scene durations don't sum to the target. |
/docs | This plan document (static HTML). |
/unauthorized | Shown when login email is not allowlisted. |
This plan document is a static HTML file. Nginx serves it at planner.hlmn.app/docs
(directory index or a dedicated location /docs block), independent of the SPA so it
loads even when the app is not authenticated.
location /docs {
alias /var/www/video-planner/docs;
index index.html;
}
https://api.planner.hlmn.app/auth/google/callback.# Backend environment
DATABASE_URL="postgresql://app:...@localhost:5432/video_planner"
GOOGLE_CLIENT_ID="..."
GOOGLE_CLIENT_SECRET="..."
GOOGLE_REDIRECT_URI="https://api.planner.hlmn.app/auth/google/callback"
ALLOWED_EMAILS="[email protected]"
DEEPSEEK_API_KEY="sk-..."
DEEPSEEK_MODEL="deepseek-flash"
SESSION_SECRET="..."
FRONTEND_URL="https://planner.hlmn.app"
httpOnly, Secure, SameSite=Lax.https://planner.hlmn.app.| # | Milestone | Deliverable |
|---|---|---|
| 1 | Infrastructure | Domains, Nginx, TLS, PostgreSQL running. |
| 2 | Authentication | Google OAuth + allowlist working. |
| 3 | Data layer | Schema migrated; CRUD for categories, projects, and artifacts. |
| 4 | AI integration | DeepSeek generation + refinement/versioning for scenario (incl. category suggestion), character, scene, and per-platform SEO captions. |
| 5 | Frontend | Video Planner UI (dashboard + editor, version history, approve flow, style template, platform/duration, captions). |
| 6 | Docs | This page live at planner.hlmn.app/docs. |
| 7 | Hardening | Error handling, logging, basic tests. |
default_language; the project can override.target_duration_sec.