Installation
Runtime requirements
Section titled “Runtime requirements”Apiary targets any runtime with modern Web Standard support: Node.js 18+, Deno, Bun, or Cloudflare Workers. The core package has no runtime dependencies.
@apiary-dev/core
Section titled “@apiary-dev/core”Install with your package manager of choice:
# pnpmpnpm add @apiary-dev/core
# npmnpm install @apiary-dev/core
# yarnyarn add @apiary-dev/core
# bunbun add @apiary-dev/coreThe 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@apiary-dev/postgres
Section titled “@apiary-dev/postgres”The PostgreSQL adapter is a regular npm package. It depends on pg
(node-postgres), which you install alongside it:
pnpm add @apiary-dev/postgres pgThen apply the migration and pass a pg.Pool to the repository. See the
PostgreSQL guide for the full setup.
ESM and CJS
Section titled “ESM and CJS”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.
Requirements of your bundler
Section titled “Requirements of your bundler”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.