On this page
An optional feature or connector is a plugin: a declarative manifest plus the code it describes, gating a page, a menu item and a data route.
The plugin contract#
Identity, tenancy, RLS, roles, warehouse, i18n and audit are always on; everything optional is a plugin in one compiled catalog, never loaded dynamically.
| Artifact | Lives in |
|---|---|
| Manifest | packages/ |
| tRPC router | apps/ |
| Pages | apps/ |
| API routes | apps/ |
| Tables and RLS | packages/ |
| Copy | packages/ |
| Pure logic, shared UI | a workspace package (optional) |
Manifest fields
The schema in packages/plugin-host/src/manifest.ts is strict and parsed at module load, so an unknown key fails the build.
| Field | Required | Meaning |
|---|---|---|
id |
yes | Stable kebab-case id, also the persisted installation key; never renamed |
version |
yes | Manifest version, written on each installation row |
nameKey, description |
yes | Catalog card copy; must resolve in Vietnamese and English |
category |
yes | ai_, analytics, growth, operations, market_ or data_ (connectors) |
navItemIds |
yes | Menu ids the plugin owns, hidden while it is off; [] when headless |
replaces |
no | Generic menu ids hidden while this plugin is on; hides from the menu only |
provides |
features only | Metric pillars it owns; one owner per pillar, asserted at load; ecom has none |
provides |
connectors only | Organization capabilities an active credential of this connector is evidence for |
default |
yes | On where the shape runs a home domain; true without one fails the build |
legacy |
yes | null for every new plugin |
prerequisite |
yes | ai_ (the organization needs a saved AI key) or none |
depends |
no | Plugins that must be on first, transitively; the graph must be acyclic |
kind |
no (default feature) |
feature, connector, satellite or shared_ (entitlement-only plugin over a platform-synced dataset) |
connector |
connectors only | marketplace, marketing, dataset, market_ or content_; the family is the data plane |
transport |
connectors only | api, file or both |
vertical, serves |
connectors only | The catalog heading and every domain one credential can serve |
thirdPartyData |
connectors only | The data describes the market rather than the organization; renders the third-party badge |
provider |
connectors only | The worker connector registry id or parser id that implements it |
client |
satellites only | The OIDC client id the app is registered under in the issuer |
launch |
satellites only | An https URL on the app's own origin; the launcher opens it. An environment variable named after the client id (<CLIENTID>_) overrides it |
scopes |
satellites only | Platform API scopes the app may request, platform:<plane>. |
planIds |
satellites only | Plan ids an installation may carry |
Gate API
From @yng/plugin-host, inside the caller's tenant scope; the caller owns the super-admin bypass and role checks.
| Function | Returns |
|---|---|
isPluginEnabled |
Whether one plugin is on for one organization |
getEnabled |
The whole enabled set, one query |
getDisabled |
Menu ids to hide because their plugin is off |
getReplaced |
Generic menu ids hidden by an active tailored pack |
orgHasConnector |
Whether the org has a live credential in a family |
The installation row decides: no row means off (only the legacy chatAssistantEnabled flag is read when the row is missing), a row counts only while enabled, active, active or trial status and before validTo (installBlockReason, packages/plugin-host/src/resolve.ts), and a plugin is also off while anything in dependsOn is off. A reconcile derives each organization's rows from its shape on blueprint apply, domain activation and every deploy, never overriding a super admin's manual row.
Where entitlement is enforced
A dedicated page, deep links included, calls requirePlugin('<id>') first; a console page uses requireAdminTenantPlugin. A new plugin gets its own router on a dedicated procedure, like chatProcedure. Routers core pages also read stay on orgProcedure, so a plugin turned off cannot break a core surface.
How to#
Add a plugin
The step-by-step checklist is Add an optional feature (plugin); a connector follows Add a data source and a satellite Connect a satellite app.
Verify#
pnpm tsx scripts/audit/plugin-manifest-validity.ts
pnpm run typecheck && pnpm run lint
pnpm run audit:all
pnpm --filter @yng/web build
A cached typecheck can pass on stale output, so run the build. Then toggle the plugin for a test organization at /admin/orgs/<slug>/plugins and confirm the menu item and the not-found page follow.
Troubleshoot#
| Symptom | Cause | Fix |
|---|---|---|
| Build fails at module load with a manifest parse error | An unknown key, or a field on the wrong kind |
Check the cross-field rules above |
| The plugin is on in the catalog but its menu item never shows | The organization's hidden-menu list hides it, or a dependency is off | Un-hide the item, or enable the dependency |
| A gate read returns off for every organization in a script | The script did not open a tenant scope | Pin each organization before reading installation rows |
| A toggle is blocked in the admin catalog | The plugin needs a saved AI key, or a depends plugin is off |
Enable the dependency first; enabling never cascades |
- Never rename a plugin
id; add a new plugin and bumpversionfor changes. org_plugin_installations.configis reserved; a plugin's settings belong in its own tables or settings page.