Creght API for AI
Creght implementation and configuration guides for AI coding agents.
This collection contains Creght implementation documentation for AI coding agents. Choose the guide that matches the current task to get executable configuration, code conventions, and acceptance rules.
Documentation
Connect to Creght over MCP →
Let Claude, Cursor and other AI assistants act on Creght with your account: the endpoint, how to connect each client, OAuth and permissions, every MCP tool's parameters and results, and limits such as CMS writes going live immediately and 20 MB per upload.
How to optimize llms.txt →
Turn a flat list of URLs into a concise, prioritized map that helps AI systems find the right Creght pages first.
Configure talizen.config.ts →
Implementation spec for AI agents: field groups and evaluation timing, html/body tag attributes, head/bodyEnd injected code, and per-request (ctx) => value fields.
Implement domain-based locale routing →
An agent-oriented specification for configuring locale ownership, domain redirects, locale-aware links, and multilingual CMS behavior in Creght.
Calling external APIs on the server and managing the cache →
Fetch data from outside the site in getServerSideProps, declare it with ctx.cacheDepends, and invalidate the page cache through the publish endpoint — without a declaration the page stays frozen on its first render.
Build site backend workflows with Func →
The Func overview for AI coding agents: when to use it, files and keys, runtime rules, the whole ctx surface, results and errors, auth and secrets, the SSR boundary, and the acceptance workflow. Tables, uploads, timeouts, and streaming each have a dedicated page.
JSON tables: definition, reads, and queries →
The full persistence layer for Func: the table definition file and what is validated when, the real shape of a record, the where/filter operators and the ones that fail silently, paging and ordering limits, merge-style updates, and the boundary people miss — tables belong to the project, not to a site version.
Uploads: signed direct upload and Func-generated files →
Choosing between the two upload paths: browser-selected files go straight to the CDN through a signed upload, and Func-generated bytes go through ctx.assets.upload at 20 MiB per call. Why a base64 relay always fails, and how a file belongs in a table.
Timeouts and streaming responses →
invoke defaults to 5 seconds, execution caps at 300, and results cap near 1 MiB: which limit a long task actually hits, and the order in which to diagnose context deadline exceeded. Includes the complete ctx.sse.send plus native Fetch parsing loop, and where streaming stops being the answer.
Integrate Alipay PC Web Payment with Func →
A complete Alipay PC web payment example for Func: public-key mode, RSA2, optional AES content encryption, trusted orders, verified notifications, and idempotent updates.
Form submission webhooks: real-time delivery and signatures →
POST every site form submission to your https URL: register through MCP, verify the HMAC-SHA256 signature, get automatic retries, and receive with a Func in another Creght project that stores submissions idempotently.
Send Email and Verification Codes with Integrations →
Connect the Resend integration and use ctx.email in Func for transactional email and email verification codes: the credential stays server-side, and code length, expiry, single use, constant-time comparison, attempt caps, and rate limiting are handled by the platform.
Take Alipay payments with an integration →
Connect the Alipay integration, then use ctx.payment.alipay in Func to start PC website payments and verify async notifications: the app private key stays on the server, while orders, amount checks and idempotent fulfilment stay in your own code.
Require a Verified Email to Sign Up →
With the policy on, verification becomes a separate server-side action: confirming a code records a single-use proof, and registration only checks whether this request carries it. Page code has no code argument and no "already verified" boolean.
Reset and Change Passwords →
Build "forgot password" and "change password" in Func: ctx.users.find decides whether to send a code, ctx.email.verifyCode checks it, ctx.users.setPassword changes it. Complete code for both flows, the three rules that fail silently if you skip them, and what you should not reimplement.
Sign In From a Func →
ctx.auth.login issues a session for an existing user — for passwordless emailed-code sign-in that the SDK cannot express, or to apply your own ban / onboarding / tenant rules at sign-in. Full code, the one rule you must not break, and where the audit trail lives.
Query users from a Func →
ctx.users is the project user directory: find resolves one person by identifier, query pages through the list. Covers the full user object, the three traps in find, the filter and ordering rules for query, and the section that matters most — the platform has no notion of roles, so the access gate is yours to write.
Take Stripe payments with an integration →
Connect the Stripe integration, then use ctx.payment.stripe in Func to create Checkout Sessions, reconcile on return and verify webhooks: the secret key and webhook signing secret stay on the server, while orders, amount checks and idempotent fulfilment stay in your own code.
Call OpenAI models with an integration →
Connect the OpenAI integration and use ctx.ai.openai in Func: chat for conversation and translation, json for reliable structured output, tools for a single tool call, image for generated images stored in your own project space. The API key stays on the server.
Add text to speech with an integration →
Connect the Azure Speech integration and use ctx.tts.azure.speak in Func to turn text into audio, with control over voice, rate, pitch and speaking style. upload stores the file in your project space and returns a permanent URL. The key stays on the server and your text is escaped into SSML for you.
