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

@ortha/admin-platform-core

v0.0.4

Published

Root shell of the admin application — provides the `CorePlugin`, `CoreApp` component, Zustand stores for auth and user state, an Axios-based HTTP client with token refresh, permission utilities, and the UI slot rendering infrastructure.

Readme

@ortha/admin-platform-core

Root shell of the admin application — provides the CorePlugin, CoreApp component, Zustand stores for auth and user state, an Axios-based HTTP client with token refresh, permission utilities, and the UI slot rendering infrastructure.

Installation

Internal monorepo dependency — import directly:

import { CoreApp, useAuthStore, httpClient } from '@ortha/admin-platform-core';

Usage

HTTP client

import { httpClient } from '@ortha/admin-platform-core';

// GET request — Bearer token is injected automatically
const users = await httpClient.get('/api/users');

// POST request
await httpClient.post('/api/projects', { name: 'New Project' });

Auth store (Zustand)

import { useAuthStore } from '@ortha/admin-platform-core';

const Component = () => {
    const { accessToken, login, logout } = useAuthStore();

    // login() stores tokens, logout() clears them
};

Permission checks

import { PermissionGuard, useHasPermission } from '@ortha/admin-platform-core';

// Hook-based check
const canEdit = useHasPermission(['update:admin:user']);

// Component guard
<PermissionGuard permissions={['create:admin:project']}>
    <CreateButton />
</PermissionGuard>

Rendering slot fills

import { SlotRenderer, SLOT_TOPBAR_NAV_MAIN_ACTIONS } from '@ortha/admin-platform-core';

// Renders all components registered for this slot, sorted by order
<SlotRenderer slotKey={SLOT_TOPBAR_NAV_MAIN_ACTIONS} />

API Reference

Components

| Export | Kind | Description | | ----------------- | --------- | ---------------------------------------------------------- | | CoreApp | component | Root React component — BrowserRouter, routes, layout | | ProtectedRoute | component | Route guard — redirects unauthenticated users | | SlotRenderer | component | Renders all fills for a named slot key | | PermissionGuard | component | Renders children only when user holds required permissions |

Stores

| Export | Kind | Description | | ---------------- | ----- | ------------------------------------------------- | | useAuthStore() | store | Zustand — JWT tokens, login/logout, token refresh | | useUserStore() | store | Zustand — current user data, roles, permissions |

Hooks

| Export | Kind | Description | | -------------------- | ---- | ---------------------------------------------------- | | useRouterService() | hook | Access routes — throws if used outside provider | | useSlotService() | hook | Access slots — throws if used outside provider | | useHasPermission() | hook | Returns true when user holds all given permissions |

Contexts

| Export | Kind | Description | | ---------------------- | ------- | --------------------------------------- | | RouterServiceContext | context | React context providing RouterService | | SlotServiceContext | context | React context providing SlotService |

Utilities

| Export | Kind | Description | | ------------------------------ | -------- | ---------------------------------------------------- | | httpClient | util | Custom Axios HTTP client with auth interceptors | | axiosInstance | util | Raw Axios instance (prefer httpClient) | | hasPermission() | util | Pure function — checks owned vs required permissions | | SLOT_TOPBAR_NAV_MAIN_ACTIONS | constant | Slot key for top navigation bar actions |

Internal Structure

src/lib/
├── corePlugin/index.ts             # CorePlugin definition
├── components/
│   ├── CoreApp/index.tsx           # Root app shell with routing
│   ├── PermissionGuard/index.tsx   # Permission-based visibility guard
│   ├── ProtectedRoute/index.tsx    # Auth route guard
│   └── SlotRenderer/index.tsx      # Generic slot renderer
├── contexts/
│   ├── index.ts                    # Barrel
│   ├── RouterServiceContext/index.ts
│   └── SlotServiceContext/index.ts
├── hooks/
│   ├── index.ts                    # Barrel
│   └── useHasPermission/index.ts   # Permission check hook
├── stores/
│   ├── authStore/index.ts          # Zustand + persist (localStorage)
│   └── userStore/index.ts          # Zustand user state
├── utils/
│   ├── index.ts                    # Barrel
│   └── hasPermission/index.ts      # Pure permission matching logic
├── httpClient/index.ts             # Axios instance + interceptors
└── slots/index.ts                  # Slot key constants

Key Patterns

  • httpClient interceptors: request interceptor injects Bearer token from useAuthStore; response interceptor handles 401 with a token refresh queue (prevents concurrent refresh calls).
  • Auth store uses zustand/persist with localStorage for token persistence across page reloads.
  • Context hooks throw descriptive errors if used outside their providers.
  • CorePlugin is auto-prepended by bootstrap — never include it manually in the plugins array.
  • Lazy loading: route components should use lazy(() => import(...)) with <Suspense>.

Dependencies

  • @ortha/admin-platform-plugin-registry — plugin types and services
  • @ortha/design-system — theme provider and components

Building

nx build admin-platform-core