Loading...
Loading...
Compare original and translation side by side
get-backend-metadataget-anon-keyExample: User says "deploy to insforge"
✓ Try: get-backend-metadata via MCP
✓ If success: Extract project URL from metadata, get anon key via get-anon-key
✗ If fail: Ask user for credentialsget-backend-metadataget-anon-key示例:用户说“部署到InsForge”
✓ 尝试:通过MCP调用get-backend-metadata
✓ 如果成功:从元数据中提取项目URL,通过get-anon-key获取匿名密钥
✗ 如果失败:向用户索要凭证| Credential | Format | Required For |
|---|---|---|
| Project URL | | All API calls |
| API Key | | Authorization header |
Do you have an InsForge project? I'll need:
1. Project URL (e.g., https://abc123.us-east-1.insforge.app)
2. API Key (starts with ik_)
You can find these in InsForge Dashboard → Project Settings.| 凭证 | 格式 | 适用场景 |
|---|---|---|
| 项目URL | | 所有API调用 |
| API密钥 | | 授权请求头 |
你是否拥有InsForge项目?我需要以下信息:
1. 项目URL(例如:https://abc123.us-east-1.insforge.app)
2. API密钥(以ik_开头)
你可以在InsForge控制台 → 项目设置中找到这些信息。sdk-integration.mdsdk-integration.md@insforge/sdk@insforge/sdkbackend-configuration.mdbackend-configuration.mdpostspostsGET /api/metadata
Authorization: Bearer {admin-token-or-api-key}GET /api/metadata
Authorization: Bearer {admin-token-or-api-key}npm install @insforge/sdk@latestimport { createClient } from '@insforge/sdk'
const insforge = createClient({
baseUrl: 'https://your-project.region.insforge.app',
anonKey: 'your-anon-key'
})npm install @insforge/sdk@latestimport { createClient } from '@insforge/sdk'
const insforge = createClient({
baseUrl: 'https://your-project.region.insforge.app',
anonKey: 'your-anon-key'
})| Module | SDK Integration | Backend Configuration |
|---|---|---|
| Database | database/sdk-integration.md | database/backend-configuration.md |
| Auth | auth/sdk-integration.md | auth/backend-configuration.md |
| Storage | storage/sdk-integration.md | storage/backend-configuration.md |
| Functions | functions/sdk-integration.md | functions/backend-configuration.md |
| AI | ai/sdk-integration.md | ai/backend-configuration.md |
| Real-time | realtime/sdk-integration.md | realtime/backend-configuration.md |
| Schedules | — | schedules/backend-configuration.md |
| Deployments | — | deployments/workflow.md |
| Logs | — | logs/debugging.md |
| 模块 | SDK集成文档 | 后端配置文档 |
|---|---|---|
| 数据库 | database/sdk-integration.md | database/backend-configuration.md |
| 认证 | auth/sdk-integration.md | auth/backend-configuration.md |
| 存储 | storage/sdk-integration.md | storage/backend-configuration.md |
| 函数 | functions/sdk-integration.md | functions/backend-configuration.md |
| AI | ai/sdk-integration.md | ai/backend-configuration.md |
| 实时服务 | realtime/sdk-integration.md | realtime/backend-configuration.md |
| 调度任务 | — | schedules/backend-configuration.md |
| 部署 | — | deployments/workflow.md |
| 日志 | — | logs/debugging.md |
| Module | sdk-integration.md | backend-configuration.md |
|---|---|---|
| Database | CRUD operations, filters, pagination | Create tables, RLS policies, triggers, indexes. See also database/postgres-rls.md for RLS best practices |
| Auth | Sign up/in, OAuth, sessions, profiles | Auth config, user management, anon tokens |
| Storage | Upload, download, delete files | Create/manage buckets |
| Functions | Invoke functions | Deploy, update, delete functions |
| AI | Chat, images, embeddings | Models, credits, usage stats |
| Real-time | Connect, subscribe, publish events | Channel patterns, database triggers |
| Schedules | — | Cron jobs, HTTP triggers, execution logs |
| Deployments | — | Deploy frontend apps |
| Logs | — | Fetch container logs for debugging |
| 模块 | sdk-integration.md | backend-configuration.md |
|---|---|---|
| 数据库 | CRUD操作、筛选、分页 | 创建数据表、RLS策略、触发器、索引。另可查看database/postgres-rls.md获取RLS最佳实践 |
| 认证 | 注册/登录、OAuth、会话、用户资料 | 认证配置、用户管理、匿名令牌 |
| 存储 | 文件上传、下载、删除 | 创建/管理存储桶 |
| 函数 | 调用函数 | 部署、更新、删除函数 |
| AI | 聊天、图像生成、嵌入向量 | 模型配置、额度、使用统计 |
| 实时服务 | 连接、订阅、发布事件 | 通道规则、数据库触发器 |
| 调度任务 | — | Cron任务、HTTP触发器、执行日志 |
| 部署 | — | 部署前端应用 |
| 日志 | — | 获取容器日志用于调试 |
| Guide | When to Use |
|---|---|
| database/postgres-rls.md | Writing or reviewing RLS policies — covers infinite recursion prevention, |
| 指南 | 使用场景 |
|---|---|
| database/postgres-rls.md | 编写或审核RLS策略时使用 — 涵盖无限递归预防、 |
{ data, error }| Module | Methods |
|---|---|
| |
| |
| |
| |
| |
| |
{ data, error }| 模块 | 方法 |
|---|---|
| |
| |
| |
| |
| |
| |
https://your-project.region.insforge.appAuthorization: Bearer {admin-token-or-api-key}| Task | Endpoint |
|---|---|
| Execute SQL | |
| Create bucket | |
| Deploy function | |
| Configure auth | |
| Get metadata | |
| Create schedule | |
| Deploy frontend | |
| Get logs | |
https://your-project.region.insforge.appAuthorization: Bearer {admin-token-or-api-key}| 任务 | 接口地址 |
|---|---|
| 执行SQL | |
| 创建存储桶 | |
| 部署函数 | |
| 配置认证 | |
| 获取元数据 | |
| 创建调度任务 | |
| 部署前端应用 | |
| 获取日志 | |
undefinedundefined
**Common build-time issues to fix before deploying:**
| Issue | Common Cause | General Solution |
|-------|--------------|------------------|
| Missing environment variables | Build-time env vars not set | Create `.env.production` with required variables |
| Module resolution errors | Edge functions mixed with app code | Exclude edge function directories from TypeScript/compiler config |
| Static export conflicts | Dynamic routes with static export | Use server-side rendering or configure static params |
| Missing dependencies | Incomplete node_modules | Run `npm install` and verify package.json |
**部署前需修复的常见构建问题**:
| 问题 | 常见原因 | 通用解决方案 |
|------|----------|--------------|
| 缺少环境变量 | 构建时未设置环境变量 | 创建`.env.production`并配置所需变量 |
| 模块解析错误 | 边缘函数与应用代码混合 | 在TypeScript/编译器配置中排除边缘函数目录 |
| 静态导出冲突 | 动态路由与静态导出不兼容 | 使用服务端渲染或配置静态参数 |
| 缺少依赖 | node_modules不完整 | 执行`npm install`并验证package.json |VITE_*NEXT_PUBLIC_*REACT_APP_*PUBLIC_*functions/VITE_*NEXT_PUBLIC_*REACT_APP_*PUBLIC_*functions/npm run buildnpm run buildinsert([{...}])insert({...})urlkey/functions/{slug}/apiinsert([{...}])insert({...})urlkey/functions/{slug}/api