gitwtfhub

wtf is rampart?

nationaldesignstudio/rampart — explained in plain English

Analysis updated 2026-05-18

151TypeScriptAudience · developerComplexity · 3/5Setup · easy

TL;DR

A browser-based library that detects and redacts personal information like names, SSNs, and card numbers from text before it reaches an AI model, then restores it locally.

Mindmap

mindmap
  root((repo))
    What it does
      Redacts PII in browser
      Restores values locally
      Runs before AI model
    Tech stack
      TypeScript
      ONNX model
      Hugging Face
    Use cases
      Chat privacy layer
      Local redaction
      Session restore
    Audience
      App developers
      Privacy engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Scrub personal information out of chat messages before sending them to an AI model or server.

REASON 2

Redact SSNs, credit card numbers, emails, and addresses directly in the browser.

REASON 3

Restore original personal details locally after getting a response back from an LLM.

REASON 4

Add a privacy layer to a chat app without sending user text to a third-party redaction service.

What's in the stack?

TypeScriptONNXHugging Face Transformersnpm

How it stacks up

nationaldesignstudio/rampartmclisterjoeh2o/yellowkey-bitlockermikaeldengale-cloud/deepseek-v4-pro-app
Stars151152152
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyeasyeasy
Complexity3/51/51/5
Audiencedevelopergeneralgeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Requires the @huggingface/transformers peer dependency to load and run the bundled ONNX model.

Wtf does this do

Rampart is a local-first tool that removes personal information from text a user types, before that text ever leaves the browser. It runs entirely on the client side and combines a small machine learning model with a set of rule-based checks to catch things like names, social security numbers, credit card numbers, emails, and addresses. The system uses two layers that work together. The first is a deterministic layer built from regular expressions and validation rules. It handles data types that can be checked mathematically, such as credit card numbers, validated with the Luhn checksum, and social security numbers, along with emails, web addresses, and IP addresses. The second layer is a small machine learning model, about 14.7 megabytes in size, trained to recognize things a simple rule cannot catch on its own, like full names, phone numbers, and street addresses. It supports seven languages that use Latin script: English, Spanish, French, German, Italian, Portuguese, and Dutch. Text in other scripts, such as Chinese, Japanese, Korean, or Arabic, is not reliably supported yet. Detected personal information is replaced with placeholders like [SSN_1] before anything is sent to an AI model or server, and the real values are restored later on the user's own device using a local table that is never transmitted elsewhere. Coarser details like city, state, and ZIP code are kept by default so an assistant can still reason about general location, while exact street addresses are always redacted. The project reports strong recall numbers on its own test set, catching over 98 percent of private information across the seven supported languages while keeping most non-sensitive text intact. It notes this is meant as harm reduction rather than perfect protection, since no detector this small will catch every case. Rampart ships as an npm package written mostly in TypeScript. Developers install it alongside a Hugging Face library dependency, create a guard object for each conversation, and use it to scrub user messages before sending them to a language model, then restore the original values in the reply shown to the user.

Yoink these prompts

Prompt 1
Show me how to install @nationaldesignstudio/rampart and set up a ChatGuard for my chat app.
Prompt 2
Explain the difference between the deterministic recognizer layer and the machine learning model in Rampart.
Prompt 3
How do I use guard.protect() and guard.reveal() together to scrub and restore user messages?
Prompt 4
What personal information types does Rampart redact by default, and how do I change the keep-set policy?

Frequently asked questions

wtf is rampart?

A browser-based library that detects and redacts personal information like names, SSNs, and card numbers from text before it reaches an AI model, then restores it locally.

What language is rampart written in?

Mainly TypeScript. The stack also includes TypeScript, ONNX, Hugging Face Transformers.

How hard is rampart to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is rampart for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.