Skip to main content
Version: 0.8.0

Quickstart

Read a singleton content module from a server-rendered page or API route.

1. Install the SDK​

pnpm add @lazrus/nukle

2. Create a website API key​

In Studio, create a website-scoped API key. It can read only this website's enabled content and media, so it may be used in browser code when that data is intended for visitors. Browser reads are accepted only from the domain configured for the website in Studio.

NUKLE_API_KEY=nukle_live_your_key

3. Read content​

import { createNukleClient } from '@lazrus/nukle';

const nukle = createNukleClient({
apiKey: process.env.NUKLE_API_KEY!,
});

const hero = await nukle.getSingleton<{
title: string;
subtitle: string;
}>('hero');

The SDK defaults to https://api.nukle.in. Point it at the local API during development:

const nukle = createNukleClient({
apiKey: process.env.NUKLE_API_KEY!,
baseUrl: 'http://localhost:3001',
});

Continue with content reads or public forms.