@chio-studios/hub
v0.10.0
Published
Official client for CHIO HUB: announcements, release highlights, changelog, feedback, waitlist and cookieless analytics.
Maintainers
Readme
@chio-studios/hub
Official client for CHIO HUB, the service that carries announcements, release highlights, changelog, feedback, waitlist and cookieless analytics for a product.
Availability
CHIO HUB is a hosted service operated by Chio Studios. It is not open source, and it is not generally available. There is no sign-up today, and this package cannot create an account for you.
It is published openly so that the products already running on CHIO HUB can install their client
with a plain npm install, without a private registry. Every call in here is answered by a hub
instance, so without one that knows your product slug you will get a 404 and nothing else.
Questions: [email protected].
What it covers
| Feature | What the product gets | | --- | --- | | Announcements | Notices maintained centrally, shown in-app or on the website | | What's new | Release highlights, filtered by the version the client reports | | Changelog | Published release notes for a public page | | Feedback | Submissions from inside the product, triaged in the hub | | Waitlist | Double opt-in signup and the perk a subscriber earned | | Analytics | Pageviews and custom events, no cookies and no device storage |
Install
npm install @chio-studios/hub
# pnpm add @chio-studios/hubReact is a peer dependency (18 or 19) and only needed for the hooks. The client itself has none.
Use it
React
import { HubProvider, useAnnouncements } from '@chio-studios/hub';
export function Root({ children }) {
return (
<HubProvider config={{ baseUrl: 'https://hub.example.com/api', product: 'your-product' }}>
{children}
</HubProvider>
);
}
function Banner() {
const { data, isLoading } = useAnnouncements();
if (isLoading || !data.length) return null;
return <aside>{data[0].title}</aside>;
}Hooks: useAnnouncements, useWhatsNew, useChangelog, useCreateFeedback, useWaitlist,
useTracker, and useHub for anything without a hook of its own.
Without React
Every feature is a plain function, so a server or a script can use the same client. This is also the only way to reach the calls a product makes as itself rather than on behalf of a visitor. Those need an API key and therefore never belong in a browser bundle.
import { createHubClient } from '@chio-studios/hub';
const hub = createHubClient({
baseUrl: 'https://hub.example.com/api',
product: 'your-product',
apiKey: process.env.HUB_API_KEY, // server side only
});
const perk = await hub.claimWaitlistPerk('[email protected]');Analytics
const { trackPageview, trackEvent } = useTracker();
useEffect(() => trackPageview(pathname), [pathname]);
trackEvent('signup_started');No cookie, no localStorage, no fingerprint. A hit is a request to the hub and nothing else, which
is what lets the measurement run without a consent banner in the EU. Anything the tracker stored on
the device would change that, so it stores nothing.
The one exception is the objection itself:
import { setTrackingOptOut, isTrackingOptOut } from '@chio-studios/hub';
setTrackingOptOut(true); // remembered per browsertrack() also honours Global Privacy Control and Do Not Track without being asked to.
Configuration
| Field | Required | What it is |
| --- | --- | --- |
| baseUrl | yes | Base URL of the hub API, e.g. https://hub.example.com/api |
| product | yes | Product slug, assigned by the hub |
| site | no | Site slug, only for the page-bound features (feedback, changelog) |
| apiKey | no | For product-level calls. Server side only. |
Stability
Versioned with the hub itself, so a minor release can still change a signature while the hub is below 1.0. Pin an exact version if that matters to you.
Issues: github.com/Chio-Studios/hub-mono. The hub's own source is not public.
License
UNLICENSED. Published for use with CHIO HUB, all rights reserved by Chio Studios.
