ProofGate TypeScript SDK
The official SDK for integrating deterministic consequence rails into production apps. Keep model output untrusted, enforce policy gates, and execute side effects only with signed proofs.
Recommended environment
PROOFGATE_BASE_URL
https://api.proofgate.dev
PROOFGATE_API_KEY
sk_live_••••••••••••
Official npm package
Install proofgate and integrate in minutes.
Receipts on every call
Decision + execution receipts returned per execution for auditing.
Production-ready runtimes
Node services, Next.js route handlers, and worker runtimes.
Install
npm i proofgateUse PROOFGATE_BASE_URL=https://api.proofgate.dev for the canonical production API.
Server integration (Express / API worker)
Copy-friendlyScrolls inside box
import express from "express";
import crypto from "crypto";
import { ProofGateClient } from "proofgate";
const app = express();
app.use(express.json());
const proofgate = new ProofGateClient({
baseUrl: process.env.PROOFGATE_BASE_URL ?? "https://api.proofgate.dev",
apiKey: process.env.PROOFGATE_API_KEY
});
app.post("/agent/action", async (req, res) => {
const result = await proofgate.execute({
intentId: crypto.randomUUID(),
action: "email.send",
actor: { actorId: req.body.userId, actorType: "human" },
payload: req.body.payload,
requestedScopes: ["email.send"],
meta: { source: "support-agent" }
});
res.json(result);
});Tip: keep PROOFGATE_BASE_URL set to https://api.proofgate.dev in production.
Browser usage via your backend endpoint
Copy-friendlyScrolls inside box
// Browser code (no API key in the client bundle)
await fetch("/api/proofgate/execute", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
intentId: "intent_checkout_01",
action: "email.send",
actor: { actorId: "user_123", actorType: "human" },
payload: {
to: ["customer@company.com"],
cc: [],
bcc: [],
subject: "Order confirmation",
body: "Your order is confirmed.",
links: []
},
requestedScopes: ["email.send"],
meta: { flow: "checkout" }
})
});
// Route handler / API server
import { ProofGateClient } from "proofgate";
const proofgate = new ProofGateClient({
baseUrl: process.env.PROOFGATE_BASE_URL ?? "https://api.proofgate.dev",
apiKey: process.env.PROOFGATE_API_KEY
});
export async function POST(req: Request) {
const input = await req.json();
const result = await proofgate.execute(input);
return Response.json(result);
}Tip: keep PROOFGATE_BASE_URL set to https://api.proofgate.dev in production.