Defining an API

Registering routes

Add every route to the bundle's api.ts registry.

Every route must appear in the bundle's api.ts registry. Keys are camelCase intent verbs; runtime calls always use the literal path string, not the key.

Registry

// contracts/main/api.ts
export type MainRoutes = {
  // …existing entries…
  listWidget: import("./routes/widget").ListWidgetRoute;
  getWidget: import("./routes/widget").GetWidgetRoute;
  createWidget: import("./routes/widget").CreateWidgetRoute;
};

export type MainApi = AccorudoClient<MainRoutes>;

Registry keys (listWidget, getWidget, etc.) exist for discoverability and type aggregation only. They are not used at runtime.

To add models and routes without writing files by hand, see CLI scaffolding.

Copyright © 2026