Athas Boilerplate

@athas/shared-api

external-ready

Shared auth and oRPC client utilities for first-party frontends.

What it provides

  • Better Auth client factory (createAthasAuthClient)
  • oRPC client factory (createAthasOrpcClient)
  • shared auth/session integration utilities

Where it fits now

@athas/shared-api is the frontend composition layer that wires multiple core packages for app bootstrap:

  • @athas/auth-core for AuthN/AuthZ-facing types and capability checks
  • @athas/telemetry-core for provider-agnostic telemetry routing
  • contract-typed transport via @athas/contracts

Boundary direction

Keep shared-api focused on frontend composition and adapters, while domain/runtime logic moves into dedicated cores.

Examples:

  • auth/session domain rules -> @athas/auth-core
  • telemetry routing rules -> @athas/telemetry-core
  • notification/integration runtime contracts -> dedicated core packages

Contract typing model

  • Uses AthasOrpcContract from @athas/contracts.
  • Uses ContractRouterClient for strongly typed client calls.

This keeps frontend transport calls aligned with backend contract namespaces (public, client, admin).

Usage pattern

  • App bootstrap wiring lives in apps/*/src/lib/api.ts.
  • Feature modules call oRPC through features/*/api.ts.
  • Routes/screens consume feature hooks, not transport clients directly.

On this page