Skip to content

keyflare-labs/keyflare

Repository files navigation

Cover

Deploy to Cloudflare NPM

Open-source secrets manager built entirely on Cloudflare.

One Worker. One D1 database. One master key. Zero trust storage. CLI-based.

What is Keyflare? πŸ”₯

Keyflare is a free, self-hosted secrets manager (like Doppler or Infisical) that runs entirely on Cloudflare's infrastructure β€” a single Worker + a single D1 database. All secrets are encrypted at rest with AES-256-GCM. You can use Cloudflare's free plan without any issues.

Key Features

  • πŸ€‘ Completely free with no limits β€” You can host your secrets manager on Cloudflare with practically no limits. Infinite projects, environments and secrets.
  • πŸš€ CLI-first β€” Everything managed via the kfl command-line tool.
  • πŸ—οΈ Single deployment β€” One Cloudflare Worker + one D1 database. No VMs, no containers, no infra to manage.
  • πŸ”‘ Scoped API keys β€” User keys for management, system keys scoped to specific projects/environments.
  • πŸ“¦ Projects & environments β€” Organize secrets by project (my-api) and environment (production, staging, development).
  • πŸ’‰ Runtime injection β€” kfl run -- npm start injects secrets as env vars without writing to disk.
  • πŸ“„ Multi-format export β€” Download as .env, JSON, YAML, or shell exports.
  • πŸ”’ Encrypted at rest β€” All secret keys and values are AES-256-GCM encrypted. Even with full DB access, data is unreadable.

Getting started πŸš€

πŸ‘‰ Read the full documentation at keyflare.mintlify.app

# Install the CLI
npm install -g @keyflare/cli

# Deploy Keyflare to your Cloudflare account
kfl init

# Create a project and environment
kfl projects create my-api
kfl env create production --project my-api

# Upload secrets from a .env file
kfl secrets upload .env.production --project my-api --env production

# Inject secrets into a command
kfl run --project my-api --env production -- npm run build

# Download secrets as .env file
kfl secrets download --project my-api --env production --output .env

Documentation

πŸ‘‰ Read the full documentation at keyflare.mintlify.app

Monorepo Structure

keyflare/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ server/     # Cloudflare Worker API
β”‚   β”œβ”€β”€ cli/        # kfl command-line tool
β”‚   └── shared/     # Shared types & utilities
└── docs/           # Documentation & diagrams

Architecture

CLI (kfl) ──HTTPS──▢ Cloudflare Worker ──▢ D1 (encrypted)
                          β”‚
                     MASTER_KEY
                   (Worker Secret)
  • Secrets are encrypted with AES-256-GCM using a master key
  • API keys are hashed with SHA-256 (128-bit entropy, brute-force infeasible)
  • Lookups use HMAC-SHA256 (keyed hash β€” no plaintext in DB, not even key names)
  • Master key stored as a Cloudflare Worker Secret (never in code, never in DB)

Security Model (TL;DR)

What How
Secret values in DB AES-256-GCM encrypted (per-row random IV)
Secret key names in DB AES-256-GCM encrypted
Project/env names in DB AES-256-GCM encrypted + HMAC-SHA256 hash for lookups
API keys in DB SHA-256 hashed (128-bit entropy keys)
Master encryption key Cloudflare Worker Secret (never in code/DB)
Key derivation HKDF-SHA256 (separate keys for encryption vs HMAC)
Transport TLS 1.3 (Cloudflare edge)

Single point of failure: The master key. If lost, all data is unrecoverable. Back it up securely. The master key is shown once during kfl init.

Contributing

We welcome all contributions β€” bug fixes, features, docs improvements, and ideas!

  1. Fork the repo and create a branch
  2. Make your changes (see the development guide)
  3. Run pnpm run typecheck and pnpm test to make sure everything passes
  4. Open a pull request β€” we'll review it promptly

License

MIT