Building blocks

Stop rediscovering what you need to build.

The same shapes of problem come up in product after product. Usually each one gets a one-off solution, often right next to another problem with the same shape. Each building block takes one of those problems and solves it once, in a shape you can reuse wherever it shows up.

Template is where they come together. For the problems almost every product has, such as deciding who can do what, the pieces also work without the template: a rules engine, a permissions library, the screens for building rules, and a way to say which step a record can move to next. Most of them already run in production.

If your coding agent writes its own versions instead, Foundry reminds it of these.

templateMIT

A SaaS app where the hard parts are already built.

Template is like shadcn, but for the whole SaaS app: you start a product from it and own the code. On day one:

  • People sign in with email, with an account they already have elsewhere, or with keys for scripts.
  • They work in organizations and teams, each with its own roles.
  • Each person sees and changes only what they're allowed to.
  • Sensitive data stays encrypted, and the keys can be replaced on a schedule.
  • Changes to the records you choose are kept in a log, with who made each one.
  • Slow work runs in the background, and screens update live.
  • Your product emails people and tells other systems when something happens.
  • Admin and superadmin screens are included.
Starting from template

Start a product from template, and own all of it.

Template is a working SaaS app with the parts nearly every product needs already built. You copy it once and build your product in that copy. Nothing stays tied to a service of ours. Kingdom, the hosted hub on the agentic side, started from template the same way.

How you start

  1. Create your own repository from it. Template is a GitHub template repository under MIT, so the new repository is yours, every line of it.
  2. Run it on your machine.bun run setup && bun run local Setup installs the packages, starts Postgres, Redis and file storage in Docker, and seeds the database. Local runs the API with the web, admin and superadmin apps.
  3. Put it online when you are ready.bun run init A guided setup creates the project's accounts on GitHub, PlanetScale, Railway, Vercel, Cloudflare and Resend, and keeps their secrets in Infisical.
  4. Build your product on top. Add your own models and routes. Each route registers itself and regenerates the typed API client, and who may use a new model is a few rules in the permissions schema.

What you own

  • All of the code, in your repository. Change any of it, including the parts that came with template.
  • The building blocks, as MIT packages from npm that you update when you choose.
  • Docs written for people and for coding agents, and the repo's Foundry setup, so an agent working in your product is reminded of what is already there.

Template has no plugin system and no hidden framework. Each solved problem is ordinary code in your repository, documented where it lives, so you can read it, change it or replace it.

The pieces

For the problems almost every product has.

You can use each one without the template.

Colour: part
  • Building blocks
  • Developer experience
  • Agentic
  • Governance
  • Closed source
Fill: status
  • Done
  • Under construction
  • Planned
Lines: relation
  • Builds on
  • Reads its map
  • Goes through a Signet
  • Under construction
  • To a planned piece
The whole pictureThree tiers. At the base, the template layer: the whole SaaS app, made of the building blocks prisma-map, json-rules, permissions, transitions and rules-builder; beside it, developer experience: atlas, gloss and config, with the worktrees, init and CI rules that come with template. Above them, the agentic tools: Foundry, agent-session, Archive, KCP, Signet, Kingdom (the permission hub), Oracle, bench, and Artifactory (planned). At the top, governance: the Inixiative project (planned), a time-series governance platform with tokenization and the goal, which the whitepaper explains and feeds into; Livestock (planned, closed source) sits just above it, a product that uses the platform.Building blocksThe libraries template is made ofjson-rules reads the field map prisma-map producespermission rules are json-rulesrules-builder builds json-rules conditionstransition guards are json-rulesa transition is checked by permissionsrules-builderRule screensprisma-mapData shapetransitionsLifecyclesjson-rulesRulespermissionsWho can do whattemplate uses prisma-maptemplate uses json-rulestemplate uses permissionstemplate uses rules-buildertemplateThe whole SaaS appa Signet's lens is json-rulesKingdom decides access with permissionsFoundry uses json-rulesDeveloper experienceTools that help you workworktrees, init and CI rulescome with templateatlasMap of the codeglossNotes beside the codeconfigShared setupatlas checks its annotations with json-rulesAgenticAgents that work like you doFoundry pairs with Kingdom; the pairing is a Signeta local Archive pairs with Kingdom through a SignetKCP will run your provider CLIs through Kingdom (in progress: it signs in today)Artifactory will sign in with Kingdom (planned)Foundry runs each agent session on your machineOracle measures and tunes Foundry's docs and WardensoracleDid a fix stick?agent-sessionRuns sessionsbenchAgent challengesfoundryAgent workspacekcpCLIs through KingdomarchiveKeeps sessionsartifactoryShare agent worksignetRevocable passkingdomThe permission hubGovernanceCooperation at scalethe whitepaper explains why; the Inixiative project is the goalwhitepaperWhyInixiative projectchange.org meets Kickstarter on blockchainLivestock is a product that runs on the Inixiative platformLivestockTokenized cattle trusts

Hover or focus any piece to light what it builds on and what builds on it.

Developer experienceBeside the stack: tools that help you work
  • atlasMap of the codeBuilt on json-rules
  • glossNotes beside the code
  • configShared setup
  • worktreesA copy per taskComes with template
  • initProject setupComes with template
  • CI rulesConvention checksComes with template
TemplateThe whole SaaS app, resting on the building blocks
  • templateThe whole SaaS appBuilt on prisma-map, json-rules, permissions, rules-builder, atlas, transitions, gloss
Building blocksprisma-map at the base
Read the map as text

How to read the map: colour shows which part a piece belongs to (amber building blocks, teal developer experience, lime agentic, blue outside your machine, violet governance; charcoal marks closed source and pink marks a connection that goes through a Signet). Fill shows status: a solid block is done, a block in scaffolding is under construction, a dashed outline is planned. Lines show the relation: solid builds on or runs with, dotted reads prisma-map's map, pink goes through a Signet, a scaffold-dashed line is under construction (on the technical graph: what template will adopt), a long-dashed grey line reaches a planned piece.

  • prisma-map: Your Prisma schema, readable at runtime. Built on config.
  • json-rules: One rule that runs in memory, in Prisma and in SQL. Built on prisma-map (reads its map), config.
  • permissions: RBAC, ABAC and ReBAC on your own records. Built on prisma-map (reads its map), json-rules, config.
  • transitions: Declarative lifecycles. Built on json-rules, permissions, config.
  • rules-builder: A headless rule builder. Built on json-rules, config.
  • atlas: A map of your code. Built on json-rules, config.
  • gloss: Explanations kept out of the source. Built on config.
  • config: The shared toolchain and theme.
  • worktrees: A worktree per task, with its own database and ports.
  • init: Sets up hosting, database and secrets for a new project.
  • CI rules: Checks that hold the codebase to its own conventions.
  • template: The whole SaaS app, built from the libraries. Under construction. Built on prisma-map, json-rules, permissions, rules-builder, atlas, config, worktrees, init, CI rules, transitions (to adopt), gloss (to adopt).
  • Foundry: The workspace around your agent. Under construction. Built on agent-session, Archive, Signet, json-rules, gloss, config. Foundry pairs with Kingdom; the pairing is a Signet. Foundry runs each agent session on your machine. Foundry sends every session to Archive. Oracle measures and tunes Foundry's docs and Wardens.
  • agent-session: Runs each Claude Code and Codex session. Built on json-rules. Foundry runs each agent session on your machine.
  • Archive: Keeps every agent session. Built on agent-session, Signet. A local Archive pairs with Kingdom through a Signet. Foundry sends every session to Archive. Oracle reads the sessions Archive keeps.
  • KCP: Runs your CLIs through Kingdom. Under construction. Built on Signet. KCP will run your provider CLIs through Kingdom (in progress: it signs in today).
  • Kingdom: The permission hub. Closed source. Under construction. Built on Signet, Archive, agent-session, permissions, json-rules, prisma-map, rules-builder. Foundry pairs with Kingdom; the pairing is a Signet. A local Archive pairs with Kingdom through a Signet. KCP will run your provider CLIs through Kingdom (in progress: it signs in today). Artifactory will sign in with Kingdom (planned).
  • Signet: A revocable pass on the owner's terms. Built on json-rules.
  • Artifactory: Sharing what agents make, signed in with Kingdom. Planned. Artifactory will sign in with Kingdom (planned).
  • Oracle: Measures whether a correction stuck. Closed source. Built on agent-session, Archive, Foundry. Oracle measures and tunes Foundry's docs and Wardens. Oracle reads the sessions Archive keeps.
  • bench: Our challenge set for coding agents. Built on agent-session.
  • The whitepaper: How groups set rules and hold each other to them. The whitepaper explains why; the Inixiative project is the goal.
  • The Inixiative project: change.org meets Kickstarter on blockchain: a time-series governance platform, with tokenization. Planned. The whitepaper explains why; the Inixiative project is the goal. Livestock is a product that runs on the Inixiative platform.
  • Livestock: Tokenized cattle trusts in Uruguay and Argentina, a product on the Inixiative platform. Closed source. Planned. Livestock is a product that runs on the Inixiative platform.
How they fit together

One rule language, from the database to the screen.

Each piece reads the one beneath it. A rule a tenant writes in the builder is the same JSON that permissions checks and that the database query filters by, so the three never disagree.

  1. prisma-map describes your data.

    It reads the Prisma client you already generate and lists each model, its fields, how records relate and which side holds the foreign key. Every piece after it reads this map instead of guessing at your schema.

  2. json-rules writes rules over that data.

    A rule is plain JSON naming those fields, such as "the status is open and the person is on the record's team". The same rule checks one record in memory, or compiles to a Prisma query or a SQL WHERE clause that finds every matching row. Because a rule is data, you can store it, validate it and let a tenant edit it.

  3. permissions are rules about who can do what.

    Roles, walks along relations (a member of an organization can read its projects) and conditions on the record and on the person acting are all json-rules rules, decided on the rows you already have. There is no second store to keep in sync, and anything a person hands on is checked against what they could do themselves.

  4. transitions are rules about a record's lifecycle.

    They say which moves are open from the current state, such as draft to approved, and who may make each one, by asking permissions. The same rules list the actions open on one record and compile to a query for every record an action is open to.

  5. rules-builder is the screens for editing rules.

    It reads the same map and offers only the fields and operators the engine can run, so whatever a person builds will run.

  6. template puts them in one SaaS app you own.

    Template uses prisma-map, json-rules, permissions and rules-builder for its data, its rules and who can do what, alongside sign-in, organizations, background jobs, email and the admin screens. Transitions works beside it and is not wired into template yet.

Developer experience

Tools for working on the code.

These tools help while you build, and none of them ends up in your product. Atlas keeps a map of what is where in the code. Gloss keeps notes about the code out of the code, and hands them to an agent when it reads that file. Config gives every project the same setup.

Template comes with its own: several copies of a project can run side by side without colliding, a guided setup creates a new project's accounts and services, and automatic checks stop code that rebuilds something the project already has.

worktrees: a copy of the project per task. atlas: a map of the code. gloss: notes kept beside the code. config: one shared setup.worktreesA copy per taskatlasMap of the codeglossNotes beside the codeconfigShared setup

Technical details for every piece

Paused

conditional-form

Paused

Forms whose show, hide and validation logic is the same rules the server uses. Not recommended for use.