@clowk/core
@clowk/core is the runtime-agnostic base for every Clowk JavaScript SDK: config, errors, a fetch HTTP client, API client and JWT verification.
Install
npm install @clowk/coreOverview
The foundation package. Runtime-agnostic — works in Node.js, Bun, Deno, Cloudflare Workers, and browsers.
What it provides:
- Configuration singleton with sensible defaults
- Error hierarchy (
ClowkError,ConfigurationError,InvalidStateError,InvalidTokenError) - HTTP client built on native
fetchwith middleware stack (timeout, retry, logger) - SDK Client with resource-oriented API:
users,sessions,subdomains,tokens - JWT verification (HS256 via jose) with issuer validation and expiration check
- Token extraction (params, bearer header, cookie)
Configure
import { configure } from '@clowk/core'
configure({
publishableKey: 'pk_live_...',
secretKey: 'sk_live_...',
})Verify a token
import { verifyToken } from '@clowk/core'
const user = await verifyToken(token)
// => { id, email, name, provider, iat, exp }Architecture
All Clowk SDKs depend on @clowk/core:
@clowk/core
├── @clowk/sdk
├── @clowk/react
├── @clowk/express
├── @clowk/hono
└── @clowk/nextjsFramework packages are thin wrappers that adapt core to each framework's conventions.
Errors
Clowk SDK errors explained, such as ConfigurationError, InvalidStateError and InvalidTokenError, plus HTTP status codes and how to fix and handle each one.
@clowk/sdk
@clowk/sdk re-exports everything from @clowk/core under one clean import path, for JavaScript apps that want a single dependency for Clowk authentication.