npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@naranja-labs/the-orange-cms-sdk

v0.2.3

Published

SDK for The Orange CMS — fetch and render CMS-managed text content

Downloads

440

Readme

@naranja-labs/the-orange-cms-sdk

SDK for The Orange CMS — fetch and render CMS-managed text content in your website.

Install

bun add @naranja-labs/the-orange-cms-sdk
# or
npm install @naranja-labs/the-orange-cms-sdk

Quick Start

1. Create a CMS client

import { createCMSClient } from "@naranja-labs/the-orange-cms-sdk";

const cms = createCMSClient({
  baseUrl: "https://your-cms.example.com",
  siteSlug: "my-site",
  apiKey: "your-site-api-key",
});

2. Fetch page content

const page = await cms.getPage("homepage");
// { site: "my-site", page: "homepage", sections: { "hero/title": "Welcome", ... } }

const title = await cms.getSection("homepage", "hero/title");
// "Welcome"

3. Render with React

import { Content } from "@naranja-labs/the-orange-cms-sdk/react";

// You control the HTML structure — the CMS provides the text
<h1><Content content={page} section="hero/title" /></h1>
<p><Content content={page} section="hero/subtitle" /></p>
<a href="/signup"><Content content={page} section="hero/cta" /></a>

The <Content> component renders a <span> with the section text. Wrap it in your own elements to control structure.

API Reference

createCMSClient(config)

Creates a CMS client instance.

interface CMSClientConfig {
  baseUrl: string;   // CMS API URL
  siteSlug: string;  // Your site's slug
  apiKey: string;    // Site API key from the CMS admin
}

Returns an object with:

  • getPage(page: string) — Fetches all sections for a page. Returns { site, page, sections }.
  • getSection(page: string, path: string) — Fetches a single section's text. Throws if the section doesn't exist.

<Content> Component

import { Content } from "@naranja-labs/the-orange-cms-sdk/react";

| Prop | Type | Description | |------|------|-------------| | content | CMSPageContent | Page data from getPage() | | section | string | Section path (e.g. "hero/title") | | className | string? | Optional CSS class for the wrapper <span> |

Returns null if the section doesn't exist. Renders a <span> with a data-cms-section attribute for preview integration.

HTML sanitization: Content with inline HTML (<strong>, <em>, <a>, <b>, <i>, <br>) is sanitized with an allowlist before rendering. Dangerous elements (<script>, event handlers, javascript: URIs) are stripped.

initPreview(options?)

import { initPreview } from "@naranja-labs/the-orange-cms-sdk/preview";

Enables bidirectional sync between the CMS editor and your site when loaded in the preview iframe. Auto-activates inside iframes, or call manually:

initPreview({ parentOrigin: "https://your-cms.example.com" });

| Option | Type | Description | |--------|------|-------------| | parentOrigin | string? | CMS editor origin for secure postMessage. Falls back to document.referrer. |

Content Model

The CMS stores page content as delimited text files:

<!-- @hero/title -->
Welcome to Our Site

<!-- @hero/subtitle -->
The <strong>best</strong> platform for your needs

<!-- @hero/cta -->
Get Started Today
  • Section paths use / as separator (e.g. hero/title, features/card-1)
  • Content is plain text or inline HTML (<strong>, <em>, <a>)
  • Developers control HTML structure; the CMS manages text

Requirements

  • React 19+ (optional — only needed for @naranja-labs/the-orange-cms-sdk/react)
  • Works in any JavaScript runtime (Node.js, Bun, Deno, browsers)

License

MIT