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.
1. Configure your environment
Section titled “1. Configure your environment”Put the API base URL and your project key in .env:
GEM_URL=https://sdk.gem0.devGEM_KEY=your-project-api-key2. Install the SDK and generate types
Section titled “2. Install the SDK and generate types”bun add @gemzero0/sdk-corebunx gemsyncGemSync fetches the generated router for your project and writes
gemRouter.ts in the current directory. Commit it; it’s plain TypeScript.
3. Create a client and query
Section titled “3. Create a client and query”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 schemaRename a field in the CMS, rerun bunx gemsync, and the compiler shows every
place in your code that needs updating.
Next steps
Section titled “Next steps”- Querying content for
find,where, writes and query options. - Collections and fields for modelling.
- Using React or Next.js? See the React and Next.js helpers.