Skip to main content

Development Guide

Learn how to set up a development environment and contribute to Keyflare.

Prerequisites

Install pnpm:
A Cloudflare account is only required for remote deployment. Local development runs entirely offline via Miniflare.

Getting Started

pnpm run setup runs pnpm install twice with a CLI build in between. This is necessary because pnpm links workspace bins during install — before any build scripts run — so dist/index.js must exist for the kfl bin to be linked correctly.

Running the CLI During Development

Project Structure

Local Development

The fastest way to get a local Keyflare instance running:

Manual Local Setup

Alternative to pnpm run dev:init:

Database Migrations

The schema is defined in packages/server/src/db/schema.ts. Never edit migration SQL files by hand — always use drizzle-kit.
Generated migration files are committed to the repo and applied automatically in tests.

Drizzle Studio

Browser-based GUI to inspect and edit the database.

Local

Remote (Production)

Remote Studio connects directly to production data. All values shown are AES-256-GCM ciphertext — unreadable without MASTER_KEY.

Building

Type Checking

Regenerate Worker types after changing wrangler.jsonc:

Linting

Linting uses oxlint with the typescript/no-floating-promises rule enabled.

Debugging

label, scopes, key_encrypted, and value_encrypted columns contain AES-256-GCM ciphertext — unreadable without MASTER_KEY.

Next Steps

Testing

Learn about the test suite and how to write tests.

Architecture

Understand how Keyflare works.