Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Contributing

Set up the keypal repository, run the unit tests and the Redis and Postgres suites locally, and send a pull request that keeps every key working.

keypal is MIT licensed and developed in the open on GitHub. Bug reports, fixes, docs edits, and new storage adapters are all welcome.

Before you start

  • Search open issues first. If your change is large, open an issue to agree on the approach before writing it.
  • Don’t report a security problem in a public issue. Contact the maintainer, @izadoesdev, privately first.

Set up

keypal uses Bun for installs and scripts and Vitest for tests.

git clone https://github.com/izadoesdev/keypal
cd keypal
bun install
bunx lefthook install  # once, enables the pre-commit hook

# Everything that doesn't need a database
bunx vitest run \
  --exclude '**/redis.test.ts' \
  --exclude '**/drizzle.test.ts' \
  --exclude '**/kysely.test.ts' \
  --exclude '**/prisma.test.ts'

bun run test starts Vitest in watch mode; bunx vitest run runs once and exits. That covers key generation, hashing, verification, scopes, the manager, and the memory store.

Test against the databases

The adapter tests run against real servers. docker-compose.yml starts one of each, on the ports the tests expect:

docker compose up -d
Service Port Test command
Redis 6379 bun run test:redis
Postgres for Kysely 5433 bun run test:kysely
Postgres for Drizzle 5434 bun run test:drizzle
Postgres for Prisma 5435 bun run test:prisma, after creating the schema once (below)

The Prisma suite needs its schema pushed once. prisma/schema.prisma reads DATABASE_URL, so set it to the Compose database unless you already point it elsewhere:

DATABASE_URL="${DATABASE_URL:-postgresql://keypal:keypal_dev@localhost:5435/keypal_prisma}" bunx prisma db push

Each Postgres suite also reads DATABASE_URL if you’d rather use your own server.

Making a change

  • Keep key generation and hashing byte-for-byte compatible. src/core/compat.test.ts pins hashes from earlier releases; if it fails, existing users’ keys would stop verifying.
  • Add a test that fails without your change. Storage changes belong in the shared contracts in src/storage/store-contract.ts, so every adapter is held to them.
  • Run bun run typecheck and bunx ultracite check before you push. The pre-commit hook formats staged files for you once you’ve run bunx lefthook install.
  • Update the docs in apps/docs/docs when behavior changes. Run them locally with cd apps/docs && bun install && bun run dev.

Pull requests

Write the PR description for someone who hasn’t read the code: what changed, why, and how you tested it. CI runs the unit tests and every database suite on each push.

Releases

Releases are published to npm from GitHub Actions with provenance. Each GitHub release appears in the changelog at keypal.dev/changelog.

Was this page helpful?