Skip to content

TIP

This page mirrors packages/api/README.md from the repository. Edit it at the source, not here.

@saasweave/api

oRPC API layer: typed procedures, console/admin/platform routers, Stripe billing HTTP surface, storage HTTP adapters, and client boundaries.

Router shape

ts
appRouter = {
  admin, // platform operators
  console, // organization workspace
  health, // readiness probes
  platform, // public status, signups policy
  private // stub for future internal APIs
};

Package boundaries

ConcernOwner
oRPC routers, request context, HTTP authpackages/api
Stripe webhook DB application, exports, batch processingpackages/app
BullMQ processorspackages/jobs
Worker process lifecycleapps/worker

Client exports

SubpathRuntimeUse
client/browser/orpcBrowser onlyHTTP RPCLink client
client/server/orpcSSR / server onlyIn-process createRouterClient
client/tanstack-start/orpcIsomorphicTanStack Start loaders + browser (dynamic import split)

SSR loaders use the in-process server client; browser hydration uses HTTP. See docs/PACKAGE-DEPENDENCY-GRAPH.md.

Key server exports

  • @saasweave/api/routers/indexappRouter
  • @saasweave/api/lib/stripe — checkout, portal, webhook verification
  • @saasweave/api/lib/stripe-dispatch — enqueue / inline Stripe jobs
  • @saasweave/api/lib/storage — re-exports @saasweave/app/storage for HTTP routes
  • @saasweave/api/lib/data-export/download — authorized export download handler

Outbound webhook policy

Tenant webhook endpoints may use HTTP port 80 or HTTPS port 443 only. This is an intentional SSRF control that prevents the webhook worker from becoming a general-purpose port probe. Deploy webhook receivers on a standard web port or place a reverse proxy in front of a nonstandard upstream port.

Tests

bash
pnpm --filter @saasweave/api test:unit

Released under the MIT License.