@fayz-ai/db

中文文档
0.32.0发布于 2026/11/10MITTypeScriptESM + CJS近 30 天下载 1.7万

Fayz SDK database layer — Drizzle schema primitives, spine references, and migration helpers shared across plugins.

原始使用文档
文档目录5 节
  1. What's inside
  2. Install
  3. Usage
  4. Part of the Fayz SDK
  5. Roadmap & contributing

@fayz-ai/db

The shared Drizzle spine that every Fayz plugin schema composes with.

npm license

Status: beta — published to npm and used across Fayz dogfood apps. Pre-1.0: minor APIs may change before 1.0.

When apps are composed from plugins, their data models have to compose too. @fayz-ai/db is the schema spine: a small set of canonical Drizzle tables — tenants, people, orders, appointments, products — plus the column helpers (tenant id, timestamps) that plugin schemas build on. Every plugin references the same spine, so a CRM's clients and an agenda's appointments agree on what a person and a tenant are.

It also re-exports drizzle-orm/pg-core so the whole stack runs on one Drizzle instance — apps compose their own tables, the spine refs, and plugin schemas without the dual-copy PgColumn type clashes you get from mismatched drizzle-orm versions.

What's inside

  • Spine tables — tenants, people, orders, appointments, products, orderItems (Ring 0 references plugins point at, in public)
  • Column helpers — tenantId, timestamps, createdAt
  • Re-exported pg-core — the full drizzle-orm/pg-core builder surface, so every package shares one drizzle-orm instance

Install

npm install @fayz-ai/db

Depends on drizzle-orm. Import pg-core builders from here, not from drizzle-orm directly.

Usage

import { pgTable, text, tenantId, timestamps, people } from '@fayz-ai/db'

export const notes = pgTable('notes', {
  id: text('id').primaryKey(),
  personId: text('person_id').references(() => people.id),
  body: text('body'),
  tenantId: tenantId(),
  ...timestamps,
})

Part of the Fayz SDK

The data spine beneath every plugin schema; apps compose it in their own drizzle.config.

Roadmap & contributing

Built and evolving in the open. See the Fayz SDK roadmap for current gaps, missing features, and good first issues.

版本与发布记录

@fayz-ai/db 共发布 52 个版本,首次发布于 2026/06/18;过去 12 个月发布了 52 个版本。

版本发布日期距今
0.32.0latest2026/11/104 天前
0.31.12026/11/058 天前
0.31.02026/11/0410 天前
0.30.12026/11/0410 天前
0.30.02026/11/0310 天前
0.29.12026/10/3015 天前

其他发布通道:next → 0.9.0-next.1,canary → 0.28.1-canary.20261028153856。

关于 @fayz-ai/db 的常见问题

@fayz-ai/db 是什么?

Fayz SDK database layer — Drizzle schema primitives, spine references, and migration helpers shared across plugins.

如何安装 @fayz-ai/db?

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

@fayz-ai/db 支持 TypeScript 吗?

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

@fayz-ai/db 支持 ESM 还是 CommonJS?

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

@fayz-ai/db 可以商用吗?

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

@fayz-ai/db 的下载量有多少?

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

@fayz-ai/db 还在维护吗?

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