@dreaminhex/hexdb

中文文档
2.5.1发布于 2026/11/13Apache-2.0TypeScriptES Module零依赖近 30 天下载 3991

Client for HexDB, the hexagonal document database.

原始使用文档

@dreaminhex/hexdb

The JavaScript and TypeScript client for HexDB, a document database with REST, GraphQL and read-only SQL, encryption at rest and replication with automatic failover.

It covers documents (insert, get, replace, patch, delete), queries with filters, sorting and paging, counts, aggregations, upserts, detokenizing vault tokens, transactions, idempotency keys, the change feed, streams, functions and GraphQL. It retries 429 and 503 answers for reads, and for writes that carry an idempotency key. Runs on Node.js 18+, Deno, Bun and in browsers, with no dependencies.

npm install @dreaminhex/hexdb
import { HexDB } from "@dreaminhex/hexdb"

const db = new HexDB({ url: "http://127.0.0.1:7700", apiKey: process.env.HEXDB_API_KEY })
const orders = db.tessellation("orders")
await orders.insert({ customer: "ada", total: 12 })
const page = await orders.query({ filter: { total: { $gt: 10 } }, sort: "-total" })

Create an API key on the admin UI's Account page. A connection URI works too, the same one the other HexDB drivers take:

const db = new HexDB(process.env.HEXDB_URI!)              // e.g. hexdbs://db.example.com?apiKey=hxk_...
const db2 = await HexDB.connect("hexdbs://ada:[email protected]")  // signs in now; new HexDB(uri) signs in on first use

parseConnectionUri and redactConnectionUri are exported for tools that store URIs. The driver documentation and the manual cover the rest. Licensed under the Apache License 2.0.

版本与发布记录

@dreaminhex/hexdb 共发布 25 个版本,首次发布于 2026/10/10;过去 12 个月发布了 25 个版本。

版本发布日期距今
2.5.1latest2026/11/13今天
2.5.02026/11/13今天
2.4.72026/11/112 天前
2.4.62026/11/112 天前
2.4.52026/11/103 天前
2.4.42026/11/103 天前

关于 @dreaminhex/hexdb 的常见问题

@dreaminhex/hexdb 是什么?

Client for HexDB, the hexagonal document database.

如何安装 @dreaminhex/hexdb?

在项目目录运行 npm install @dreaminhex/hexdb,或使用 pnpm add / yarn add / bun add。

@dreaminhex/hexdb 支持 TypeScript 吗?

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

@dreaminhex/hexdb 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@dreaminhex/hexdb 需要什么版本的 Node.js?

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

@dreaminhex/hexdb 可以商用吗?

@dreaminhex/hexdb 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@dreaminhex/hexdb 的下载量有多少?

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

@dreaminhex/hexdb 还在维护吗?

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