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

@sandtreader/rafiki

v0.2.0

Published

Rafiki React Administration Framework

Readme

Rafiki React Administration Framework

A lightweight React framework for creating administration / management portals.

Features

  • Pluggable authentication — swap between JWT, fake (dev), or custom providers
  • Pluggable menu generation — static or dynamically loaded menu structures
  • Capability-based access control — glob-pattern requirements on menu items
  • Generic CRUD components — type-safe list, form, and list+edit page components built on Material-UI

Installation

npm install @sandtreader/rafiki

Peer dependencies: React 18, MUI 5, Emotion.

Quick start

import {
  Framework,
  FakeAuthenticationProvider,
  StaticMenuProvider,
  MenuStructure,
} from '@sandtreader/rafiki';

const authProvider = new FakeAuthenticationProvider();
const rootMenu = new MenuStructure('root', 'root');
const menuProvider = new StaticMenuProvider(rootMenu);

function App() {
  return (
    <Framework
      authProvider={authProvider}
      menuProvider={menuProvider}
      title="My Admin Portal"
    />
  );
}

Core concepts

Framework

The top-level Framework component provides the app shell (AppBar + Drawer + content area) and manages the login/logout flow.

<Framework
  authProvider={authProvider}
  menuProvider={menuProvider}
  title="My Portal"
  onSessionChange={(session) => console.log(session)}
/>

Authentication providers

Implement AuthenticationProvider for custom auth:

interface AuthenticationProvider {
  login(userId: string, password: string): Promise<SessionState>;
  logout(session: SessionState): Promise<void>;
}

Built-in providers:

  • JWTAuthenticationProvider(url) — POST credentials to a URL, expects a JWT response
  • FakeAuthenticationProvider — dev-only (credentials: admin/admin or test/foo)

Menu structure

Menus are hierarchical and defined as MenuStructure objects. Use fromLiteral() for concise definitions:

const menu = MenuStructure.fromLiteral({
  id: 'users', name: 'Users', icon: 'people',
  requirements: ['admin.*'],
  content: <UsersPage />,
  children: [
    { id: 'roles', name: 'Roles', icon: 'badge', content: <RolesPage /> },
  ],
});
  • icon — Material Design icon name
  • requirements — glob patterns matched against the session's capabilities array; item is hidden if the user lacks a matching capability
  • content — JSX element or factory function (item: MenuStructure) => JSX.Element

Menus support dynamic loading (webpack dynamic imports) — see src/example/App.tsx.

ListEditPage

A complete CRUD interface combining list view, search/filter, and form dialogs:

<ListEditPage<User>
  typeName="User"
  fetchItems={() => api.getUsers()}
  createItem={(id) => api.createUser(id)}
  cloneItem={(source, newId) => api.cloneUser(source, newId)}
  saveItem={(item, old) => api.saveUser(item)}
  deleteItem={(item) => api.deleteUser(item)}
  columns={[
    { key: 'id', label: 'ID' },
    { key: 'name', label: 'Name' },
  ]}
  fields={[
    { key: 'id', label: 'ID', validate: (v) => !!v },
    { key: 'name', label: 'Name' },
  ]}
/>

BasicForm

Multi-intent form that renders differently based on FormIntent (View, ViewWithEdit, Edit, Create). Supports custom field rendering, validation, and array fields displayed as chips, tables, or checklists (BasicFormFieldArrayStyle).

FormIntent lifecycle

Components use FormIntent to drive their behaviour:

| Intent | Behaviour | |--------|-----------| | View | Read-only display | | ViewWithEdit | Read-only with an edit button | | Edit | Editable fields, save/cancel | | Create | Editable fields for a new item |

Types

All domain objects must implement HasUniqueId:

interface HasUniqueId {
  id: string | number;
}

Development

npm install
npm start            # run the example app
npm test             # run tests (watch mode)
npm run lint         # check formatting
npm run format       # auto-format
npm run build:lib    # build library to dist/
npm run publish:lib  # build + publish to npm