@dani-builder/strapi-client
v0.5.0
Published
TypeScript client for Daniworks Builder CMS (Strapi v5)
Downloads
407
Maintainers
Readme
@dani-builder/strapi-client
TypeScript client for the Daniworks Builder
CMS (Strapi v5). Hand-curated types, deep-populate builders, and SSR-safe API
functions for every content type — pairs with
@dani-builder/strapi-plugin-builder.
Install
pnpm add @dani-builder/strapi-clientESM-only ("type": "module").
Usage
Every API function takes an AxiosInstance (no singleton — SSR-safe):
import { createStrapiClient } from "@dani-builder/strapi-client/client";
import { getPageBySlug, getGlobal } from "@dani-builder/strapi-client/api";
const strapi = createStrapiClient({
baseUrl: process.env.STRAPI_URL,
apiToken: process.env.STRAPI_TOKEN,
});
const page = await getPageBySlug(strapi, "about");
const global = await getGlobal(strapi);
// Editor preview: pass status: "draft" (authenticated requests only).
const draft = await getPageBySlug(strapi, "about", { status: "draft" });Sub-exports
| Import | Contents |
|--------|----------|
| @dani-builder/strapi-client/types | Hand-curated content-type & block types |
| @dani-builder/strapi-client/client | createStrapiClient |
| @dani-builder/strapi-client/api | 19 API functions |
| @dani-builder/strapi-client/populate | 15 block populate builders |
| @dani-builder/strapi-client/utils | Media URL helpers |
See docs/block-reference.md for the full block schema.
License
MIT © HJ-company
