@best/api-db

中文文档
18.0.1发布于 2026/10/23MITTypeScriptCommonJS近 30 天下载 3708

Best Api Database

原始使用文档
文档目录4 节
  1. SQLite
  2. Config
  3. Postgres
  4. Config

API DB

This is the database adapter that the frontend uses to display results. The results are stored whenever a benchmark is run.

Below you can find instructions for using either Postgres or SQLite. By default Best uses a local SQLite file, however we recommend using Postgres if you are running on anything other than your local machine.

SQLite

SQLite is configured by default, but if you would like to provide a custom path you can use the following configuration.

Config

Inside your best.config.js you need to have the following:

{
    apiDatabase: {
        adapter: 'sql/sqlite',
        uri: 'PATH_TO_SQLITE_DB'
    }
}

You do not need to create your own sqlite file, the adapter will handle that for you.

The adapter uses Node's built-in node:sqlite module, so it requires Node.js 22.13 or newer and has no native dependencies to compile.

Postgres

Config

Inside your best.config.js you need to have the following:

{
    apiDatabase: {
        adapter: 'sql/postgres',
        uri: 'postgresql://dbuser:[email protected]:3211/mydb
    }
}

For Postgres, you need to provision and manage your own database.

版本与发布记录

@best/api-db 共发布 67 个版本,首次发布于 2019/07/27;过去 12 个月发布了 4 个版本。

版本发布日期距今
18.0.1latest2026/10/2316 天前
18.0.02026/10/2217 天前
17.0.02026/05/195 个月前
16.1.02026/02/069 个月前
16.0.02025/09/131.2 年前
15.0.02025/06/041.4 年前

其他发布通道:canary → 4.0.0-alpha15。

关于 @best/api-db 的常见问题

@best/api-db 是什么?

Best Api Database

如何安装 @best/api-db?

在项目目录运行 npm install @best/api-db,或使用 pnpm add / yarn add / bun add。

@best/api-db 支持 TypeScript 吗?

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

@best/api-db 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@best/api-db 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@best/api-db 可以商用吗?

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

@best/api-db 的下载量有多少?

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

@best/api-db 还在维护吗?

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