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

@fabrk/core

v0.3.1

Published

FABRK framework runtime — plugins, middleware, feature flags, teams, jobs, and webhooks

Readme

@fabrk/core

Framework runtime and core utilities for FABRK applications. Provides auto-wiring, middleware composition, feature managers, and foundational utilities for building full-stack TypeScript applications.

Installation

npm install @fabrk/core @fabrk/config @fabrk/design-system

Usage

Auto-Wiring (Zero-Config Development)

The autoWire() function creates all adapters and stores from your configuration automatically:

import { autoWire, applyDevDefaults } from '@fabrk/core'
import { createFabrkConfig } from '@fabrk/config'

// Development: use in-memory defaults
const config = createFabrkConfig({
  auth: { provider: 'nextauth' },
  email: { provider: 'resend', apiKey: process.env.RESEND_API_KEY },
})

const devConfig = applyDevDefaults(config)
const { adapters, stores } = autoWire(devConfig)

// adapters.auth, adapters.email, adapters.payments, adapters.storage
// stores.team, stores.apiKey, stores.audit, stores.notification, etc.

Production: Override with Prisma Stores

import { autoWire } from '@fabrk/core'
import { createPrismaTeamStore, createPrismaAuditStore } from '@fabrk/store-prisma'
import { prisma } from './lib/prisma'

const { adapters, stores } = autoWire(prodConfig, undefined, {
  team: createPrismaTeamStore(prisma),
  audit: createPrismaAuditStore(prisma),
})

Middleware Composition

Build composable middleware pipelines for API routes:

import { createMiddleware, isDev } from '@fabrk/core'
import { withAuth } from '@fabrk/auth'

const middleware = createMiddleware([
  withAuth(authAdapter),
  withRateLimit({ maxRequests: 100, windowMs: 60000 }),
  withCSRF({ enabled: !isDev() }),
])

export const POST = middleware(async (req, context) => {
  // context.session, context.user available
  return Response.json({ success: true })
})

Team Management

import { createTeamManager } from '@fabrk/core'

const teamManager = createTeamManager(stores.team)

// Create team
const team = await teamManager.createTeam({
  name: 'Acme Corp',
  slug: 'acme',
  ownerId: userId,
})

// Manage members
await teamManager.addMember(team.id, userId, 'admin')
const members = await teamManager.getMembers(team.id)
const canEdit = await teamManager.checkPermission(team.id, userId, 'write')

Feature Flags

import { createFeatureFlagManager } from '@fabrk/core'

const flags = createFeatureFlagManager(stores.featureFlag)

// Create flag
await flags.createFlag({
  key: 'new-dashboard',
  enabled: true,
  rolloutPercentage: 50, // gradual rollout
})

// Check flag
const isEnabled = await flags.isEnabled('new-dashboard', { userId, teamId })

Job Queue

import { createJobQueue } from '@fabrk/core'

const jobs = createJobQueue(stores.job)

// Enqueue job
await jobs.enqueue('send-email', {
  to: '[email protected]',
  template: 'welcome',
})

// Process jobs
await jobs.process('send-email', async (payload) => {
  await sendEmail(payload)
})

Notification Manager

import { createNotificationManager } from '@fabrk/core'

const notifications = createNotificationManager(stores.notification)

// Send notification
await notifications.create({
  userId,
  title: 'Welcome!',
  message: 'Your account is ready.',
  type: 'info',
})

// Get user notifications
const userNotifications = await notifications.getByUserId(userId, { unreadOnly: true })
await notifications.markAsRead(notificationId)

Webhook Manager

import { createWebhookManager } from '@fabrk/core'

const webhooks = createWebhookManager(stores.webhook)

// Register webhook
await webhooks.register({
  url: 'https://api.example.com/webhook',
  events: ['user.created', 'payment.succeeded'],
  secret: 'whsec_xxxxx',
})

// Dispatch event
await webhooks.dispatch('user.created', { userId, email })

Features

  • Auto-Wiring - autoWire() creates adapters and stores from configuration with zero boilerplate
  • Dev Defaults - applyDevDefaults() applies in-memory stores and mock adapters for local development
  • Middleware System - Composable middleware for authentication, rate limiting, CSRF, and custom logic
  • Team Management - createTeamManager() for multi-tenant organizations with roles and permissions
  • Feature Flags - createFeatureFlagManager() for gradual rollouts and A/B testing
  • Job Queue - createJobQueue() for background task processing with retries
  • Notifications - createNotificationManager() for in-app user notifications
  • Webhooks - createWebhookManager() for event-driven integrations
  • Validation - Code validators for hardcoded colors, inline styles, accessibility, and security issues
  • Type-Safe - Full TypeScript support with exported types for all managers and stores
  • FabrkProvider - React provider for theme management and framework context

Documentation

View full documentation

License

MIT