Core vs Custom Boundary
Spine projects are two trees with different owners: .framework/ is the sealed, upgradeable package; custom/ is project-owned code and data the package never writes. Everything about the boundary — the alias config, the assembly, the upgrade command, the lint script — exists to keep one promise: upgrading the framework can never destroy your work.
What lives where
.framework/ (core, framework-owned) — the React app shell and admin UI (.framework/src/), Netlify functions and shared middleware (.framework/functions/), ordered SQL migrations (.framework/migrations/), the CLI (.framework/cli/), this instruction book (.framework/src/instructions/), schemas, seeds, tests, and templates (.framework/templates/). The shipped file set is declared in .framework/templates/project.json under framework_dirs, framework_files, config_files, root_scripts, and bin.
custom/ (project-owned) — apps under custom/apps/<slug>/ (each with a manifest.json and index.tsx), migrations under custom/migrations/, function handlers under custom/functions/ and custom/apps/<slug>/functions, plus tests and vendored packages. This tree is created by init / create-app / install-app; it is not part of the npm package and upgrade never writes into it.
"Project-owned" is scoped to framework upgrade. The app lifecycle commands are a different writer: install-app/update-app re-copy every package entry into custom/apps/<slug>/ (preserving only the local manifest.json on reinstall), and uninstall-app deletes the directory. Inside a packaged app, shipped files — decisions/, docs/, functions/, pages/, … — are publisher-owned and replaced on app update; hand-written additions there are not guaranteed to survive. custom/decisions/, custom/migrations/, custom/functions/, and your own hand-written apps are untouched by everything.
Shared but owned: config/ (Vite + tsconfig), netlify.toml, and the scripts/ assembly-and-integrity scripts ship with the framework and are synced on upgrade, with one carve-out — netlify.toml [functions."custom_*"] sections belong to apps and are re-appended verbatim by renderNetlifyToml in .framework/cli/lib/project-files.ts.
Why the boundary exists: upgrade safety
npx spine-framework upgrade is a file sync, not a git operation:
- It reads
.spine-manifest.json— frozen per-file hashes written at install — and aborts if any framework file was locally modified or deleted unless--forceis passed (.framework/cli/commands/upgrade.ts,runUpgrade). - It copies the new package's framework files over yours and deletes only
.framework/entries that disappeared upstream. Files outside.framework/that upstream dropped are warned about, never removed. - It re-merges
package.json(framework scripts + dependency pin), re-rendersnetlify.tomlpreservingcustom_*sections, and regenerates the manifest. New migrations are reported, never run —npx spine-framework migrateapplies them.
Because overwrite-on-upgrade is guaranteed, the only way a local change inside .framework/ survives is verify/upgrade treating the tree as sealed. The frozen manifest is the integrity contract: scripts/verify-integrity.sh re-hashes the tree and compares.
How the boundary is enforced
scripts/boundary-check.sh— fails the build if.framework/code importscustom/orcustom_*modules, if core source references known app slugs, or ifcustom/code reaches.framework/via relative imports instead of the@corealias.- Aliases —
config/tsconfig.jsonmaps@core/*→.framework/src/*and@custom/*→custom/apps/*;config/vite.config.tsmaps@coreto the assembledsrctree and@customtocustom/appsas well — the two configs agree by decision0025(@custom/<slug>= cross-app import).config/tsconfig.functions.jsonmaps@shared/*to the assembled_shared/directory — custom functions import./_shared/...at runtime. - Assembly —
scripts/assemble-frontend.shcopies.framework/srcas the base layer and eachcustom/apps/<slug>verbatim into.assembled/src/<slug>/;scripts/assemble-functions.shflattens framework + custom handlers into.assembled/netlify/functions/and treats duplicate function basenames as a hard error, while lettingcustom/overlay_shared/helpers. - Manifest —
.spine-manifest.json+scripts/verify-integrity.shseal the.framework/tree between upgrades.
How to extend core without crossing the boundary
Custom code reaches core through three sanctioned channels, in order of preference:
- Data —
public.appsrows,public.typesdesign_schema, roles, link types, triggers, pipelines. Most "customization" is data. - Custom apps —
custom/apps/<slug>/with amanifest.json, mounted byroute_prefix/rendererand loaded dynamically by.framework/src/components/CustomAppLoader.tsx. - Custom functions — new handler files alongside the assembled
_shared/layer, for behavior admin-data can't express. Never wrappers for runtime CRUD — that is/api/admin-data's job.
What breaks if you cross it
- Core → custom import:
boundary-check.shfails; even if merged, the nextupgradeoverwrites or refuses, and the core now fails in projects lacking that app. - Custom →
.framework/relative import:boundary-check.shcheck 2b fails; the path also breaks under the assembled layout Vite actually builds. - Edit inside
.framework/:verifyreports drift andupgradeaborts — or--forcesilently reverts your change. Either way the change was never yours to keep. - Custom runtime-CRUD function: compiles fine and quietly bypasses permissions, validation, audit, and triggers — the worst kind of violation because nothing fails.
See also
- The Spine Way — the ten rules this boundary is part of
- Apps and Renderers — how
custom/apps register and mount