Apps and Renderers
An app in Spine is a row in public.apps plus — for apps that render their own UI — a directory of code. The registry row decides where the app mounts, who can open it, and how it renders. The renderer column is the fork in the road.
The registry row
.framework/migrations/001_core_schema.sql defines public.apps: unique slug, name, route_prefix, renderer (CHECK constraint: 'generic' | 'custom' | 'none'), min_role, required_roles (added in migration 014), nav_items, config, integration_deps, metadata, is_active, is_system, owner_account_id, domains.
route_prefix(defaults to/<slug>) is where the SPA mounts the app —.framework/src/App.tsxbuilds a<Route>per active app.is_active: falseremoves the app from navigation and routing.is_system: trueprotects the row from tenant-level deletion.
Mounting: directory or root
route_prefix is the whole mount contract. Every routable app (route_prefix != null, renderer !== 'none') becomes a <Route path="<prefix>/*"> in .framework/src/App.tsx:
- Directory mount —
"/answer-once"→ the app owns/answer-once/*. - Root mount —
"/"→ the app owns/*and renders directly at/for non-admin users. - Nested mount —
"/crm/sales"works mechanically (/crm/sales/*); prefixes sort longest-first, so/crm/saleswins over/crm. Supported but unusual.
Host-keyed mount overrides
prod_domain + prod_route_prefix (and the preview_ pair for VITE_ENVIRONMENT=preview) let one row mount differently per hostname (.framework/src/lib/app-mount.ts, resolved in useApps/AppContext before records reach the router):
- Host matches
prod_domain→ app mounts atprod_route_prefix(orroute_prefixwhen no override is set). - Host doesn't match, override set → still routable at
route_prefix. - Host doesn't match, no override → filtered out (legacy domain-lock).
So route_prefix: "/demo" + prod_domain: "demo.example.com" + prod_route_prefix: "/" serves the app at / on its own site while it stays at /demo everywhere else. manifest.json carries all four fields; validate-app requires the matching domain whenever an override prefix is declared. The unique index idx_apps_route_prefix_domain allows / per prod domain.
Rules that are easy to get wrong:
- Exactly one app may own
/. Two root-mounted apps both compile to/*and resolution order silently decides which renders — the registry does not prevent this; don't create it. - A root-mounted app shadows the global not-found page. Its
/*route matches every path the more-specific routes don't, so the app must render its own not-found for unknown internal paths (a catch-all<Route path="*">inside itsindex.tsxroutes). system_adminalways lands on/spine-framework/admin. Root-mounting changes what members see at/, not admins. Non-admin landing at/: root-mounted app if one exists → else redirect to the first app's prefix → elseNoAppPage.- App-internal navigation must be mount-agnostic. Use
useAppPath()from@core/hooks/useAppPath(or relative paths inside the app's<Routes>) for every link andnavigate()call — it returns the prefix (''when mounted at/). A hardcodednavigate('/dashboard')escapes a directory-mounted app. See Frontend SDK. nav_items[].pathaccepts two forms (GenericAppShellnavigates absolute paths verbatim and prefixes relative ones): absolute including the prefix (/taskboard/tasks) or relative (tasks→ resolved to/taskboard/tasks). The broken form is absolute without the prefix (/tasksescapes the app). For a root-mounted app the absolute form is simply/…./spine-framework/*is reserved (admin, API docs, CLI pages mount there ahead of app routes). Never pick a colliding prefix.- Apps are always behind login.
is_public/auth_requiredexist on the manifest, but the unauthenticated router only serves auth pages — a root-mounted app is not a public site mechanism.
Change the mount point via manifest.route_prefix + update-db-app <slug> (or the admin app detail page). On package reinstall the local manifest.json is preserved, so the file is the durable source.
Role gating
Two layers decide who sees an app:
- Server side,
get_account_appsfilters the app list by the caller's role slugs (.framework/functions/apps.ts;.framework/migrations/013_get_account_apps_role_filter.sql). - Client side,
AppWrappercomputesrequired_roles(falling back to[min_role]) and renders an access-denied screen unless the user holdssystem_adminor one of those roles (.framework/src/components/AppWrapper.tsx).
This gates opening the app; it does not replace record-level record_permissions on the data underneath.
renderer = 'generic'
The platform renders the app's list and detail pages for you, straight from each type's design_schema.views:
App.tsxmountsGenericAppShellforrenderer === 'generic'apps.GenericAppShellbuilds the sidebar from the app'snav_itemsand, for every nav item carryingtype_slug(and optionalview), generates list/detail/new routes backed byGenericListPageandGenericDetailPage.GenericListPageturnsviews.default_list(or the nav item's named view) into sortable columns;GenericDetailPagerendersviews.default_detailsections with per-field read/write awareness.
What you get for free: a working list page, detail page, create/edit form, sorting, filters, field-type rendering, and permission-aware editing — with zero app code. What it costs: every type the app serves must have complete fields, views.default_list, and views.default_detail, or the pages fail with "No schema available" / schema-load errors. See Design Schema.
renderer = 'custom'
The app ships its own React code under custom/apps/<slug>/ (a project-owned directory, not part of the framework package). App.tsx mounts CustomAppLoader, which resolves the app through an import.meta.glob('custom/apps/*/index.tsx') — the app's index.tsx is its entry point and default-exports the routed component (the create-app scaffold generates exactly this shape).
A custom app renders its own pages but still uses the platform for data: /api/admin-data for runtime CRUD, /api/types for schemas. Custom apps must never write their own CRUD wrappers — that bypasses permissions, validation, audit, and triggers (see Runtime Records).
renderer = 'none' registers the app (data, types, integrations) with no UI surface.
The manifest
custom/apps/<slug>/manifest.json is the app's declarative half, validated by loadManifest in .framework/functions/_shared/app-manifest.ts (the AppManifest interface is the contract):
{
"name": "My App",
"slug": "my-app",
"description": "…",
"version": "1.0.0",
"required_roles": ["member"],
"route_prefix": "/my-app",
"renderer": "custom",
"routes": ["/my-app", "/my-app/dashboard"],
"nav_items": [{ "title": "Dashboard", "path": "/my-app/dashboard", "icon": "LayoutDashboard", "order": 1 }],
"features": [],
"dependencies": [],
"entry_point": "./index.tsx",
"is_public": false,
"auth_required": true
}Validated requirements: non-empty name, slug matching ^[a-z][a-z0-9-]*$ (and equal to the directory name for discovery), and required_roles as an array of strings. Optional keys the install flow also honors: config (merged onto the apps row), seed (declared seed entries), owned_types, registration, metadata, min_role, preview_domain/prod_domain.
Install and seed flow
Two paths put an app on disk and in the registry:
npx spine-framework create-app <slug>— scaffoldscustom/apps/<slug>/(manifest.json+index.tsx+components/) and inserts apublic.appsrow withrenderer: 'custom'androute_prefix: /<slug>(.framework/cli/commands/create-app.ts).npx spine-framework install-app <package>— copies a packaged app intocustom/apps/<slug>/, runs migrations, thenseedApp:- upserts the
appsrow from the manifest (appRowPayload: name, description, version, nav_items, route_prefix, renderer, required_roles, min_role, config merge, metadata); - applies seed files in dependency order — conventional
seed/roles.json→roles(conflictslug),seed/types.json→types(conflictkind,slug, noapp_idinjection,ignoreDuplicates) — plus anymanifest.seedentries; - refuses to overwrite a
typesrow whosedesign_schemadiffers from the seed unless the slug is declared inmanifest.owned_typesand--reconcile-owned-typeswas passed (types are global — see Scope and Accounts); - syncs the
registrationblock intospine.config.json(the project-owned config file at the project root).
- upserts the
update-db-app <slug>re-syncs a localmanifest.jsonto the DB without touching files;seed-app <slug>re-runs seeds;uninstall-appremoves the app (--keep-datapreserves seeded rows). All in.framework/cli/commands/install-app.ts.
The practical split
Use generic when the app is "records in, records out" — lists, detail forms, admin-style editing — and keep views accurate. Use custom when the UX is a product surface (dashboards, wizards, bespoke layouts) and treat the manifest as your app's contract: registration, roles, seeds, nav. Either way, types and design_schema do the data modeling — the renderer only decides who draws the pixels.