VG-DOC · rev 0.1.0PII / DLP redaction firewall for LLM pipelinesMIT · Node 22+
VeilgateDocumentation
Flow 02 / 14Start hereNode 22+ · TypeScript strict, ESM

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

terminal
# 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 / LangGraph

Requires Node 22+. Everything is TypeScript (strict, ESM).

Your first redaction

first.ts
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.

Going to production?

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.

shapes.ts
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 untouched

Try it with no API key

Two runnable examples ship in the repo’s examples/ directory:

terminal
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 curl

With pnpm serve running, in another terminal:

terminal 2
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.

Note

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