blyp Svelte Themes

Blyp

A high-performance, modular logger with Bun-first runtime detection and TypeScript support. Built on Pino with and supports Elysia, Hono, Express, Fastify, NestJS, Next.js App Router, TanStack Start, and SvelteKit.

Blyp Logger

Blyp is a TypeScript logger for standalone apps and modern web frameworks. It gives you structured logging, framework adapters, client-to-server log ingestion, and optional connectors without turning the root README into a full manual.

Highlights

  • Use it in standalone apps or with framework adapters.
  • Create structured, request-scoped logs with createStructuredLog.
  • Redact common secrets before logs reach output or downstream sinks.
  • Ingest logs from browser and Expo apps into your backend flow.
  • Forward logs to optional connectors such as PostHog, Better Stack, Sentry, Databuddy, named HTTP endpoints, and OTLP targets.
  • Built for Bun-first setups with support for supported Node runtimes.
  • Full TypeScript support across the main package and subpath exports.

Installation

bun add @blyp/core

npm install @blyp/core | pnpm add @blyp/core | yarn add @blyp/core

If you use the Expo logger, also install expo-network.

npx expo install expo-network

Quick start

import { logger } from '@blyp/core';

logger.info('Server started', { port: 3000 });
logger.success('Connected to database');
logger.error('Payment failed', { orderId: 'ord_123' });

Structured logs

import { createStructuredLog } from '@blyp/core';

const log = createStructuredLog('checkout', {
  service: 'web-api',
  level: 'info',
  timestamp: new Date().toISOString(),
});

log.set({
  user: { id: 1, plan: 'pro' },
  cart: { items: 3, total: 9999 },
});

log.info('checkout started');
log.emit({ status: 200 });

Inside framework handlers, createStructuredLog(...) binds to the active request logger automatically. The final structured record is written when you call .emit().

Framework example

Blyp supports Elysia, Hono, Express, Fastify, NestJS, Next.js App Router, React Router, Astro, Nitro, Nuxt, TanStack Start, SolidStart, SvelteKit, and Cloudflare Workers.

import { Elysia } from 'elysia';
import { createLogger } from '@blyp/core/elysia';

const app = new Elysia()
  .use(createLogger({ level: 'info', autoLogging: true }))
  .get('/', () => 'Hello World')
  .listen(3000);

See the framework integration docs for the full adapter matrix and framework-specific examples.

Better Auth

Better Auth can be attached as a real Better Auth plugin and then reused by Blyp framework adapters for request enrichment.

import { betterAuth } from 'better-auth';
import { blyp } from '@blyp/core/better-auth';

export const auth = betterAuth({
  plugins: [
    blyp({
      clientLogging: true,
    }),
  ],
});
import { createLogger } from '@blyp/core/nextjs';
import { auth } from './auth';

export const nextLogger = createLogger({
  auth: {
    betterAuth: auth,
  },
});
import { createAuthClient } from 'better-auth/client';
import { blypClient } from '@blyp/core/better-auth';

export const authClient = createAuthClient({
  plugins: [blypClient()],
});

const logger = authClient.blyp.createLogger();
logger.info('mounted');

Clerk

Clerk is integrated through Blyp's shared server auth config instead of a plugin. Blyp authenticates the incoming request with @clerk/backend, normalizes the auth state onto each server log record, and derives browser log identity on the server when your client logger posts to a Blyp endpoint such as /blyp/log.

import { clerk, createClerkClientLogger } from '@blyp/core/clerk';
import { createLogger } from '@blyp/core/nextjs';

export const nextLogger = createLogger({
  auth: {
    clerk: clerk({
      secretKey: process.env.CLERK_SECRET_KEY!,
      publishableKey: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY!,
      jwtKey: process.env.CLERK_JWT_KEY,
      authorizedParties: ['https://app.example.com'],
    }),
  },
  clientLogging: {
    path: '/blyp/log',
  },
});

export const clientLogger = createClerkClientLogger({
  endpoint: '/blyp/log',
});

See the full Clerk integration docs for Next.js, Express, React Router, and machine-authenticated examples.

More features

Documentation

Development

bun install
bun run test
bun run build
bun run type-check

License

MIT

Top categories

Loading Svelte Themes