03

Cantrip

AI / Platform

RoleFounder / Full-Stack Engineer
TimelineMar 2026 — Ongoing
ClientPersonal Product
Cantrip screenshot

Overview

Cantrip is a multi-tenant TTRPG platform where game publishers ship rulesets and players run sessions with an AI Dungeon Master. The same architectural backbone as Chicknz (multi-tenant, oRPC, Prisma, Better Auth) but applied to a creative-tools domain — the AI is the host, not a chatbot.

Flagship ruleset: Zairoo, an Afrocentric original system that doubles as the platform's reference content while the editor and session experience are stress-tested.

Challenge

Existing virtual-tabletop tools force publishers into a fixed rules engine, and AI DM tools tend to be single-system. Cantrip splits the layer cleanly: an extractable rules engine SDK + a tenant-isolated session runtime + an AI orchestrator that knows the active ruleset's grammar. Publishers get authoring tools; players get a host that doesn't break character.

Tech Stack

Next.jsTypeScriptPrismaoRPCBetter AuthAI SDKAnthropic

Architecture

Three layers: an extractable rules engine SDK (the `cantrip-sdk` package — pure functions, no React), a tenant-isolated session runtime (Next.js App Router with oRPC procedures scoped by `tenantId`), and an AI orchestrator that's bound to the active ruleset's grammar via structured tool definitions (Vercel AI SDK + Anthropic). The same SDK powers both publisher authoring (validates rulesets at write time) and the session runtime (executes them at play time) — no schema drift between authoring and play.

Key Features

01

AI Dungeon Master

Anthropic Claude orchestrates session flow, generates encounters, and arbitrates rules — bound to the active ruleset's grammar so it stays in-system instead of hallucinating mechanics.

02

Ruleset Authoring

Publisher dashboard for shipping rulesets — character sheets, moves, tables, narrative tone. Same authoring layer that powers Zairoo also opens to third-party publishers.

03

Tenant-Isolated Sessions

Each session runs in a tenant-isolated context with its own ruleset, party state, and AI memory. Built on the same multi-tenant primitives as Chicknz — every query scoped, every AI call sandboxed.

Cantrip screenshot 1
Cantrip screenshot 2
Cantrip screenshot 3
Cantrip screenshot 4

What I Learned

  • AI agents stay in-character only when their tools are typed. Free-form prompting drifts; a strict tool surface bound to the ruleset's grammar keeps the DM from inventing mechanics that don't exist.
  • An SDK shipped alongside the platform is worth the dual-target tax. Authoring + runtime sharing the same engine means a ruleset that validates is one that runs.
  • Reuse multi-tenant primitives when the domain is different — same `tenantId` query scoping pattern as Chicknz, completely different product.
Next ProjectZairoo