Content OS

Admin Console — App Flows

Where the work happens. ~60 screens — pages only: every /api/* call is a wildcard rewrite to apps/backend/, and the background workers run there too.

Code: apps/admin-app/ · Port: 3000 · Access: admin only Back to apps index · Marketing OS


Who uses it

Content teams, reviewers and admins working inside a workspace. Everything is tenant-scoped, and each tenant owns its own physical database, selected by a signed claim in the session — never by anything a client sends. A user carries workspaceIds[], every workspace they may reach; when they hold more than one, a workspace switcher appears in the sidebar, and switching keeps the current page.


Sign in

email + password
      |
rate limit: 10 attempts per IP        <- checkRateLimit, before any lookup
      |
control-DB users  ->  verify scrypt hash
      |
HS256 token issued as a cookie        <- by apps/backend/, the only signer
      |
admin-only console

Standalone auth — the platform owns its own credentials and sessions. No refresh tokens, no revocation. Fails closed if JWT_SECRET is unset.

All of that happens in apps/backend/. The console holds no JWT_SECRET and no crypto: it reads the session from GET /api/auth/session, and its middleware only checks whether a session cookie exists so it knows to render or redirect to /login. Permissions arrive on that response already expanded from the role catalog, so the console never expands them a second time.

In dev you can skip it: ALLOW_DEV_AUTH=true plus CONTENT_ENGINE_DEV_ADMIN_ID, with NODE_ENV not production.


The six things you actually do

1. Set the tenant up

One-time, then rarely touched. Sources, audience personas and SEO keywords feed discovery; guidelines and the compliance rulebook constrain everything generated afterwards.

ScreenSets
SourcesNews sources, crawl config, search discovery
AudiencePersonas — matched deterministically against every article
KeywordsSEO inventory with live Semrush metrics — per-tenant credentials in Settings → Semrush, refreshed by a worker only — plus gap analysis into blog topics, and the AnswerThePublic searches left this month
GuidelinesBrand voice, avoid list, the blog master prompt, image direction and palette
FrameworksScript frameworks, hook styles and CTA styles — an allowlist for generation once authored
Compliance IntelligenceThe AI reviewer's rulebook, up to 40 authored rules
GenerationDiscovery providers and fetch budget, article extractor, feed enrichment mode, blog benchmarks, campaign image model / quality / text mode
SettingsCMS integration and the other stored credentials — all encrypted under one platform key, admin-only to write

2. Find something worth writing about

cron: daily morning sweep  ->  /api/internal/news-fetch
      |                        (bearer secret, fails closed)
queue a durable fetch run per enabled tenant
      |
news-fetch worker drains it
      |
crawl sources + optional search-first discovery
      |
isArticleShapedUrl gate        <- rejects landing and hub pages
      |
rows land: enrichmentStatus "pending"
      |
feed-enrichment worker (~2s poll, one item at a time)
      |
summary - category - geo - keywords - scores      [Discovery Agent]
      |
Discovery feed, browsable

The same sweep also refreshes competitor reels per enabled tenant, unawaited — it is a paid scrape that can run for minutes.

An article worth keeping but not acting on yet can be bookmarked — per-user saves with blog/script tags, filterable in the feed as My saves or Team saves. Rejecting one requires a reason from a fixed vocabulary; those reasons feed the compliance feedback learning agent, whose read of reviewer behaviour lands on the Review Insights page.

3. Make a script

Create -> Daily Studio
      |
fetch fresh pieces; the last 24 hours, same count on every step; you pick
      |
set audience - platform - category - framework / hook / CTA
      |
POST /scripts/generate   ->  202: queued
      |                        (content_script_queue + content_generation_jobs)
      |
backend api-worker: concurrency 2, 3 attempts, stale jobs reclaimed
      |
hook formula enforced + cooldown against recent openings
      |
status step: live queue state per piece  ->  Scripts page Queue / Generated tabs
      |
versions - regenerate (framework picks + instructions) - scene patch - history
      |
approve  ->  calendar        Generate video  ->  Campaign Creatives, prefilled at that cut

Every generate route enqueues and answers 202 — the console polls the queue through ScriptQueueProvider (4s while anything is active, with toasts and an activity-dock pill), so a page refresh loses nothing: the state lives on the server, not in the tab.

Stops at the calendar. Nothing posts. Finished scripts — and blog drafts — export as docx/pdf, singly or multi-selected into one zip (or separate files, or one combined file) from a shared export dialog. A draft is authored at 45s, 60s, 90s or 120s; 15s and 30s are cut down from it in the studio.

4. Make a blog

queue a news item
      |
autoProcessBlogQueueItems     <- background, unattended
      |
draft -> quality repair -> SEO bolding -> ZeroGPT humanize -> blocked-phrase scan
      |
state: "ready"                <- STOPS HERE
      |
[human] Compliance -> acknowledge high-severity findings
      |
[human] Send to CMS           <- 409 at the route while the gate is unclear

Two human gates, both deliberate. The compliance verdict marks evidence phrases inline in the editor; an edit bumps the draft version and re-gates delivery, and Send re-runs the agent once when the verdict is stale so delivery is judged against the text actually going out.

From a marked phrase, Ask AI to fix returns a block-level Before/After in the chat rather than a whole rewritten article; accepting it clears that finding for as long as the flagged phrase stays gone. Not an issue additionally teaches a learned exception, so the same judgement is recognised on the next draft instead of being re-argued — as a badge and a one-click resolve, never as a suppressed finding, and never by editing the authored rulebook.

5. Make a creative

Campaign Creatives  ->  Create new / Use template
      |
context: brief, or a Discovery article (resolved server-side), or a blog
      |
assets: image cards (format, ratios, languages, tone, references) - video cards (ratio, platform, cut)
      |
name the campaign before it runs; POST campaign/image  ->  202 per asset
      |
campaign-image worker: one plate per ratio, every language composed on each
      |
video asset = storyboard: frames  ->  [human] approve  ->  2-clip motion test  ->  [human] approve  ->  clips
      |
campaign workspace: asset rail - canvas - chat
      regenerate (steerable) - add language - add slide - add size    <- priced by a dry run first
      |
Assets library: creatives, text-free plates, frames, clips, logos, references

A campaign is one brief and several assets, worked on one page (/tenants/[id]/campaigns/[campaignId]). Every asset carries its own languages and, for images, several aspect ratios; a language can be added to a finished asset by re-lettering the same picture, and one edition's words can be redone alone. A campaign saves as a template and replays against a new brief. Copy is scanned against the tenant's blocked phrases on every run and can be sent to the compliance agent on demand. Video renders nothing expensive until a human has approved a still of it; clips download per scene, nothing assembles them, and the provider's clip call has not yet been exercised against a live account.

6. Review and govern

ScreenJob
ApprovalsTeam-lead queue of work items
Compliance ReviewPending acknowledgements across Discovery, in one place (sidebar entry hidden since 31 August 2026; the page still works)
Compliance ExceptionsJudgements reviewers already made, learned from dismissals. Arm one and the agent is told about it
Content GovernanceAdmin toggles that gate CMS delivery and scheduling
UsersPer-company user CRUD — who signs in, which roles and permissions they hold; platform admins manage multi-workspace users on /users
Review InsightsWhy articles get rejected, and what the learning agent reads into reviewer behaviour — under Learning
Page VisibilityWhich nav pages a tenant sees at all

Intelligence, running underneath

  • Instagram learning — OAuth connect, then a cron sync (/api/internal/instagram-sync) feeding reel analysis and the v2 learning profile. Supplies hook formulas back into script generation.
  • Competitor analysis — own profile in the learning store, competitors in ops_ca_*, bridged by buildComparison behind an 8s timeout so a slow Instagram call can never blank the page.

What runs without anyone clicking

Not this app: the workers live in apps/backend/src/jobs/, started by the dedicated worker process (apps/backend/src/worker.ts). The console cannot run one — instrumentation.ts is deleted and the disable gates are baked into its Dockerfile.

WorkerDoes
Generation (jobs/worker.ts)Drains content_generation_jobs — blogs and scripts — concurrency 2, stale jobs reclaimed after 60s
News fetch (news-fetch-worker.ts)Drains queued fetch runs
Feed enrichment (feed-enrichment-worker.ts)Enriches pending feed items
Creator stats (creator-stats-worker.ts)Refreshes creator platform stats
Source profiler (source-profile-worker.ts)Learns and verifies per-source scrape rules
Compliance report (compliance-report-worker.ts)Regenerates the reviewer-behaviour pattern report
Creative report (creative-report-worker.ts)Regenerates the creative-studio pattern report; sweeps bytes of versions deleted over 30 days ago
Keyword refresh (keyword-refresh-worker.ts)Semrush rank and volume refresh, per tenant cadence
Approval reconciler (approval-reconciler.ts)Sweeps for gateable content missing its approval row and creates the pending row
Campaign image (campaign-image-worker.ts)Runs queued campaign generations on its own lane — an image run holds a slot for minutes
Video storyboard (video-storyboard-worker.ts)Submits and polls frames and clips for approved shots; claims a shot before the network call so a race never bills it twice

Every loop stamps a heartbeat, so a dead one is an alert (WorkerStalled) rather than a growing queue. Plus a queue-depth and pipeline-backlog metrics sampler and two Coolify crons posting to /api/internal/* with bearer secrets. Those routes bypass the session gate and authenticate on their own secret, failing closed when it is unset.


Navigation

Four groups, split by what you are doing rather than by permission, with Create as its own button above them:

Library (Scripts, Blogs, Campaign Creatives, Assets, Calendar) · Produce (Create, Hooks, Discovery) · Insights (Learning, Competitor Analysis) · Intelligence — a collapsible submenu holding the tenant's AI brain (Guidelines, Frameworks, Compliance Intelligence, Compliance Exceptions, Configs, Generation, Sources, Keywords, Audience)

Approvals, Users, Compliance Review and Review Insights are pages without sidebar entries — still permission-gated, reached from the client portal, the Settings tabs, a direct link and the Learning page respectively. Each page declares the permission it needs, so visibility and access stay in one definition (apps/admin-app/src/lib/auth/nav-pages.ts, byte-mirrored in the backend).


Where it stops

  • Nothing publishes to social. Scripts reach the calendar; posting is manual.
  • Only blogs reach an external system, and only on a human click.
  • Video stops at per-scene clips. Two human gates before anything expensive renders; nothing assembles the result, and the clip provider is unverified live.
  • Scripts get no AI compliance review — the deterministic keyword scan only. Campaign copy gets the blocked-phrase scan on every run and the agent on demand.
  • No customer data. Everything here is content production; the lifecycle programs in Program have nothing to run on.
Source: roadmap/apps/admin-app.md