Skip to content
Johan Peña

AI tool · Private content workflowDeployed

Content OS

A private tool that turns a topic into a ready-to-record script, a carousel and a publishing slot — and then follows each post to the DMs and clients it brought in.

Private tool · screenshots onlyPrivate repository

Content OS is a private tool in daily use and has no public access. The screenshots come from a local copy filled with demo data; names, leads and numbers in them are fictional.

Overview

Content OS runs the content side of a fitness coaching brand. Language models write the scripts, carousels, hooks, captions and DM replies from the creator's profile, offer and real client results; the rest of the app plans the calendar, sends reminders, tracks leads from first DM to client, and reports which formats and topics actually sell. It is in daily use behind a login, so this page shows screenshots taken from a copy with demo data.

Problem

Producing short-form video every day meant writing scripts from scratch, losing good hooks in notes apps, forgetting to post, and never knowing which videos brought clients. Free AI tiers make generation cheap, but they rate-limit, time out and sometimes return malformed output — a tool used every morning cannot stop when one provider does.

Screenshots

Screenshot 1 of Content OS, full size
Script generator: topic, goal, pillar, platform, length and an optional client result with consent.
Screenshot 2 of Content OS, full size
Carousel editor with seven slide layouts, exported in the browser as 1080×1350 PNG files.
Screenshot 3 of Content OS, full size
Home: today's posts, follow-ups due, and the funnel from views to DMs, leads and clients.
Screenshot 4 of Content OS, full size
Analytics: DMs per post by format and pillar, with rule-based recommendations on top.
Screenshot 5 of Content OS, full size
Lead board from first DM to client; each lead keeps the post that brought it.

What it does

The creator writes a topic and picks a goal, a content pillar, a platform, a length and, optionally, a format recipe and a client transformation. The AI returns a full script: a hook for the first three seconds with three alternatives, the body to read to camera, a call to action built on the brand's DM keyword, on-screen text, a scene-by-scene shot list, recording notes and the caption, hashtags and search keywords.

The script is then edited by hand or by instruction — “30% shorter”, “more direct call to action”, or free text — and every change is saved as a new version. The same pattern covers six more features: adapting a competitor's video, generating hooks, building carousels, adapting a trend, improving a caption for search, and drafting a reply to a lead's objection.

An AI pipeline that keeps working on free tiers

All seven AI routes call one function. It asks Gemini for an object that matches a Zod schema; if Gemini errors, times out after 30 seconds or returns something that does not fit, it asks Groq with the same schema. The primary model does not retry while a fallback is waiting, so a slow answer costs seconds, not minutes, and the last provider gets one extra attempt because a schema mismatch is an error the SDK will not retry by itself.

Before calling a model, each route checks the session, validates the input, and counts the user's requests in the last minute and the last day — 10 and 200 by default. Every attempt, successful or not, is written to that same table with the provider, model and latency, so the limit and the audit trail are one thing.

  • Prompts carry the creator's niche, audience, offer, tone, pillars and DM keyword, plus their favorite hooks and CTAs as style examples.
  • Output schemas avoid string length limits because both providers support only part of JSON Schema; lengths are enforced afterwards with a stricter schema.
  • Model names live in environment variables, so a change in a free tier is a configuration change.

From script to client

Carousels are edited slide by slide in seven layouts and five palettes and exported in the browser as 1080×1350 PNG files or a ZIP, with no server cost. Scripts and carousels go onto a calendar in the creator's time zone; a daily Vercel cron sends a summary by web push and email, and the app installs as a PWA on a phone.

Leads move across a board from new to client, each one linked to the post that brought it. Metrics are entered per post, and the analytics page groups them by format, pillar and type. Its recommendations — repeat this format, drop that pillar, make a part two of the post that brought a client — are plain rules over the numbers, not a model.

Data and security

Supabase Postgres holds 16 tables, all with row-level security: each user reads and writes only their own rows, and the seeded library — 15 format recipes, 40 hooks, 16 CTAs and 13 DM templates — is read-only for everyone. Reads happen in Server Components with the user's session, so RLS applies without extra code; writes go through Server Actions that validate with Zod again on the server.

The secret database key is used only by the reminder cron, which must read every user's schedule and rejects any call without the cron secret.

Architecture

From top to bottom: the creator uses the app in the browser or as an installed PWA; Next.js on Vercel serves pages from Server Components, writes through Server Actions and runs seven AI routes plus a daily cron; the AI routes check the session and the rate limit, then call Gemini and fall back to Groq, validating with Zod; data lives in Supabase Postgres with row-level security and files in Supabase Storage; reminders go out by web push and Resend email.

Technical decisions

Two free providers behind one function
Paying for a single API would have been simpler, but the tool is used by one creator and free tiers cover the volume. The cost is handling their failures, which the fallback does in one place instead of in every feature.
Structured output instead of free text
Every answer is an object the interface can render field by field — hook, alternatives, scenes, caption. Parsing prose would break the moment a model changed its wording.
The log is the rate limit
Counting the user's own rows in the request log needs no Redis and cannot be bypassed from the browser, because row-level security lets users insert and read their rows but not delete them.
Rules, not a model, for recommendations
Which format brings more DMs is arithmetic over the creator's own numbers. A deterministic rule is free, instant and gives the same answer twice.
Consent checked on the server
The form only lists transformations with consent, but the route checks again before a client's result can enter a prompt, so a crafted request cannot get around it.

Evidence

  • 7

    AI features behind the same fallback and rate limit

    Source: app/api/ai/* · lib/ai/provider.ts

  • 70

    Checks in the AI pipeline test suite, run with a mock model

    Source: tests/ai-pipeline.test.mts

  • 16

    Tables, every one with row-level security

    Source: supabase/migrations/*

  • 84

    Seeded format recipes, hooks, CTAs and DM templates

    Source: supabase/seed.sql

Limitations

  • It is a private, single-creator tool; there is no open demo, and accounts are not offered to the public.
  • Free-tier limits decide how much can be generated in a day; heavy use would need a paid plan.
  • Metrics are entered by hand; nothing is imported from Instagram or TikTok yet.
  • The tests cover the AI pipeline, validation and analytics with a mock model; there are no end-to-end tests of the interface.
  • The Hobby plan allows one cron run a day, so reminders are a morning summary, not alerts at the hour.

Next steps

  • Import post metrics from the platforms' APIs instead of typing them.
  • Feed the best-performing posts back into the prompts as examples.

← All work