@blyp/core

中文文档
0.1.36发布于 2026/10/23MITTypeScriptESM + CJS构建来源已验证近 30 天下载 1931

A high-performance, modular logger with Bun-first runtime detection and TypeScript support. Built on Pino and supports Elysia, Hono, Express, Fastify, NestJS, Next.js App Router, Farm.js, React Router, Astro, Nitro, Nuxt, TanStack Start, SolidStart, and S

原始使用文档
文档目录15 节
  1. Highlights
  2. Installation
  3. Quick start
  4. Structured logs
  5. Framework example
  6. Farm.js
  7. Better Auth
  8. Clerk
  9. More features
  10. Documentation
  11. Development
  12. License
  13. Storageless ingestion
  14. Operational connector reliability
  15. S3 storage

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.

Bun TypeScript Elysia

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 New Relic, 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, Farm.js, React Router, Astro, Nitro, Nuxt, TanStack Start, SolidStart, SvelteKit, Cloudflare Workers, and Convex.

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.

Farm.js

// farm.config.ts
import { defineConfig } from '@farm.js/core';
import { blypPlugin } from '@blyp/core/farmjs';

export default defineConfig({
  plugins: [blypPlugin()],
});
// src/app/api/products/route.ts
import { logger } from '@blyp/core/farmjs';

export async function GET() {
  logger.info('loaded products');
  return Response.json({ ok: true });
}

The plugin automatically records requests, errors, selected Farm lifecycle events, browser navigation and performance telemetry, and browser errors. It currently supports Farm's Node and Bun server runtimes.

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

Storageless ingestion

Use destination: 'none' to forward logs through enabled connectors or OTLP without local log files, database storage, or disk queues. At least one configured connector is required, and ingested client logs must select a ready target. See configuration and client examples.

Operational connector reliability

See the PostHog/Sentry contracts, published-package investigation, and CarsXE migration example for structured errors, verified identity, final-payload privacy, bounded flushing and no-persistence operation. Run npm run test:packed-connectors to verify the packed package with real SDKs in isolated Node CommonJS/ESM applications.

S3 storage

Set destination: 's3' to store compressed log batches in AWS S3, Cloudflare R2, or MinIO and browse them in Studio with explicit read allowances. Memory buffering is the default; persistent SQLite spooling is optional. See S3 storage and Studio for configuration, permissions, recovery, and provider validation status.

版本与发布记录

@blyp/core 共发布 15 个版本,首次发布于 2026/03/17;过去 12 个月发布了 15 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.36latest2026/10/2316 天前
0.1.352026/10/2217 天前
0.1.342026/10/1920 天前
0.1.322026/10/1425 天前
0.1.312026/10/1326 天前
0.1.302026/08/292 个月前

关于 @blyp/core 的常见问题

@blyp/core 是什么?

A high-performance, modular logger with Bun-first runtime detection and TypeScript support. Built on Pino and supports Elysia, Hono, Express, Fastify, NestJS, Next.js App Router, Farm.js, React Router, Astro, Nitro, Nuxt, TanStack Start, SolidStart, and S

如何安装 @blyp/core?

在项目目录运行 npm install @blyp/core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:typescript(^5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@blyp/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@blyp/core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@blyp/core 可以商用吗?

@blyp/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@blyp/core 的下载量有多少?

根据 npm 官方下载统计,@blyp/core 在 2026/10/09 – 2026/11/07 这 30 天内被下载 1,931 次,日均约 64 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@blyp/core 还在维护吗?

最新版本 0.1.36 发布于 2026/10/23(16 天前);至今共发布 15 个版本,其中过去 12 个月发布了 15 个;首次发布于 2026/03/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。