TypeScript SDK for the Sprinkle developer cloud platform.
Includes a fully typed React Query client, Zod validation schemas, and the OpenAPI spec that drives them both.
| Package | Description |
|---|---|
@sprinkle/client |
React Query hooks and typed fetch client |
@sprinkle/zod |
Zod schemas generated from the OpenAPI spec |
@sprinkle/spec |
OpenAPI 3.1 specification and codegen config |
# React projects
pnpm add @sprinkle/client @tanstack/react-query
# Validation only
pnpm add @sprinkle/zod zodimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useGetProjects, useCreateApiKey } from '@sprinkle/client';
const client = new QueryClient();
function App() {
return (
<QueryClientProvider client={client}>
<Dashboard />
</QueryClientProvider>
);
}
function Dashboard() {
const { data: projects } = useGetProjects();
return <pre>{JSON.stringify(projects, null, 2)}</pre>;
}Set your API base URL and key before using the client:
import { setBaseUrl, setApiKey } from '@sprinkle/client';
setBaseUrl('https://api.sprinkle.network');
setApiKey('sk_live_...');The client and Zod schemas are generated from the OpenAPI spec using Orval.
cd packages/spec
pnpm codegen # Regenerate client and schemas from openapi.yamlpnpm install
pnpm build # Build all packages
pnpm typecheck # Type-check all packagesSee CONTRIBUTING.md.
MIT. See LICENSE.