Overview
Login with Connect, entitlements, billing and metering for your application.
@cosmoops/connect-sdk is the official client for the CosmoOps Connect
application-partner API (/api/v1/application/*). It covers Login with Connect (OAuth2),
entitlement/readiness gates, plan and subscription reads, usage metering, and
a set of drop-in React components — and nothing outside that surface;
Connect's internal admin API is deliberately out of scope.
npm install @cosmoops/connect-sdkNew here? Start with Getting started — a working Next.js integration in two files.
Six entry points
The split between them is a security boundary, not a stylistic choice.
| Import | Runs in | Holds the API key |
|---|---|---|
@cosmoops/connect-sdk | anywhere | never — types, ConnectError, pure helpers |
@cosmoops/connect-sdk/server | your backend | yes |
@cosmoops/connect-sdk/next | your backend | yes — Next.js plug-and-play |
@cosmoops/connect-sdk/mcp | your backend | yes — your store, as MCP tools |
@cosmoops/connect-sdk/client | the browser | never |
@cosmoops/connect-sdk/ui | either | never — presentational, no "use client" |
@cosmoops/connect-sdk/theme.css is the seventh and is not code: the one
shared HeroUI theme every component here is drawn against.
The browser half never sees a credential. It calls your own origin, and
createConnectHandler — mounted in your backend — is what actually talks to
Connect:
Browser ──► your backend ──► Connect
(client) (createConnectHandler + server client, holds the key)Where to go next
- Getting started — install, wrap two files, done.
Walks through the same integration
connect-example— the reference Next.js app — actually ships. - Environments — the four environment variables, which Connect instance you talk to, and what a local setup needs that a deployed one doesn't.
- Authentication & authorization — the OAuth2
round trip,
proxy.tsroute protection, and role/entitlement-based access control. - Webhooks — the events Connect sends, how to verify them, the retry ladder, and how to debug a delivery that never arrived.
- MCP — register an endpoint of your own, and Connect's assistant can answer from inside your product, as the member asking.
- Concepts — the four models an integration has to get right: plans and free tiers, features and add-ons, permissions and roles, and the deletion policy your application declares.
- API reference — every
/api/v1/application/*endpoint, by module, with the scope each one needs. Generated from the live schema, so it cannot drift from what the server accepts. - SDK reference — every type and method across every entry point, generated straight from the SDK's own source.