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

@croco/auth-better-auth

v0.0.2

Published

Better Auth와 Drizzle을 Croco 인증 흐름에 연결하는 패키지입니다.

Readme

@croco/auth-better-auth

Better Auth와 Drizzle을 Croco 인증 흐름에 연결하는 패키지입니다.

설치

pnpm add @croco/auth-better-auth better-auth drizzle-orm

사용법

1. Drizzle과 팩토리 등록

import { BetterAuthFactory, DRIZZLE_TOKEN } from "@croco/auth-better-auth";
import { Container } from "@croco/framework-context";

Container.register(DRIZZLE_TOKEN, db);

const factory = new BetterAuthFactory(db, {
  baseURL: process.env.BETTER_AUTH_URL!,
  secret: process.env.BETTER_AUTH_SECRET!,
});

2. 인증 사용자 변환

import { BetterAuthProvider } from "@croco/auth-better-auth";

const provider = new BetterAuthProvider(factory);
const user = await provider.authenticate(request);

3. 세션 관리

import { BetterAuthSessionManager } from "@croco/auth-better-auth";

const sessions = new BetterAuthSessionManager(factory);
const session = await sessions.getSession(token);
await sessions.revokeUserSessions("user_123");

4. 웹훅 처리

import { BetterAuthWebhookProcessor } from "@croco/auth-better-auth";

const processor = new BetterAuthWebhookProcessor(
  { signingSecret: process.env.BETTER_AUTH_WEBHOOK_SECRET! },
  {
    "session.revoked": async (payload) => {
      await auditSession(payload);
    },
  },
  sessions,
);

await processor.processWebhook(request);

5. 제공 스키마 사용

import { account, session, user, verification } from "@croco/auth-better-auth";

export const authSchema = { user, session, account, verification };

API 레퍼런스

| API | 설명 | | -------------------------------------------- | --------------------------------------------------------- | | BetterAuthFactory | Better Auth 인스턴스를 생성하고 재사용합니다. | | BetterAuthProvider | 요청 헤더에서 세션을 읽어 AuthUser로 변환합니다. | | BetterAuthSessionManager | 세션 조회, 단건 해제, 사용자 전체 세션 해제를 처리합니다. | | BetterAuthWebhookProcessor | 웹훅 서명을 확인하고 이벤트 핸들러를 호출합니다. | | user, session, account, verification | Better Auth용 Drizzle 스키마를 제공합니다. | | BetterAuthInvalidSessionProblem 외 Problem | 세션, 초기화, 웹훅 오류를 Problem으로 표현합니다. |

공개 타입

  • BetterAuthConfig
  • BetterAuthSession, BetterAuthSessionProvider
  • BetterAuthWebhookEvent, BetterAuthWebhookHandler, BetterAuthWebhookOptions
  • BetterAuthUser