Skip to content

About

A broadcast-media asset studio built on Google Gemini: campaign templates fanned out across stations, photo expansion, brand preflight, and governed AI credits.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

StationForge

A broadcast-media asset studio built on Google Gemini: one campaign template fanned out across every station's own brand rules, photo expansion for stretched photoshoots, automated brand preflight before anything airs, and a governed per-user/per-station AI credit system.

Live showcase (GitHub Pages) — a fully interactive replica of the real UI on sample data, no backend required. Every screen works: browse the library, pick an asset and generate (Expand/Variations/Reimagine/Edit), pick a template and Bulk Generate across stations, run Preflight and approve/reject in Review, edit a station's brand settings.

What it does

A regional broadcast group with dozens of local stations shares one creative team but needs every asset compliant with each station's own logo, legal line, colors, and aspect ratio. StationForge is the workflow layer that makes that scale without multiplying the work:

  1. Content Scale — compose one campaign template once; the shared background is generated a single time and reused, while each station's locked brand elements (logo, legal line, color) are composited per station, not regenerated.
  2. Studio — Expand, Variations, Reimagine, and Edit modes turn a handful of usable photoshoot frames into every ratio and placement a campaign actually needs.
  3. Preflight — a deterministic rule engine (dimensions, campaign, keywords, template conformance) plus an AI vision check score every asset against the station's real brand guidelines before it can be submitted.
  4. Content Credentials — a C2PA-style provenance record, issued automatically once an asset clears approval, discloses model, mode, and prompt.
  5. AI Credits — every generation draws down two linked budgets at once: a personal monthly allocation carved out of a station's (or the shared HQ's) pool, with a request/approval flow when either runs low.
  6. Station Settings — the brand guidelines everything above is checked against: colors, approved fonts, legal line, default and approved aspect ratios, and the preflight pass threshold, all per station.

Tech stack

Layer Tech
Frontend Next.js 14 (App Router), TypeScript, Tailwind CSS
Backend Node.js, Express.js
Database MongoDB + Mongoose
Storage Google Cloud Storage
AI generation Google Gemini (Vertex AI), image generation + vision
Auth Passwordless, one-time email codes, JWT session cookies

Architecture

flowchart LR
    subgraph client["Next.js Web App"]
        studioUI["Studio"]
        libUI["Asset Library"]
        reviewUI["Review"]
        settingsUI["Station Settings"]
        creditsUI["AI Credits"]
    end

    subgraph api["Express API"]
        authC["auth.controller"]
        geminiC["gemini.controller"]
        tmplC["campaigntemplates.controller"]
        assetsC["assets.controller"]
        reviewC["review.controller"]
        creditsC["credits.controller"]
        stationsC["stations.controller"]
    end

    subgraph services["Services"]
        imagen["imagen.service"]
        preflight["preflight.service"]
        creds["contentCredentials.service"]
        creditsSvc["credits.service"]
        gcsSvc["gcs.service"]
        compositor["compositor.service"]
    end

    subgraph gcp["Google Cloud"]
        gemini[("Gemini · Vertex AI")]
        bucket[("Cloud Storage")]
    end

    mongo[("MongoDB")]

    client -->|"REST, JWT cookie"| api

    geminiC --> imagen
    geminiC --> creds
    geminiC --> creditsSvc
    tmplC --> imagen
    tmplC --> compositor
    tmplC --> creds
    tmplC --> creditsSvc
    reviewC --> preflight
    assetsC --> gcsSvc
    creditsC --> creditsSvc
    stationsC --> mongo

    imagen --> gemini
    preflight --> gemini
    imagen --> gcsSvc
    compositor --> gcsSvc
    gcsSvc --> bucket

    api --> mongo
Loading

Every generation call, single-image or template-driven, goes through imagen.service.js to Gemini on Vertex AI. Preflight's AI vision check is a second, independent Gemini call scored against the station's own brand guidelines pulled from MongoDB. Generated and uploaded assets live in Cloud Storage; everything else, lineage, brand settings, credit pools, review status, lives in MongoDB.

Project structure

stationforge/
├── apps/
│   ├── web/                    # Next.js 14 app
│   │   ├── app/
│   │   │   ├── studio/         # Unified browser + Expand/Variations/Reimagine/Edit + template compose
│   │   │   ├── assets/         # Asset library + detail (lineage, preflight)
│   │   │   ├── drafts/         # A user's own in-progress generations
│   │   │   ├── review/         # Approval queue + Preflight panel
│   │   │   ├── credits/        # Personal + station credit pools
│   │   │   ├── settings/       # Station brand settings
│   │   │   └── admin/users/    # User access management
│   │   ├── components/
│   │   └── lib/                # API client, formatting helpers
│   │
│   └── api/                    # Express.js API
│       ├── controllers/
│       │   ├── gemini.controller.js             # Expand/Variations/Reimagine/Edit
│       │   ├── campaigntemplates.controller.js  # Template compose + bulk fan-out
│       │   ├── assets.controller.js
│       │   ├── review.controller.js             # Preflight + approve/reject
│       │   ├── credits.controller.js
│       │   ├── stations.controller.js
│       │   ├── admin.controller.js
│       │   └── auth.controller.js               # Passwordless, one-time codes
│       ├── models/
│       │   ├── Asset.js                # Generation lineage, Content Credentials
│       │   ├── CampaignTemplate.js     # Locked vs. variable regions
│       │   ├── Station.js              # Brand guidelines per station
│       │   ├── CreditPool.js
│       │   ├── CreditRequest.js
│       │   └── UserCreditAllocation.js
│       └── services/
│           ├── imagen.service.js               # Gemini image generation calls
│           ├── preflight.service.js            # Rule engine + AI vision check
│           ├── contentCredentials.service.js
│           ├── credits.service.js
│           ├── compositor.service.js           # Locked/variable region composite
│           ├── gcs.service.js
│           └── mediaClassification.service.js
│
└── docs/                        # GitHub Pages showcase (this repo's live demo)
    ├── index.html               # Fully interactive UI replica, sample data only
    ├── data.json                # Sample stations, assets, templates, review queue
    └── assets/                  # Real images, generated fresh through the actual
                                  # Gemini pipeline specifically for this repo

Key flows

Content Scale (one template, every station)

Creative director builds a campaign template
  → Locked regions (logo, legal line, brand color) vs. variable regions (headline, background)
  → One background generation, shared across every selected station
  → Per-station composite: locked regions filled from each station's own brand settings
  → N station-compliant assets from one generation

Photo Studio (Expand / Variations / Reimagine / Edit)

User picks a source photo → picks a mode → directs it (ratio + optional prompt)
  → POST /api/gemini/expand (or /variations, /reimagine, /edit)
    → Gemini image generation
    → Content Credentials drafted (pending, issued on approval)
  → Result lands in Drafts, ready for Preflight and Review

Preflight

Run Preflight Check
  → Rule engine: dimensions, campaign, keywords, template conformance
  → AI vision check: visual quality, composition, text legibility, safe zones,
    broadcast quality, brand & campaign alignment, scored against the
    station's real brand guidelines
  → Score starts at 100, critical fail -25, non-critical fail -10, warning -5
  → Pass / warning / fail against the station's own threshold

Review

Reviewer opens the queue, sorted by submission
  → Preflight score badge visible per asset (or "not yet checked")
  → Expand to see the full rule engine + AI vision breakdown
  → Approve → asset joins the shared library
  → Request Changes → back to the submitter, with the failing checks attached
  → A critical failure blocks Approve entirely until it's re-run and clears

AI Credits

Every generation checks BOTH balances before spending either:
  Personal allocation (inside a station's monthly pool)
  Station pool (or the shared HQ pool, for admins/creative directors)
  → Blocked if either would go negative
  → Running low → request more (personal, or a station-wide top-up)
  → Approved by a station lead, creative director, or admin,
    personal top-ups capped by the pool's own unclaimed buffer

Running locally

npm install --workspaces --include-workspace-root
cp .env.example apps/api/.env
# fill in GCS_PROJECT_ID, GOOGLE_APPLICATION_CREDENTIALS, MONGODB_URI

npm run dev

Or via Docker:

docker-compose up

About this repo

This is a sanitized, public version of a private client demo, with the client-specific presentation deck removed and all client/vendor branding replaced. The docs/ folder is a hand-built, fully interactive static replica of the real UI for GitHub Pages; it does not call the real API, holds no real credentials, and every asset shown is sample data, including images generated fresh through the actual Gemini pipeline specifically for this repo.

About

A broadcast-media asset studio built on Google Gemini: campaign templates fanned out across stations, photo expansion, brand preflight, and governed AI credits.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages