Skip to content

Installation

Apiary targets any runtime with modern Web Standard support: Node.js 18+, Deno, Bun, or Cloudflare Workers. The core package has no runtime dependencies.

Install with your package manager of choice:

Terminal window
# pnpm
pnpm add @apiary-dev/core
# npm
npm install @apiary-dev/core
# yarn
yarn add @apiary-dev/core
# bun
bun add @apiary-dev/core

The npm package ships ESM and CJS bundles plus type declarations. Import from either module system:

import { generateTimeSlots } from "@apiary-dev/core"; // ESM
const { rangesOverlap } = require("@apiary-dev/core"); // CJS

The PostgreSQL adapter is a regular npm package. It depends on pg (node-postgres), which you install alongside it:

Terminal window
pnpm add @apiary-dev/postgres pg

Then apply the migration and pass a pg.Pool to the repository. See the PostgreSQL guide for the full setup.

Both packages are authored in TypeScript with moduleResolution: "nodenext" and published as dual ESM/CJS with bundled type declarations, so no special transpilation is required in consumers.

Because the core package is zero-dependency and uses only standard APIs, it tree-shakes cleanly in Vite, esbuild, Rollup, webpack, and tsup. The postgres package should be used in server contexts where node: built-ins are available.