一键导入
blink-database
Database CRUD with automatic camelCase conversion. Create, list, update, delete, upsert, count, exists. Raw SQL via CLI. Boolean handling for SQLite.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Database CRUD with automatic camelCase conversion. Create, list, update, delete, upsert, count, exists. Raw SQL via CLI. Boolean handling for SQLite.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
OAuth connector system for 38+ third-party services. Execute API calls to Google, Notion, Slack, Discord, GitHub, Stripe, Jira, HubSpot, Salesforce, LinkedIn, and more.
End-to-end guide for building and shipping a Blink app. Project setup, SDK init, auth, database, backend, deploy, and custom domains. Index to all other skills.
Authentication with managed and headless modes. Social providers, email/password, magic links, RBAC.
Build and deploy Blink apps to production. Preview vs production deploys, deploy pipeline, static site hosting.
Blink Claw agent management — managed AI agent hosting on Fly.io. List agents, check status, manage secrets. For autonomous agents, Telegram/Discord bots, and scheduled workflows.
AI Gateway for text generation, image generation/editing, video generation, text-to-speech, audio transcription, and AI phone calls. Unified access to 50+ models.
| name | blink-database |
| description | Database CRUD with automatic camelCase conversion. Create, list, update, delete, upsert, count, exists. Raw SQL via CLI. Boolean handling for SQLite. |
blink_db_query · blink_db_schema
blink_db_query — Run any SQL query (SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, etc.)blink_db_schema — Get full schema: all tables with column names, types, nullability, defaults, and primary keys# Create a table
blink db query "CREATE TABLE todos (id TEXT PRIMARY KEY, title TEXT NOT NULL, user_id TEXT, is_completed INTEGER DEFAULT 0, created_at TEXT DEFAULT (datetime('now')))"
# Inspect schema
blink db query "SELECT name FROM sqlite_master WHERE type='table'"
# Run any SQL
blink db query "SELECT * FROM todos LIMIT 10"
SDK converts camelCase ↔ snake_case automatically. Always use camelCase in code.
// ✅ Correct
await blink.db.emailDrafts.create({ userId: user.id, createdAt: new Date() })
// ❌ Wrong — never use snake_case in SDK calls
await blink.db.email_drafts.create({ user_id: user.id })
// Create (ID auto-generates as string)
const todo = await blink.db.todos.create({ title: 'Learn Blink', userId: user.id, isCompleted: false })
// Get by ID
const todo = await blink.db.todos.get('todo_12345')
// List with filtering
const todos = await blink.db.todos.list({
where: { AND: [{ userId: user.id }, { OR: [{ status: 'open' }, { priority: 'high' }] }] },
orderBy: { createdAt: 'desc' },
limit: 20,
offset: 0,
})
// Update
await blink.db.todos.update('todo_12345', { isCompleted: true })
// Delete
await blink.db.todos.delete('todo_12345')
// Upsert
await blink.db.todos.upsert({ id: 'todo_12345', title: 'Updated', userId: user.id })
// Count / Exists
const count = await blink.db.todos.count({ where: { userId: user.id } })
const exists = await blink.db.todos.exists({ where: { id: 'todo_12345' } })
await blink.db.todos.createMany([{ title: 'Task 1', userId: user.id }, { title: 'Task 2', userId: user.id }])
await blink.db.todos.updateMany([{ id: 'todo_1', isCompleted: true }, { id: 'todo_2', isCompleted: true }])
await blink.db.todos.deleteMany({ where: { userId: user.id, isCompleted: "1" } })
SQLite returns booleans as "0"/"1" strings, not true/false.
// ✅ Correct
const completed = todos.filter(todo => Number(todo.isCompleted) > 0)
// Filter in queries
const done = await blink.db.todos.list({ where: { isCompleted: "1" } })
interface Todo {
id: string // MUST be string, never number
title: string
isCompleted: boolean // Returned as "0"/"1" from SQLite
userId: string
createdAt: string
}
// Typed queries
const todos = await blink.db.table<Todo>('todos').list()
| Option | Type | Example |
|---|---|---|
where | object | { userId: 'abc', status: 'active' } |
orderBy | object | { createdAt: 'desc' } |
limit | number | 20 |
offset | number | 0 |
select | array | ['id', 'title'] |
REST CRUD is JWT-protected by default — initialize with auth for user-scoped data. RLS enforces per-user access server-side.
const blink = createClient({
projectId: process.env.NEXT_PUBLIC_BLINK_PROJECT_ID,
publishableKey: process.env.NEXT_PUBLIC_BLINK_PUBLISHABLE_KEY,
auth: { mode: 'managed' },
})
Never create a DB record before an async operation (AI, upload) completes — nullable fields or missing data will fail NOT NULL constraints. Create records only after you have all data.