This is the official Starlight SDK for websites and JavaScript applications, which makes integrating Starlight content into your apps a real breeze.
You can read the usage guide and the API reference in its documentation page.
To quickly start using the JS SDK, install it into your project:
npm install @starlightcms/js-sdk
Then, import the SDK and configure which Starlight workspace it should request data from:
import Starlight from '@starlightcms/js-sdk'
Starlight.configure({
workspace: '1234567890'
})
And, finally, start requesting data:
import Starlight from '@starlightcms/js-sdk'
// Listing all entries from the 'posts' model.
const response = Starlight.posts.entries.list()
// Getting content from the 'hello-world' entry.
const response = Starlight.posts.entries.get('hello-world')
The SDK is capable of requesting a myriad of different content from your workspaces. Check out the documentation to learn more.
If you use React on your application, take a look at the Starlight React SDK. It's based in the JS SDK, and also provide useful React components to simplify content and image rendering.
If you have any questions or you're facing any issues with the SDK, feel free to open an issue.