Skip to content

Plugin Routes

Mika plugin routes use the EmDash plugin API base:

/_emdash/api/plugins/mika/<route>

Public plugin JSON routes are limited to safe catalog and stock reads:

/_emdash/api/plugins/mika/catalog/sellables
/_emdash/api/plugins/mika/sellables/availability

Other operation route keys exist in Mika’s descriptor table for server/plugin integration, admin runners, trusted clients, and host-owned projections. They are not a browser mutation API just because they have route metadata.

Do not document protected plugin route paths as browser mutation APIs.

Route URLs are built internally from EMDASH_PLUGIN_API_BASE (/_emdash/api/plugins), MIKA_PLUGIN_ID (mika), and the route key map. Public host code should use createMika(Astro).routes(...) or createMikaClient().routes(...) for the two public reads. Trusted server code can use createMikaServerClient(...).routes(...) from @bnomei/emdash-mika/server when it needs the full route-key map.

Admin action metadata and execution use well-known plugin routes:

/_emdash/api/plugins/mika/.well-known/actions
/_emdash/api/plugins/mika/.well-known/actions/run

Both are non-public trusted/admin surfaces.

Use createMika(Astro).routes(routeKey, options) for public route keys in host Astro code. Use createMikaServerClient(...).routes(routeKey, options) only from trusted server code that needs non-public route keys. The full operation matrix is in Operations.

Route key Path Public Notes
catalogSellables catalog/sellables Yes Public catalog read with collection, id, and optional locale.
sellableAvailability sellables/availability Yes Public stock read with sellableId.
actionsManifest .well-known/actions No EmDash admin action manifest.
actionsRunner .well-known/actions/run No EmDash admin action runner.
Other operation route keys See Operations No Descriptor-backed trusted, admin, webhook, account, cart, checkout, wishlist, subscription, order, and download surfaces.
Need Preferred surface
Product page reads createMika(Astro).catalog.sellables(...) in a host page.
Browser add/update/remove cart Astro Actions such as actions.mika.cart.add.
Checkout start Astro Action actions.mika.checkout.start, then redirect to provider URL.
Provider webhooks Host endpoint such as src/pages/api/mika-webhook/[provider].ts.
Admin buttons EmDash actions provider manifest and runner-backed trusted operations.
Public catalog/stock JSON The two public plugin JSON reads above.
  • ../emdash-mika/src/api/routes.ts
  • ../emdash-mika/src/api/route-handlers.ts
  • ../emdash-mika/src/api/operations.ts
  • ../emdash-mika/src/admin.ts