The API bridge
The tenant API's GraphQL schema is compiled from the same graph the pages read. One declaration, two surfaces, and a schema that cannot drift from the product.
packages/alembic-graphql turns the graph into a GraphQL schema and executes documents against it. The app's API is an api root object on the one graph; the bridge compiles its schema with that object as GraphQL's Query, so the API's types are the app's nodes, declared once.
What the bridge does
compile.tswalks the declarations into aGraphQLSchema: a node field is its node, a collection a non-null list, a union the union of its nodes, a connection the Relay shape around its node. Anidentifierannotation names a type on the wire (ApiOrderisOrder);Internal(schema)hides a row property; a union of single-key structs compiles to a@oneOfinput.execute.tsturns a document into one Alembic selection and runs it, applying GraphQL's per-field null propagation: a nullable field that fails isnullwith an error at its path; a non-null one climbs to the nearest nullable ancestor. Mutations run serially and answer with the row they wrote.complexity.tsscores a document before it runs, in the unit the API's budgets are kept in.
What the API declares for itself
The API's surface is declared in apps/app/server/api/, not inherited from the app's nodes on the wire. order.ts projects the app's order into ApiOrder with nextSteps; custodian-order.ts is the custodian's own type; pricing.ts is indicative pricing with no wholesaler anywhere; scalars.ts declares Money, DateTime, GlobalId as ID. mutations.ts declares draftOrder and advanceOrder over the registered app mutations.
Two rules the schema test enforces: no wholesaler is ever exposed (Athanor is the wholesaler), and no raw id is a String (ids on the wire are global ids).
Nullability
Alembic settles a fragment's keys together and a view fails as a unit, which is right for a page. The bridge gives GraphQL its own semantics on top: compiled nullability is semantic (from schema optionality) plus error isolation (a node, collection, connection or boundary-crossing resolver is nullable unless marked required), so a refused read stays at its field.
The checked-in SDL
bun run api:sdl prints the schema to apps/app/server/api/schema.graphql, and schema.test.ts fails when the file is stale. The SDK's documents are typed from that file, and the Schema page is that file.