Install & quickstart
Install the Veilgate core engine and optional integrations, run your first redaction in mock mode, and try the no-API-key demo and proxy server.
Install
# core engine
npm install veilgate
# optional: presets + loader, and whichever integration you use
npm install veilgate-policy # presets + YAML/JSON loader
npm install veilgate-proxy # Express / Fastify / raw HTTP
npm install veilgate-ai-sdk # Vercel AI SDK
npm install veilgate-langchain # LangChain / LangGraphRequires Node 22+. Everything is TypeScript (strict, ESM).
Your first redaction
import { redact, rehydrate } from "veilgate";
const r = await redact("My name is Alice Johnson.");
r.output; // "My name is [REDACTED_PII_1]."
r.blocked; // false
rehydrate(r.output, r.vault); // "My name is Alice Johnson."This is mock mode — deterministic, no network, no API key.
Switching to live mode calls the real Jev API and needs a key. Copy .env.example → .env and
set TYPESAFE_API_KEY, or set it in your host’s secret store — see
Mock vs. live mode → Supplying the API key for the full procedure.
The shape is preserved
Pass a string, get a string. Pass a JSON object, get the same object with only sensitive field values replaced. Pass a chat array, get the array with roles intact and only message content redacted.
await redact({ note: "My name is Alice Johnson.", id: "ORD-1" });
// → { note: "My name is [REDACTED_PII_1].", id: "ORD-1" }
await redact([
{ role: "system", content: "You are helpful." },
{ role: "user", content: "My name is Alice Johnson." },
]);
// → user content redacted, roles and system message untouchedTry it with no API key
Two runnable examples ship in the repo’s examples/ directory:
pnpm demo # one-shot: 7 scenarios across core, policy, and the proxy
pnpm serve # a persistent mock proxy on http://127.0.0.1:8787 you can curlWith pnpm serve running, in another terminal:
curl -sX POST http://127.0.0.1:8787 -d '"email Alice Johnson, ssn 123-45-6789"'The serve terminal logs what the model actually received — [REDACTED_PII_1] — proving
the name and SSN never left the boundary. A credentials payload
("the admin password is hunter2") returns HTTP 403, and the model is never called at all.
pnpm demo / pnpm serve build every package first (pnpm -r build) and run the example
against each package’s built dist/. In a real app you import by package name instead.
Next steps
- The pipeline — how a payload becomes a routed decision
- Mock vs. live mode — switching on a real Jev key
- Core —
veilgate— the fullredact()API