For AI agents: the complete documentation index is available at https://dotpress.dev/llms.txt, the full documentation bundle is available at https://dotpress.dev/llms-full.txt, and this page is available as Markdown at https://dotpress.dev/getting-started/installation.md.

Installation

Requirements

  • Node.js 22.12 or later. We recommend the current LTS release. Dotpress is tested on Node.js 22, 24 and 26. With Node.js 22.18 or later, Node.js runs TypeScript files directly, without a build step: the examples of this documentation use it.
  • TypeScript, with strict enabled. The packages are tested with TypeScript 6.
  • Zod 4, for the schemas.

The packages are ES modules. A CommonJS project can still load them with require(), which Node.js 22.12 supports for ES modules.

Install the core and an adapter

Dotpress runs on the HTTP server of your choice: install the core, the adapter of your server, the server itself and Zod.

Express

npm
yarn
pnpm
bun
deno
npm install @dotpress/core @dotpress/adapter-express express zod

Fastify

npm
yarn
pnpm
bun
deno
npm install @dotpress/core @dotpress/adapter-fastify fastify zod

Hono

npm
yarn
pnpm
bun
deno
npm install @dotpress/core @dotpress/adapter-hono hono @hono/node-server zod

Not sure which one to pick? Your routes do not depend on it, and you can switch later: see Choosing an adapter. For AWS Lambda, see the Lambda adapter.

Configure TypeScript

A configuration for Node.js 22.18 or later, which runs the .ts files directly:

tsconfig.json
{
  "compilerOptions": {
    "target": "ES2023",
    "lib": ["ES2023"],
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "types": ["node"],
    "strict": true,
    "noEmit": true,
    "allowImportingTsExtensions": true,
    "erasableSyntaxOnly": true,
    "verbatimModuleSyntax": true,
    "skipLibCheck": true
  },
  "include": ["src", "test"]
}

Node.js only strips the types: erasableSyntaxOnly rejects the TypeScript syntax it cannot strip (enums, parameter properties), and relative imports end with .ts. Set "type": "module" in package.json.

If you compile your code with tsc or a bundler instead, keep strict: true and use your usual settings.

Add packages

Each package is optional. Install it when you need it:

NeedPackage
Authentication@dotpress/auth@alpha, see the note below
OpenAPI document and API reference@dotpress/openapi
Emails@dotpress/mailer
Events and workers@dotpress/events
Cache and memoization@dotpress/cache
Tests@dotpress/testing (dev dependency)
@dotpress/auth during the alpha

Install @dotpress/auth with the alpha tag. Without a tag, npm installs @dotpress/auth 1.x, the plugin of Dotpress 1.

Start from an example

Each example is a complete project, with its tests, that you can copy:

npx degit dotpressjs/dotpress/examples/express my-api
cd my-api
npm install
npm run dev