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

@visiblebase/service-accounts

v0.1.12

Published

VisibleBase accounts service — registration, login, email verification, GitHub/Google OAuth via better-auth.

Readme

@visiblebase/service-accounts

VisibleBase 官方账号管理服务。

安装

pnpm add @visiblebase/service-accounts

使用

import { Base } from "@visiblebase/core";
import { accountsService } from "@visiblebase/service-accounts";

const base = new Base({
  services: [
    accountsService({
      token_ttl: "7d",
    }),
  ],
});

服务会自动维护两层数据:

  • better-auth 认证事实表:auth_usersauth_accountsauth_sessionsauth_verifications
  • 产品资料表:auth_profiles
  • OAuth 轮询 state 表:service_accounts_oauth_states

Base 使用者不需要自己手写这些表;产品真正要展示的资料建议直接读服务提供的 profile 结果。

路由

  • POST /v1/accounts/register
  • POST /v1/accounts/verify-email
  • POST /v1/accounts/login
  • GET /v1/accounts/providers
  • POST /v1/accounts/oauth/start
  • GET /v1/accounts/oauth/result
  • GET /v1/accounts/oauth/callback
  • GET /v1/accounts/me
  • POST /v1/accounts/logout
  • GET /v1/accounts/users
  • GET /v1/accounts/sessions

注册或登录请求传入 product_id 后,服务会返回 Base user_token

第三方 OAuth 的回调地址固定为 /v1/accounts/oauth/callback。调用 oauth/start 时不需要额外传 redirect_uri,服务会根据当前 Base 的公网地址自动生成。

GET /v1/accounts/me 会返回两部分:

  • user:当前 Base user_token 解析出的运行时用户
  • profile:产品层资料,例如展示名、头像

GET /v1/accounts/users 给管理侧看认证用户与 profile 汇总数据。

产品前端、CLI 或其他 client 如果要决定当前应该展示哪些登录按钮,应该先调用:

GET /v1/accounts/providers

这个接口会返回当前 Base 实际启用的登录方式,例如邮箱登录、GitHub OAuth、Google OAuth 是否真的可用。不要在 client 里把 provider 列表写死。