firebase-data-connect by firebase/skills
npx skills add https://github.com/firebase/skills --skill firebase-data-connectFirebase Data Connect 是一项关系型数据库服务,它使用 Cloud SQL for PostgreSQL,并提供了 GraphQL 模式、自动生成的查询/变更操作以及类型安全的 SDK。
dataconnect/
├── dataconnect.yaml # 服务配置
├── schema/
│ └── schema.gql # 数据模型(使用 @table 的类型)
└── connector/
├── connector.yaml # 连接器配置 + SDK 生成
├── queries.gql # 查询
└── mutations.gql # 变更操作
请遵循以下严格的工作流来构建您的应用程序。您必须阅读每个步骤链接的参考文件,以了解语法和可用功能。
schema/schema.gql)定义您的 GraphQL 类型、表和关系。
阅读 reference/schema.md 了解:
@table,@col,@default
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
@ref, 一对多, 多对多)connector/queries.gql, connector/mutations.gql)编写客户端将使用的查询和变更操作。Data Connect 会生成底层的 SQL。
阅读 reference/operations.md 了解:
- 查询 : 过滤 (
where), 排序 (orderBy), 分页 (limit/offset)。- 变更操作 : 创建 (
_insert), 更新 (_update), 删除 (_delete)。- 更新插入 : 使用
_upsert来“插入或更新”记录(对用户配置文件至关重要)。- 事务 : 使用
@transaction进行多步骤原子操作。
connector/ 文件)为您的操作添加授权逻辑。
阅读 reference/security.md 了解:
@auth(level: ...)用于 PUBLIC, USER, 或 NO_ACCESS。@check和@redact用于行级安全和验证。
为您的客户端平台生成类型安全的代码。
阅读 reference/sdks.md 了解:
- Android (Kotlin), iOS (Swift), Web (TypeScript), Flutter (Dart)。
- 如何初始化和调用您的查询/变更操作。
- 嵌套数据 : 了解如何访问相关字段(例如
movie.reviews)。
如果您需要实现特定功能,请查阅映射的参考文件:
| 功能 | 参考文件 | 关键概念 |
|---|---|---|
| 数据建模 | reference/schema.md | @table, @unique, @index, 关系 |
| 向量搜索 | reference/advanced.md | Vector, @col(dataType: "vector") |
| 全文搜索 | reference/advanced.md | @searchable |
| 更新插入数据 | reference/operations.md | _upsert 变更操作 |
| 复杂过滤器 | reference/operations.md | _or, _and, _not, eq, contains |
| 事务 | reference/operations.md | @transaction, response 绑定 |
| 环境配置 | reference/config.md | dataconnect.yaml, connector.yaml |
阅读 reference/config.md 深入了解配置。
常用命令(从项目根目录运行):
# 初始化 Data Connect
npx -y firebase-tools@latest init dataconnect
# 启动本地模拟器
npx -y firebase-tools@latest emulators:start --only dataconnect
# 生成 SDK 代码
npx -y firebase-tools@latest dataconnect:sdk:generate
# 部署到生产环境
npx -y firebase-tools@latest deploy --only dataconnect
有关模式和操作的完整、可运行的代码示例,请参阅 examples.md。
每周安装量
214
代码仓库
GitHub 星标数
182
首次出现
2026年2月17日
安全审计
安装于
gemini-cli210
codex206
opencode205
amp204
github-copilot204
kimi-cli204
Firebase Data Connect is a relational database service using Cloud SQL for PostgreSQL with GraphQL schema, auto-generated queries/mutations, and type-safe SDKs.
dataconnect/
├── dataconnect.yaml # Service configuration
├── schema/
│ └── schema.gql # Data model (types with @table)
└── connector/
├── connector.yaml # Connector config + SDK generation
├── queries.gql # Queries
└── mutations.gql # Mutations
Follow this strict workflow to build your application. You must read the linked reference files for each step to understand the syntax and available features.
schema/schema.gql)Define your GraphQL types, tables, and relationships.
Readreference/schema.md for:
@table,@col,@default- Relationships (
@ref, one-to-many, many-to-many)- Data types (UUID, Vector, JSON, etc.)
connector/queries.gql, connector/mutations.gql)Write the queries and mutations your client will use. Data Connect generates the underlying SQL.
Readreference/operations.md for:
- Queries : Filtering (
where), Ordering (orderBy), Pagination (limit/offset).- Mutations : Create (
_insert), Update (_update), Delete (_delete).- Upserts : Use
_upsertto "insert or update" records (CRITICAL for user profiles).- Transactions : use for multi-step atomic operations.
connector/ files)Add authorization logic closely with your operations.
Readreference/security.md for:
@auth(level: ...)for PUBLIC, USER, or NO_ACCESS.@checkand@redactfor row-level security and validation.
Generate type-safe code for your client platform.
Readreference/sdks.md for:
- Android (Kotlin), iOS (Swift), Web (TypeScript), Flutter (Dart).
- How to initialize and call your queries/mutations.
- Nested Data : See how to access related fields (e.g.,
movie.reviews).
If you need to implement a specific feature, consult the mapped reference file:
| Feature | Reference File | Key Concepts |
|---|---|---|
| Data Modeling | reference/schema.md | @table, @unique, @index, Relations |
| Vector Search | reference/advanced.md | Vector, @col(dataType: "vector") |
| Full-Text Search |
Readreference/config.md for deep dive on configuration.
Common commands (run from project root):
# Initialize Data Connect
npx -y firebase-tools@latest init dataconnect
# Start local emulator
npx -y firebase-tools@latest emulators:start --only dataconnect
# Generate SDK code
npx -y firebase-tools@latest dataconnect:sdk:generate
# Deploy to production
npx -y firebase-tools@latest deploy --only dataconnect
For complete, working code examples of schemas and operations, see examples.md.
Weekly Installs
214
Repository
GitHub Stars
182
First Seen
Feb 17, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli210
codex206
opencode205
amp204
github-copilot204
kimi-cli204
Azure 升级评估与自动化工具 - 轻松迁移 Functions 计划、托管层级和 SKU
79,900 周安装
@transaction@searchable |
| Upserting Data | reference/operations.md | _upsert mutations |
| Complex Filters | reference/operations.md | _or, _and, _not, eq, contains |
| Transactions | reference/operations.md | @transaction, response binding |
| Environment Config | reference/config.md | dataconnect.yaml, connector.yaml |