Self-Hosting Guide

Install PasteProof

Run your own PasteProof backend on Cloudflare Workers. Perfect for individuals who want full control over their data.

License Information

PasteProof is licensed under the Business Source License 1.1. Individual, non-commercial use is always permitted. Commercial use requires a license. The license will change to Apache License 2.0 on January 1, 2029. See the full license for details.

What is Self-Hosting?

Self-hosting PasteProof allows you to run your own backend infrastructure instead of using the hosted service at api.pasteproof.com. This gives you:

  • Full control over your data and privacy
  • No dependency on external services
  • Custom configuration and patterns
  • Free to run on Cloudflare Workers (within limits)

Prerequisites

  • Node.js 18+
    Install from nodejs.org
  • Package Manager
    npm, pnpm, or yarn
  • Cloudflare Account
    Free account at cloudflare.com
  • Wrangler CLI
    Install globally: npm install -g wrangler

Installation Steps

1

Clone the Repository

Clone the PasteProof extension repository from GitHub:

$ git clone https://github.com/007jedgar/pasteproof.git
$ cd pasteproof/backend
2

Install Dependencies

Install the required packages:

$ npm install
# or
$ pnpm install
3

Create Cloudflare KV Namespaces

Create the required KV namespaces for data storage:

$ wrangler kv namespace create "WHITELIST_STORE"
$ wrangler kv namespace create "PATTERNS_STORE"
$ wrangler kv namespace create "DETECTIONS_STORE"
$ wrangler kv namespace create "LOGS_STORE"

Also create preview namespaces for local development:

$ wrangler kv namespace create "WHITELIST_STORE" --preview
$ wrangler kv namespace create "PATTERNS_STORE" --preview
$ wrangler kv namespace create "DETECTIONS_STORE" --preview
$ wrangler kv namespace create "LOGS_STORE" --preview
4

Configure wrangler.toml

Update wrangler.toml with the KV namespace IDs from step 3. The file should look like:

[[kv_namespaces]]
binding = "WHITELIST_STORE"
id = "your-namespace-id-here"

[[kv_namespaces]]
binding = "PATTERNS_STORE"
id = "your-namespace-id-here"

# ... etc
5

Generate API Key

Generate a secure API key for authentication:

$ openssl rand -hex 32

Add it to wrangler.toml:

[vars]
API_KEY = "your-generated-api-key-here"
6

Authenticate with Cloudflare

Log in to your Cloudflare account:

$ wrangler login

Running Locally

Test your backend locally before deploying:

$ npm run dev

The worker will be available at http://localhost:8787

Test the health endpoint:

$ curl http://localhost:8787/v1/health

Deploy to Cloudflare

Deploy your worker to Cloudflare:

$ npm run deploy
# or
$ wrangler deploy

After deployment, you'll receive a URL like:

https://pasteproof-backend.your-subdomain.workers.dev

Verify it's working:

$ curl https://pasteproof-backend.your-subdomain.workers.dev/v1/health

Using with the Extension

To use your self-hosted backend with the PasteProof extension:

  1. Clone the extension repository: git clone https://github.com/007jedgar/pasteproof.git
  2. Navigate to the extension directory: cd pasteproof
  3. Create a .env file in the root:
VITE_SELF_HOSTED_API_URL=https://pasteproof-backend.your-subdomain.workers.dev
  1. Build the extension: pnpm build
  2. Load the built extension from .output/chrome-mv3 directory

Note: You'll need to sign in/create an account on the production site first to get an API key, then use that same API key with your self-hosted backend.

Features

✅ Single-User Authentication

API key-based authentication for secure access

✅ Whitelist Management

Manage domains where scanning is disabled

✅ Custom Patterns

Create custom regex patterns for detection

✅ AI-Powered Detection

Context-aware PII detection using Cloudflare Workers AI

✅ Analytics & Logs

Track detections and view audit logs

✅ No Database Required

Uses Cloudflare KV for storage (no database setup needed)

Limitations

  • Single-user only (no multi-user support)
  • Data stored in Cloudflare KV (subject to KV limits)
  • Rate limiting is disabled (can be added if needed)
  • No persistent database (data is stored in KV with size limits)

Resources

Ready to Get Started?

Follow the steps above to set up your own PasteProof backend.

View on GitHub