Clients
Plug
A one-way HTTP client from your app to an external API. Auth, retry, pagination, typed vars, and lifecycle hooks — built for serverless.
your app
authed
stripe api
Install
terminal
$ npx khotan add plug// Bearer token ─────────────────────────────────────────────────────import { plug, bearer } from "@/lib/khotan/plugs/plug"; export const stripe = plug({ baseUrl: "https://api.stripe.com/v1", auth: bearer(process.env.STRIPE_SECRET_KEY!),}); const customers = await stripe.get<{ data: Customer[] }>("/customers"); // API key ──────────────────────────────────────────────────────────import { plug, apiKey } from "@/lib/khotan/plugs/plug"; export const cin7 = plug({ baseUrl: "https://api.cin7.com/api/v1", auth: apiKey("Authorization", process.env.CIN7_API_KEY!), retry: { attempts: 3, backoff: 1000 }, timeout: 30000,}); // Basic auth ───────────────────────────────────────────────────────import { plug, basic } from "@/lib/khotan/plugs/plug"; export const jira = plug({ baseUrl: "https://myorg.atlassian.net/rest/api/3", auth: basic(process.env.JIRA_EMAIL!, process.env.JIRA_TOKEN!),});What to expect from add
Running npx khotan add plug scaffolds one or more files into your khotan runtime, React component directory, or app routes depending on the component. khotan may also prompt to install dependent components, npm packages, shadcn pieces, or Workflow integration when this component needs them.
Usage
Use the generated builder or UI inside your khotan setup and operational surfaces. For live runtime inspection, pair this component with the CLI and the built-in docs markdown routes.
Next steps
- Preview the component in the visual gallery.
- Learn how schemas are managed via the Drizzle integration.
- Read the Agent Guide for the built-in khotan skills and crawlable markdown routes.
- Star us on GitHub to follow along as components ship.