Generated apps talk to Forge64 services through small SDK files that Forge64 writes into the project. Keys live in the app's server-side environment and are never sent to the browser.
App AI Gateway (available, rolling out)
Every app hosted on Forge64 can call AI through a chat-completions-compatible API, billed from your Forge64
credits. The SDK is written to src/lib/forge-ai.ts and reads its key from FORGE_AI_KEY.
import { ai, aiChat, aiEmbed } from "@/lib/forge-ai";
const summary = await ai("Summarise this booking request in one sentence: ...");
ai(prompt)returns text;aiChat(messages)returns text plus token counts;aiEmbed(input)returns vectors.- Server-side only: the SDK refuses to run in the browser, and the API refuses requests with browser origin headers.
- Caps: a per-app monthly cap, an owner cap across apps, 60 requests per minute per app and 10 per end user. A request that would pass a cap is refused before the model is called.
- Keys are created, rotated and revoked from the project; at most 5 live keys per app.
The raw endpoints (/v1/chat/completions, /v1/messages, /v1/embeddings, /v1/models) accept the common
chat and embeddings request shapes, so existing client libraries work when pointed at the gateway.
Error tracking (available, rolling out)
Forge64 accepts the standard Sentry SDK envelope, so an app that uses a Sentry SDK reports errors to Forge64 instead of a separate account. When an app reaches its error cap, ingest answers with a back-off signal the SDK honours.
Analytics (available, rolling out)
A cookieless page-view beacon under 1,024 bytes, added with one script tag. Paths, referrers and locations are coarsened before storage.
Background jobs and cron (rolling out)
Queue work to run later, or on a schedule, with retries. The SDK is written to src/lib/forge-jobs.ts. Server-side only.
import { enqueue, schedule, defineJob } from "@/lib/forge-jobs";
defineJob("send-receipt", async (payload) => { /* your code */ });
await enqueue("send-receipt", { orderId: 42 }, { idempotencyKey: "order-42" });
await schedule("nightly-report", "0 2 * * *"); // UTC cron
- Forge64 delivers each run to
POST /api/forge/jobson your app; exporthandleJobRequestfrom that route once. Every delivery is signed and the handler refuses a request whose signature or timestamp does not check out. - A handler that throws fails the attempt and the run is retried with backoff, up to
maxAttempts. - The same
idempotencyKeygives one run, never two.getRun(id)returns status, attempt and the last error.
File uploads and images (rolling out)
Store files for your app and serve resized images. The SDK is written to src/lib/forge-uploads.ts. Server-side only.
import { uploadFile, fileUrl } from "@/lib/forge-uploads";
const file = await uploadFile(bytes, { filename: "avatar.png", contentType: "image/png", visibility: "public" });
const url = await fileUrl(file.id, { width: 640, format: "webp" }); // resized once, then cached
- Large files can go straight from the browser:
createUploadreserves a slot for the exact byte size, the browserPUTs the bytes, andcompleteUploadvalidates them. - Private files have no permanent URL;
fileUrlreturns a link that expires.
Forms and waitlists (rolling out)
Accept form submissions and run a waitlist without writing a backend for it. The SDK is written to
src/lib/forge-forms.ts.
import { createForm, createWaitlist, listSubmissions } from "@/lib/forge-forms";
const form = await createForm({ name: "contact", allowedOrigins: ["https://yourapp.com"], notifyEmail: "you@yourapp.com" });
// <form method="post" action={form.submitUrl}> ... </form>
- Only the sites in
allowedOriginscan submit, every form has a bot trap field, and submissions are rate limited. - Waitlists track sign-up order and referrals;
listWaitlistreturns entries with their referral counts.
Search (rolling out)
Full-text search over your app's own data, hosted by Forge64. The SDK is written to src/lib/forge-search.ts.
import { search, indexDocuments, removeDocuments } from "@/lib/forge-search";
await indexDocuments("products", [{ id: p.id, title: p.name, body: p.description, url: "/p/" + p.slug }]);
const { hits } = await search("products", "red shoes", { limit: 10 });
await removeDocuments("products", [p.id]);
- Each hit carries a
snippetthat is safe HTML: the only tags in it are<mark>highlights. indexDocumentssends at most 100 documents per request and batches larger lists for you.- Browsers search through a generated server route, so the app's key never reaches the client.
Blog and docs content (rolling out)
A blog and a docs section whose posts are stored by Forge64 and rendered from Markdown to safe HTML. The SDK is
written to src/lib/forge-content.ts.
import { posts, post, docsTree, contentSitemap } from "@/lib/forge-content";
const { entries, nextCursor } = await posts({ limit: 20, tag: "news" });
const article = await post("hello-world"); // null when the slug does not exist
- Each post includes its HTML, a table of contents and its SEO fields (title, description, canonical, noindex).
contentSitemapreturns the published entries for yourapp/sitemap.ts.
Feature flags and experiments (rolling out)
Feature flags and A/B experiments, evaluated inside your app from a cached copy of the flag rules. The SDK is written
to src/lib/forge-flags.ts.
import { flag, variant, track } from "@/lib/forge-flags";
if (await flag("new-checkout", { id: user.id, attributes: { plan: user.plan } })) { /* new flow */ }
const v = await variant("pricing-page", { id: user.id });
await track({ id: user.id }, "signup");
- Evaluation runs locally against the cached rules; exposures and conversions are sent in batches.
- User ids are hashed with SHA-256 before an exposure or conversion event leaves your app.
Realtime channels and presence (rolling out)
Push events to browsers and see who is online in a channel. The server SDK is written to src/lib/forge-realtime.ts;
the browser connects with src/lib/forge-realtime-client.ts using a token your server issues.
import { publish, issueToken, presence } from "@/lib/forge-realtime";
await publish("room-42", "message", { text: "Hello" });
const token = await issueToken("room-42", { userId: user.id, mode: "presence" }); // send to the browser
const { peers } = await presence("room-42");
- The API key stays on your server: the browser only receives a single-use connection token.
- A published event is JSON of up to 8 KB.
Outgoing webhooks (rolling out)
Let your customers subscribe their own URLs to events in your app. The SDK is written to src/lib/forge-webhooks.ts.
import { addEndpoint, sendEvent, listDeliveries } from "@/lib/forge-webhooks";
const endpoint = await addEndpoint("https://customer.example/hooks", { eventTypes: ["order.paid"] });
await sendEvent("order.paid", { orderId: order.id, total: order.total });
const { deliveries } = await listDeliveries({ status: "dead" });
- Every endpoint gets a signing secret; receivers check it with
verifyWebhook, androtateSecretreplaces it. - Failed deliveries can be listed and sent again with
replayDelivery.
Vector store (rolling out)
Store items and find the closest matches, for semantic search or retrieval. The SDK is written to
src/lib/forge-vectors.ts.
import { createCollection, upsert, search } from "@/lib/forge-vectors";
await createCollection("articles");
await upsert("articles", [{ id: a.id, text: a.body, metadata: { lang: "en" } }]);
const { matches } = await search("articles", "how do refunds work", { topK: 5 });
- Items take
textor a precomputedvector; a search takes a text query or a vector.
PDF generation (rolling out)
Turn HTML into a PDF on the server, for invoices, tickets and reports. The SDK is written to src/lib/forge-pdf.ts.
import { htmlToPdf } from "@/lib/forge-pdf";
const { bytes, pages } = await htmlToPdf("<h1>Invoice 1042</h1>", { title: "Invoice 1042", pageSize: "A4" });
- Page size is
A4orLetter; the result is the PDF bytes and its page count.
Translation catalogs (rolling out)
Keep your app's strings in one source locale and translate the rest. The SDK is written to src/lib/forge-i18n.ts
and is used by server code and scripts, never shipped to browsers.
import { addLocale, pushSource, translate, pullCatalog } from "@/lib/forge-i18n";
await addLocale("de");
await pushSource("en", { "cart.empty": "Your cart is empty" });
await translate("de");
const { messages, missing } = await pullCatalog("de");
pullCatalogreports keys that are still missing or stale after the source text changed.
Support inbox (rolling out)
A chat widget for your app that lands in a support inbox. Signed-in users are attached to their own conversation
with supportIdentity from src/lib/forge-support.ts.
import { supportIdentity } from "@/lib/forge-support";
const identity = supportIdentity({ id: user.id, email: user.email, name: user.name });
- The identity is signed on your server; the secret never reaches the browser.
- The generated
<ForgeSupport user={...} />component insrc/components/forge-support.tsxrenders the widget.
Status page (rolling out)
Each app gets its own /status and /changelog pages. Server code can read the same data from
src/lib/forge-status.ts.
import { getForgeStatus } from "@/lib/forge-status";
const status = await getForgeStatus(); // null when the status page is not set up
- Visitors subscribe to updates on the hosted page, with a confirmation email (double opt-in).
Coming soon
Email sent from your app (transactional email with a monthly allowance) is coming soon. The service is built, but sending from your app is paused by default. Sign-up, password-reset and invitation email for your app's own users already works.