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

@pubflow/core

v0.4.6

Published

Core functionality for Pubflow framework

Readme

@pubflow/core

Core functionality for the Pubflow framework.

📚 Documentation

Overview

@pubflow/core provides the foundation for the Pubflow framework, including:

  • Configuration management with support for multiple instances
  • API client for making authenticated HTTP requests
  • Authentication service for user management and session handling
  • Bridge API service for standardized CRUD operations
  • Bridge Payment Client for payment processing (NEW in v0.4.0)
  • Schema validation using Zod
  • Storage adapter interface for different storage mechanisms
  • Utility functions for common tasks

Installation

npm install @pubflow/core

Usage

Configuration

import { initConfig, getConfig } from '@pubflow/core';

// Initialize configuration
const config = initConfig({
  baseUrl: 'https://api.example.com',
  bridgeBasePath: '/bridge',
  authBasePath: '/auth',
  useSecureStorage: true
});

// Get configuration
const config = getConfig();

API Client

import { ApiClient } from '@pubflow/core';
import { LocalStorageAdapter } from '@pubflow/react'; // Or your own storage adapter

// Create API client
const apiClient = new ApiClient(config, new LocalStorageAdapter());

// Make requests
const response = await apiClient.get('/users');
const user = await apiClient.post('/users', { name: 'John', email: '[email protected]' });

Authentication

import { AuthService } from '@pubflow/core';

// Create auth service
const authService = new AuthService(apiClient, storage, config);

// Login
const result = await authService.login({
  email: '[email protected]',
  password: 'password'
});

// Get current user (basic method)
const user = await authService.getCurrentUser();

// Get complete user data with all additional fields preserved
const completeUserData = await authService.getUserData();

// Validate session
const { isValid } = await authService.validateSession();

// Logout
await authService.logout();

Bridge API

import { BridgeApiService } from '@pubflow/core';

// Define entity type
interface User {
  id: string;
  name: string;
  email: string;
}

// Create Bridge API service
const userService = new BridgeApiService<User>(apiClient, {
  endpoint: 'users'
});

// Get list of users
const { data: users } = await userService.getList({ page: 1, limit: 10 });

// Get user by ID
const user = await userService.getById('123');

// Create user
const newUser = await userService.create({ name: 'Jane', email: '[email protected]' });

// Update user
const updatedUser = await userService.update('123', { name: 'Jane Doe' });

// Delete user
await userService.delete('123');

// Search users
const { data: filteredUsers } = await userService.search({
  q: 'jane',
  filters: [
    { field: 'status', operator: 'equals', value: 'active' }
  ],
  page: 1,
  limit: 10
});

Schema Validation

import { z } from 'zod';
import { validateWithSchema, createSchema } from '@pubflow/core';

// Define schema
const userSchema = z.object({
  name: z.string().min(2),
  email: z.string().email(),
  age: z.number().min(18)
});

// Create entity schemas
const schemas = createSchema({
  entity: userSchema,
  create: z.object({
    name: z.string().min(2),
    email: z.string().email(),
    age: z.number().min(18)
  }),
  update: z.object({
    name: z.string().min(2).optional(),
    email: z.string().email().optional(),
    age: z.number().min(18).optional()
  })
});

// Validate data
const result = validateWithSchema(schemas.create, {
  name: 'John',
  email: 'invalid-email',
  age: 16
});

if (!result.success) {
  console.error(result.errors);
}

Bridge Payments (NEW in v0.4.0)

import { BridgePaymentClient } from '@pubflow/core';

// Create payment client
const paymentClient = new BridgePaymentClient({
  baseUrl: 'https://payments.example.com',
  storage: new LocalStorageAdapter() // Optional, defaults to MemoryStorage
});

// Create payment intent
const intent = await paymentClient.createPaymentIntent({
  total_cents: 2000, // $20.00
  currency: 'USD',
  description: 'Premium Subscription',
  provider_id: 'stripe'
});

// List payment methods
const methods = await paymentClient.listPaymentMethods();

// Create subscription
const subscription = await paymentClient.createSubscription({
  plan_id: 'plan_premium_monthly',
  payment_method_id: 'pm_123'
});

// Manage organizations (multi-tenant)
const org = await paymentClient.createOrganization({
  name: 'Acme Corp',
  email: '[email protected]'
});

For complete payment integration examples, see the Bridge Payments documentation.