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

@mbc-cqrs-serverless/master-web

v0.0.44

Published

Master components library for MBC CQRS Serverless Master Web

Downloads

876

Readme

@mbc-cqrs-serverless/master-web

A comprehensive React component library for building master data management interfaces, designed for Next.js applications using the MBC CQRS Serverless framework.

Features

  • Dynamic Form Generation - Forms are automatically generated based on master setting field definitions
  • Rich Field Types - string, number, boolean, date, array, json, text-area, text-html (rich text), text-markdown, auto_number
  • Advanced Data Table - Server-side pagination, sorting, and filtering powered by TanStack Table
  • Drag & Drop - Reorder fields in master settings with dnd-kit
  • Real-time Updates - AWS AppSync subscriptions for async task monitoring
  • Role-Based UI - Support for system_admin and tenant user segments
  • Bulk Operations - JSON editor for bulk imports and raw data handling
  • Data Portability - Copy master settings and data across tenants
  • TypeScript - Full type definitions included

Installation

npm install @mbc-cqrs-serverless/master-web

Core Components

| Component | Description | | -------------------- | ---------------------------------------------------------------------------- | | MasterSetting | List of master setting definitions with search and pagination | | EditMasterSettings | Form for creating/editing master setting schemas with a dynamic fields table | | MasterData | Data table for records conforming to a master setting's schema | | EditMasterData | Dynamically generated form for creating/editing master data records | | AppProviders | Provider setup component wrapping all required contexts | | MsLayout | Layout wrapper with optional loading indicator | | UrlProvider | URL routing configuration interface (IUrlProvider) |

Quick Start

1. Create a layout file

Set up providers in a layout to ensure context is initialized before child components mount.

// app/admin/[tenant]/master/layout.tsx
'use client'

import { useMemo } from 'react'
import dynamic from 'next/dynamic'
import { useParams } from 'next/navigation'
import axios from 'axios'
import { fetchAuthSession } from 'aws-amplify/auth'
import type { IUrlProvider } from '@mbc-cqrs-serverless/master-web/UrlProvider'

const AppProviders = dynamic(
  () =>
    import('@mbc-cqrs-serverless/master-web/AppProviders').then(
      (mod) => mod.AppProviders
    ),
  { ssr: false }
)

// Implement IUrlProvider for your application's routing
class MasterUrlProvider implements IUrlProvider {
  // ... define all required URL properties
}

export default function MasterLayout({
  children,
}: {
  children: React.ReactNode
}) {
  const params = useParams<{ tenant: string }>()
  const tenantCode = params?.tenant || 'common'

  const urlProvider = useMemo(
    () => new MasterUrlProvider(tenantCode),
    [tenantCode]
  )

  const httpClient = useMemo(() => {
    const instance = axios.create({
      baseURL: `${process.env.NEXT_PUBLIC_API_ENDPOINT}/api`,
      headers: {
        'Content-Type': 'application/json',
        'x-tenant-code': tenantCode,
      },
    })

    instance.interceptors.request.use(async (config) => {
      try {
        const session = await fetchAuthSession()
        const token = session.tokens?.idToken?.toString()
        if (token) config.headers.Authorization = `Bearer ${token}`
      } catch {}
      return config
    })

    return instance
  }, [tenantCode])

  const user = useMemo(
    () => ({ tenantCode, tenantRole: 'admin' }),
    [tenantCode]
  )

  return (
    <AppProviders user={user} urlProvider={urlProvider} httpClient={httpClient}>
      {children}
    </AppProviders>
  )
}

2. Create page files

// app/admin/[tenant]/master/master-setting/page.tsx
'use client'

import dynamic from 'next/dynamic'
import MsLayout from '@mbc-cqrs-serverless/master-web/MsLayout'
import '@mbc-cqrs-serverless/master-web/styles.css'

const MasterSetting = dynamic(
  () =>
    import('@mbc-cqrs-serverless/master-web/MasterSetting').then(
      (mod) => mod.default
    ),
  { ssr: false }
)

export default function MasterSettingPage() {
  return (
    <MsLayout useLoading>
      <MasterSetting />
    </MsLayout>
  )
}

Why use dynamic imports and the Layout-based Provider Pattern?

  • Avoids Context Isolation - React Context in npm packages can become isolated from the app's context. Setting up providers in a Layout ensures context is initialized before child components mount.
  • Synchronous httpClient - Using useMemo creates httpClient synchronously, avoiding race conditions.
  • Automatic Auth Tokens - Axios interceptors inject the latest auth token on every request.

Subpath Exports

Import only what you need:

import '@mbc-cqrs-serverless/master-web/styles.css'
import MsLayout from '@mbc-cqrs-serverless/master-web/MsLayout'
import { AppProviders } from '@mbc-cqrs-serverless/master-web/AppProviders'
import type { IUrlProvider } from '@mbc-cqrs-serverless/master-web/UrlProvider'

Peer Dependencies

npm install next@^14.0.0 react@^18.0.0 react-dom@^18.0.0

Documentation

For detailed documentation including all components, hooks, URL provider configuration, and troubleshooting, see the official documentation.

License

MIT - Murakami Business Consulting, Inc.