Templates and derived products
How a module differs from a template inside the repository, what the business templates are, and how a product of your own is built on the foundation by adding one plugin.
Everything in this project sits on one foundation. A module adds a feature to it, a template product adds a whole product shape with a runtime of its own, and a derived product is what you build by putting one plugin of yours on top. The differences determine what has to be deployed and where your own code goes.
Module or template product
Both are already in the repository, each described by a manifest in modules/<key>/module.json. The kind field identifies which one it is.
| Module | Template product | |
|---|---|---|
kind in module.json | module | template |
| What it adds | One feature: pages, server code, its tables, copy and a validator | A product shape: workspace packages, a second process, a runtime, and the tables and settings that runtime needs |
| Example in the repository | cms, newsletter, affiliate, image-agent | agent-starter |
| Changes how you deploy | No | Yes: a service to run next to the web app |
| Others build on it | Rarely | Yes: agent capability plugins require it |
agent-starter is the one template product. Its manifest lists what a feature module never carries: the packages/agent-* workspace packages and apps/agent-service, the scripts dev:agent, build:agent-service and agent:publish-skills, the migration 0016_agent_starter with the run, thread, skill and workspace tables, and six validators. image-agent, by contrast, is a module with requires: ["agent-starter"]: a plugin folder, two routes, one settings key and no table.
A template product is a base that other items build on. A module usually has nothing built on top of it. The inventory of both is in What the base repository contains.
Business templates are derived products
The business templates sold beside the base (image-studio, video-studio, image-agent and video-agent) are derived products that are already built. Each is its own private repository: the base plus the plugin, pages and plans of one product. You clone one instead of the base and keep it up to date the same way. See Get Kernlift. The image-agent plugin inside the base repository is the shipped example of an agent capability; the business template of the same name is a separate repository.
The rest of this page explains how such a product is put together, which is also how you build one of your own.
A derived product is the foundation plus one plugin
A product built on the template, such as a site that generates images or video, does not fork the console. The foundation already carries sign-in, plans and checkout, the credits ledger, provider configuration, file storage, the admin console and the validators. Your product adds one plugin that contributes its pages and entries to the console's slots, plus your landing pages and plans.
There are two ways to build it, depending on whether the product needs the agent.
| Without the agent | With the agent | |
|---|---|---|
| What generates | A channel task: POST /api/<scene>/generate, read back through GET /api/status | An agent run that calls model.generate on the same scenes and publishes artifacts |
| Your plugin | A local console plugin: an app.nav entry, a page that starts tasks on image-creation or video-creation, optionally a dashboard card | An agent plugin on top of agent-starter: a scene, a Skill, composer controls, optionally its own cards and panels |
| Slots used | app.nav, app.dashboard.cards, optionally api.routes and billing.fulfilment | agent.host, agent.workbench, optionally api.routes |
| Interaction | A form and a result | A conversation: the reader describes, revises and gets results inside the messages |
| Database | Any supported one, including Cloudflare D1 | Postgres, or SQLite on Node |
| Deployment | The web app alone | The web app and the agent service |
Both share the same provider wiring. An image or video provider is configured once in /admin/config/ai, tasks are priced in credits and results land in the user's files, whichever path starts them. See Get image and video generation working.
Without the agent
The foundation is a complete web app without the agent service. /app/ai already starts and tracks channel tasks, so a generation product is a page of your own over the same server functions and API, registered as a local plugin. Nothing else in the shells changes, and the plugin can be switched off in Settings → Plugins. See Write a console plugin.
With the agent
Run the agent service from agent-starter, then add one capability plugin. The image agent is the shipped example: it declares the agent.image scene, ships the Image Studio Skill, adds a frame picker to the composer and renders image artifacts. A video capability is built the same way. It needs no artifact kind of its own, because video is a core kind that the conversation already plays inline. The host code does not reference the plugin by name, so installing a second capability adds an entry to the installed lists and requires no change to the workbench. See Agent plugins.
Because the agent is optional at runtime too, one codebase can serve both. Where the agent service is not deployed, entries marked requires: "agent" are hidden and the plain channel pages keep working.
What stays the foundation's job
Whichever path you take, these are not rebuilt per product:
- Money. Plans, checkout and the credits ledger. A plugin that delivers something for a paid order contributes a fulfiller to
billing.fulfilmentand does not modify orders. - Configuration. Provider credentials live in
/admin/config/*, never in the environment. - Access. Protected route trees are guarded at the layout, so a plugin's new page is protected by default.
- Checks. A plugin ships its own validator, and
pnpm validate:allcovers the rest.
Files
Next steps
Write a console plugin
Add a feature of your own as a local plugin: a workspace sidebar entry, a page and a dashboard card that an administrator can switch on and off.
Build a module
Add a feature to the repository as a module: code, schema and migrations for both dialects, region markers, a manifest and a validator.