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

@nubitio/core

v0.5.11

Published

Runtime foundation for Nubit: HTTP client, event bus, i18n, Mercure SSE, CoreProvider, and date utilities.

Readme

@nubitio/core

Runtime foundation for the Nubit admin stack: HTTP client, event bus, i18n integration, date utilities, Mercure (SSE) support, and the CoreProvider.

Install

npm install @nubitio/core

Peer dependencies

"i18next": "^23",
"react": "^19",
"react-dom": "^19",
"react-i18next": "^14"

Quick start

import { CoreProvider } from '@nubitio/core';

export function App() {
  return (
    <CoreProvider
      apiBaseUrl="https://api.example.com"
      timezone="UTC"
      locale="en"
    >
      {/* your app */}
    </CoreProvider>
  );
}

Timezone handling

Timezone (and other core settings) are configured once via CoreConfigProvider (recommended) or configureCore():

<CoreConfigProvider locale="es" timezone="America/Santiago">
  <App />
</CoreConfigProvider>
  • getCoreTimezone() and DateUtils read from this config (works in React and non-React code).
  • Default is UTC. Use DEFAULT_TIMEZONE only as a fallback constant if you need one outside the provider.

API Base URL

The base URL for your API is configured the same way as locale and timezone:

<CoreConfigProvider
  locale="es"
  timezone="America/Santiago"
  apiBaseUrl="https://api.example.com/api/"
>
  <App />
</CoreConfigProvider>
  • Use getCoreApiBaseUrl() to read it from anywhere (including at module top level inside defineResource, entityField, etc.).
  • When you create an HTTP client via CoreProvider / CoreHttpProvider without explicitly passing baseUrl, it will automatically use the value from CoreConfig.
  • Default: /api/

This design allows the Nubit packages to be used in other projects with almost zero configuration beyond the provider.

HTTP client & authentication strategies

CoreHttpClient includes a built-in convenience refresh loop for cookie-based auth (the most common case for API Platform backends).

const httpConfig = {
  baseUrl: 'https://api.example.com',
  refreshPath: 'auth/refresh',
  loginPath: 'auth/login',
  // autoRefresh: true  (default)
};

For other auth models (Bearer JWT, custom headers, OAuth, etc.) we strongly recommend:

<CoreProvider
  http={{
    baseUrl: '...',
    autoRefresh: false,           // disable built-in cookie refresh
    onUnauthorized: (err) => {
      // your global logout / redirect logic
      authStore.logout();
    },
  }}
>

You can also provide a full refreshFn if you want the client to still participate in refresh, but with your own logic (e.g. refreshing a Bearer token).

See CoreHttpClientConfig for all options.

Key exports

| Export | Description | |--------|-------------| | CoreProvider | Root provider — wraps HTTP, i18n, React Query, and runtime config | | CoreHttpClient | Type-safe HTTP client with error normalisation + pluggable auth refresh | | dispatch / useEvents | Lightweight event bus for cross-component communication | | createCrudEvents | Factory for typed CRUD event sets | | MercureProvider | Real-time SSE integration via Mercure hub | | DateUtils | Timezone-aware date formatting powered by Luxon | | coreTranslationsEs / coreTranslationsEn | Built-in translations for Spanish and English |