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

web-app-platform

v0.1.0

Published

Generic web application infrastructure: auth factories, caching, logging, HTTP client, React Query provider, cross-tab sync

Readme

web-app-platform

Generic web application infrastructure for React apps. Provides auth, caching, logging, HTTP, and state management primitives as configurable factories — zero domain coupling.

Install

npm install web-app-platform
# or
pnpm add web-app-platform

Peer dependency: React 18+ or 19+

What's Included

| Module | Description | |--------|-------------| | Auth | createAuthStore<TUser>(), createAuthSelectors<TUser>(), createAuthProvider<TUser>() — factory-based auth with callback injection for any user model | | Cache | UnifiedCache with scope-aware TTL eviction, CacheMonitorBase for hit/miss tracking, CacheDebugger for diagnostics | | Events | EventBus — generic pub/sub with scoped events | | HTTP | HttpClient — fetch wrapper with retry, auth headers, error normalization | | Logging | FrontendLogger — pre-init-safe singleton with batched network transport | | Providers | QueryProvider — lazy React Query client with initQueryConfig() for TTL injection | | Config | createRuntimeConfigLoader<T>() — Zod-validated runtime config factory | | Services | ServiceContainer — zero-coupling dependency injection | | Utils | AdapterRegistry, broadcastLogout (cross-tab), ErrorAdapter, cn(), formatting |

Quick Start

Auth Store

import { createAuthStore, createAuthProvider } from 'web-app-platform';

interface User {
  id: string;
  email: string;
  name: string;
}

export const useAuthStore = createAuthStore<User>({
  mapUser: (raw) => ({ id: raw.id, email: raw.email, name: raw.name }),
  checkAuthStatus: () => fetch('/api/auth/status').then(r => r.json()),
  onSignIn: (user) => console.log('Signed in:', user.email),
  onSignOut: () => console.log('Signed out'),
});

export const AuthProvider = createAuthProvider(useAuthStore);

Query Provider

import { QueryProvider, initQueryConfig } from 'web-app-platform';

// Set domain-specific cache TTLs
initQueryConfig({ staleTime: 300_000, gcTime: 600_000 });

function App() {
  return (
    <QueryProvider>
      <AuthProvider>
        <YourApp />
      </AuthProvider>
    </QueryProvider>
  );
}

HTTP Client

import { HttpClient } from 'web-app-platform';

const http = new HttpClient();
const data = await http.get('/api/data');
const result = await http.post('/api/action', { body: { key: 'value' } });

Logger

import { frontendLogger } from 'web-app-platform';

// Initialize with your backend endpoint
frontendLogger.init({ baseUrl: 'https://api.example.com' });

// Log anywhere — messages are batched and sent periodically
frontendLogger.info('app', 'User loaded dashboard');
frontendLogger.error('auth', 'Token refresh failed', { error });

Runtime Config

import { createRuntimeConfigLoader } from 'web-app-platform';
import { z } from 'zod';

const configSchema = z.object({
  apiBaseUrl: z.string(),
  featureFlags: z.object({ newDashboard: z.boolean() }),
});

export const loadConfig = createRuntimeConfigLoader(configSchema, {
  apiBaseUrl: '/api',
  featureFlags: { newDashboard: false },
});

Key Design Decisions

  • Factory pattern for authcreateAuthStore<TUser>() accepts callbacks (onSignIn, onSignOut, onCrossTabLogout, onUnauthInit) so the auth system has zero knowledge of your domain
  • Cross-tab sync — Dual-channel (BroadcastChannel + localStorage) with dedup guard prevents double-fire
  • Pre-init logger — Messages are buffered before init() is called, then flushed. Safe to import and use anywhere
  • Lazy QueryClient — Created on first access via getQueryClient(), configurable via initQueryConfig()
  • Scope-aware caching — Cache entries tagged with scopeId for per-entity eviction (e.g., per-project, per-tenant)

Requirements

  • React 18+ or 19+
  • TypeScript 5+
  • Zustand ^4.5.0 (included as dependency)
  • @tanstack/react-query ^5 (included as dependency)

License

Proprietary — see LICENSE for details. Commercial use requires explicit written permission. Contact [email protected] for licensing inquiries.