Skip to content

Quickstart

You need a project and an API key. Create a key in the dashboard (see API keys), or mail info@gem0.dev if you don’t have a project yet.

Put the API base URL and your project key in .env:

GEM_URL=https://sdk.gem0.dev
GEM_KEY=your-project-api-key
Terminal window
bun add @gemzero0/sdk-core
bunx gemsync

GemSync fetches the generated router for your project and writes gemRouter.ts in the current directory. Commit it; it’s plain TypeScript.

import { createGemClient } from "@gemzero0/sdk-core";
import type { GemRouter } from "./gemRouter";
const gem = createGemClient<GemRouter>({
url: process.env.GEM_URL!,
key: process.env.GEM_KEY!,
});
const { results: posts } = await gem.tables.posts.all.query({ limit: 10 });
// ^? typed from your schema

Rename a field in the CMS, rerun bunx gemsync, and the compiler shows every place in your code that needs updating.