Products3 min read

Spellcast

A self-hosted content operation for several brands: account sets keep each identity separate, local models draft within each platform's rules, and Postiz with Temporal does the publishing.

Built with Next.js, Turborepo, Drizzle ORM, PostgreSQL, Postiz, Temporal, Ollama

Spellcast screenshot

One operation, distinct identities

I run several brands, each with its own accounts, voice and audience. Spellcast groups a brand's accounts into an account set with its own queue, schedule, brand voice and analytics. The hard product problem is not posting. It is keeping the right identity and the right platform rules attached to a piece of work as it moves from idea to draft, review and publishing.

Build a product layer, not another publishing stack

Every social platform has its own OAuth flow, rate limits, media rules and failure modes. Rebuilding all of that would have taken months before any of the product-specific parts existed.

  • Own every integration

    Write each API connection, OAuth flow and retry queue from scratch.

  • Build on Postiz and TemporalChosen

    Let Postiz handle the integrations and Temporal the durable publishing workflows, and put the product in a Next.js front end and a Node backend-for-frontend.

The Turborepo separates the web app, the API and shared packages, with Postiz and Temporal running alongside them in Docker Compose. My time went into account sets, drafting, campaigns, review and per-platform adapters: the parts an off-the-shelf scheduler does not have.

AI that drafts inside the platform's rules

Each AI action (write, shorten, optimise, variations, threads, carousels, reply suggestions, repurposing) is its own route with a Zod-validated request. The prompt carries the hard constraints instead of hoping the model knows them: the target platform's character limit and hashtag rule, and the account set's brand voice, injected into the system prompt.

Text generation runs on local models. The helper tries a local brand service first, behind a one-second health check, then falls back to Ollama, each with its own timeout. If neither returns usable text the request fails with an error, rather than returning something empty.

Local models

Gave up
Small local models write less polished first drafts than the largest hosted ones, so I treat every draft as a draft and review it before it is scheduled.
Got
No per-token bill for an operation that drafts all day, brand copy that is never sent to a third-party model provider, and a pipeline that keeps working if a provider changes its pricing or terms.

A winner is not an experiment result

What happened

A/B tests publish two variants and, once the evaluation window closes, a scheduled job marks the variant with the highest score as the winner.

Why

Highest score is a ranking, not evidence. With a handful of impressions a single like can decide it, and because engagement actions are counted against impressions, one enthusiastic person can look like a trend.

The fix

I don't report any lift from these tests. The next version requires a minimum sample, a confidence threshold and a minimum effect before it records a winner, and says "not enough data" otherwise. Until then the results are hints for me to read, not learning the system acts on.

Agents can run it too

A separate MCP server exposes over 100 tools for scheduling, drafting, campaigns, analytics and engagement, so I can run the operation from an agent as easily as from the interface, using the same account sets and brand voices.