Astra SDK Studio v6.0.0
SDK Ready

Interactive SDK Workspace for Blogs & Headless CMS

Explore, test, and integrate both AstraBlogsLib (Blogs SDK) and AstraCmsLib (Headless CMS) in real-time with AES-GCM encrypted tokens, client-side caching, and live console inspection.

Repository Access Credentials
Zero server roundtrips • Client AES-GCM Decryption
playground.js
Run Shortcut: Ctrl + Enter
PRESETS:
Tip: Press Ctrl + Enter to execute
Console Output
Click "Execute Code" or any API method card to run live...
new AstraBlogsLib(config) CONSTRUCTOR

Initializes the library instance with encrypted token and decryption secret.

const blogsLib = new AstraBlogsLib({ token, secret, useCache: true });
getAllBlogs(options?) GET

Fetch the blog metadata index from GitHub with client-side caching.

const blogs = await blogsLib.getAllBlogs({ includeDrafts: false });
getBlogContent(slug) GET

Fetch markdown body and parsed YAML frontmatter for a specific post.

const blog = await blogsLib.getBlogContent(slug);
convertMarkdownToHtml(md) RENDER

Render markdown content to clean HTML with optional styled wrapper.

const { html, styledHtml } = blogsLib.convertMarkdownToHtml(md);
getAllCovers() / getCoverUrls() ASSETS

Extract all unique cover image URLs from repository blogs.

const covers = await blogsLib.getAllCovers();
searchBlogs(blogs, query) SEARCH

Multi-field text search matching title, description, and tags.

const results = blogsLib.searchBlogs(blogs, 'react');
filterByTags(blogs, tags, mode) FILTER

Filter blogs with OR ('any') or AND ('all') tag matching.

const filtered = blogsLib.filterByTags(blogs, ['react', 'web'], 'any');
getRecommendations(blogs) AI / RANK

Calculate weighted recommendations based on reading history tags.

const recs = blogsLib.getRecommendations(blogs, { count: 3 });
trackReadBlog() & Preferences TRACKING

Track user interactions to build recommendation preferences.

blogsLib.trackReadBlog(['react'], 1);
Configuration & Cache SYSTEM

Inspect configuration, listen to events, or evict storage cache.

blogsLib.clearCache('astra_');
new AstraCmsLib(config) CMS CLASS

Standalone Headless CMS client for models, schemas, and dynamic records.

const cms = new AstraCmsLib({ token, secret });
cms.getModels(options?) SCHEMAS

Fetches all defined template models (schemas) from cms/models.json.

const models = await cms.getModels();
cms.getModel(modelId) SCHEMA

Find a specific CMS model schema by its unique ID or display name.

const teamModel = await cms.getModel('team_members');
cms.getData(modelId, options?) RECORDS

Fetch all data records or single document from cms/data/{modelId}.json.

const data = await cms.getData('team_members');
cms.getDocument(modelId) SINGLE DOC

Fetch a single-document CMS object (e.g. Privacy Policy, Cookie Policy).

const doc = await cms.getDocument('privacy-policy');
cms.getRecord(modelId, recordId?) RECORD

Retrieve a single CMS data record by its unique identifier.

const rec = await cms.getRecord('team_members', 'rec_123');
cms.searchData(modelId, query) SEARCH

Search records across text, tags, JSON objects, or specific fields.

const matches = await cms.searchData('team_members', 'Lead');
cms.filterData(modelId, criteria) FILTER

Query records using an object match { role: 'Engineer' } or predicate function.

const active = await cms.filterData('team_members', { isActive: true });
cms.clearCache(pattern?) CACHE

Evict cached CMS models and data records without wiping blog cache.

cms.clearCache('astra_cms_');
Real-time SDK Lifecycle Events
  • [Init] READY SDK Telemetry bus initialized. Perform operations to view live events.
Action executed successfully