AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻譯準備中
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Self-hosted, agent-safe backend on Cloudflare Workers + D1: policies compiled to SQL, Better Auth, auto REST and a read-only MCP server.
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗A self-hosted backend on Cloudflare: one Worker and one D1 database in your account serve REST endpoints for your tables. Every endpoint is protected by policies written in TypeScript and compiled to SQL. An MCP server lets AI agents inspect exactly what production enforces.
WHERE clauses, so pagination and counts stay correct.Status: v0.4.1 (changelog). Early, but deployed and working. Upgrading from 0.4.0? See the upgrade guide. Read Status and limits before using it for anything important.
Requires Node 20+ and pnpm.
npm create @castra-kit@latest my-app
cd my-app
cp .dev.vars.example .dev.vars # set BETTER_AUTH_SECRET: openssl rand -base64 32
pnpm db:migrate:local
pnpm dev # http://localhost:8787/health
Deploy to your Cloudflare account (token permissions: docs/cloudflare-token.md):
CLOUDFLARE_API_TOKEN=... pnpm run deploy
The full walkthrough, including your first request and your first policy, is in Getting started.
import { authenticated, defineConfig, isPublic, owner, role } from "@castra-kit/core";
export default defineConfig({
database: "d1",
roles: ["admin", "editor"],
tables: {
posts: {
read: isPublic().where((q) => q.eb("status", "=", "published")).or(owner("author_id")),
create: authenticated(),
update: owner("author_id").or(role("editor", "admin")),
delete: role("admin"),
fields: { author_id: { setBy: "server" } },
},
},
});
// Any table not listed here is never exposed.
| Getting started | Scaffold, run, first request, first policy, deploy |
| Concepts and configuration | Rules, write checks, field rules, config reference |
| REST API | Routes, filters, sorting, pagination, includes, errors |
| Auth | Better Auth, sessions, roles, API keys |
| MCP | Tools, local stdio server, remote /mcp, tokens and scopes |
| CLI | castra generate, provision, migrate, deploy, doctor, mcp |
| Rate limiting | Per-IP write limits, WAF rule for reads |
| Status and limits | What is verified, D1 limits, what is out of scope |
| Security | Threat model, guarantees, known issues |
| Problem types | Every error code the API returns |
| Architecture · |
Questions and ideas: Discussions. Troubleshooting and FAQ: Wiki.
| Package | |
|---|---|
@castra-kit/core | Policy engine, schema snapshot, REST router, OpenAPI |
@castra-kit/auth | Better Auth wiring, roles, API keys |
@castra-kit/mcp | MCP tools, stdio server, /mcp route |
@castra-kit/app | createCastraApp: the Worker wiring in one call |
@castra-kit/cli | The castra command |
@castra-kit/create | Project scaffolder |
See CONTRIBUTING.md. Report vulnerabilities privately, as described in SECURITY.md.
MIT © Mehmet Özer Özdaş
| Design and one record per decision |