Capxul Docs
Explanation

The Core SDK client model

Why Capxul uses one bootstrap-resolved client with domain method bundles.

The Core SDK presents one client because configuration, session state, Account readiness, and observation all belong to the same application boundary. A client is created once, closes over resolved platform configuration, and offers product-level method bundles.

publishable key + requirement + optional signer/observation
                         |
                         v
                  createCapxulClient
                         |
             bootstrap + production adapters
                         |
                         v
                    CapxulClient
       auth | accounts | payments | org(id) | ...
                         |
                  CapxulResult<T>

Domain bundles, not transport endpoints

Consumers ask for client.accounts.read() or client.payments.pay(...). They do not choose a Convex route, build an Effect layer, provide an RPC URL, or pass a chain ID. This keeps application code in Capxul vocabulary while adapters remain replaceable behind the boundary.

One chain context per client

Bootstrap resolves chain and service configuration. Methods close over that resolution, so accepting chainId on every call would create contradictory state. Multi-environment or multi-chain applications create separate clients from separate bootstraps rather than mutating one client.

Readiness is creation policy

requirement declares how ready the signed-in user's Account should become. The auth and Account lanes can then coordinate after OTP verification without every money method needing a setup option.

Organization scope is explicit

Unlike bootstrap configuration, Organization choice changes per operation. It therefore remains explicit:

client.org(firstOrgId).members();
client.org(secondOrgId).members();

There is no mutable active Organization on the client. This prevents concurrent requests from silently changing each other's authorization context.

React is a projection

The React package creates or receives this same client, then adds render lifecycle, TanStack Query caching, invalidation, and hooks. It does not define the core domain API. Non-React consumers lose no domain capability by using the Core SDK package directly.

On this page