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

Installation

Install keypal and the database client for your storage adapter.

Install keypal

npm install keypal
pnpm add keypal
yarn add keypal
bun add keypal
nub add keypal
aube add keypal

keypal hashes with node:crypto, so it runs on Node.js, Bun, and other runtimes that provide that module. Its only runtime dependency is nanoid.

Add your storage client

The core package has no storage dependencies. Each adapter has its own import path, and the database client it uses is an optional peer dependency: install the one you use and skip the rest.

Storage Import Also install
Memory keypal (the default) or keypal/memory nothing
Redis storage: 'redis', or RedisStore from keypal/redis ioredis (5 or 6)
Drizzle DrizzleStore from keypal/drizzle, schema from keypal/drizzle/schema drizzle-orm
Kysely KyselyStore from keypal/kysely kysely
Prisma PrismaStore from keypal/prisma @prisma/client

For example, to keep keys in Redis:

npm install keypal ioredis
pnpm add keypal ioredis
yarn add keypal ioredis
bun add keypal ioredis
nub add keypal ioredis
aube add keypal ioredis

The SQL adapters also need the driver for your database, such as pg for PostgreSQL. Each storage page lists what to install and the table to create.

Next

Follow the quick start to create a key and verify a request.

Was this page helpful?