Skip to main content

Optional peer dependencies

@rtorcato/api-common installs one dependency for you, @rtorcato/js-common. Every third-party library is an optional peer dependency, so your project installs only the libraries that the subpaths you import actually use. Nothing is loaded until you import its subpath, and the package has no root export.

# core subpaths with no peers (errors, health, http, rate-limit, ...)
pnpm add @rtorcato/api-common

# Express adapters
pnpm add @rtorcato/api-common express zod

# Hono adapters
pnpm add @rtorcato/api-common hono zod

If you import a subpath and its peer is missing, Node fails with a "cannot find package" error that names the library. Install it with your package manager and try again.

Peers by subpath​

A subpath marked none works with no extra installs.

SubpathPeers you install
amqpamqplib
authjsonwebtoken
auth/expressexpress, jsonwebtoken
auth/honohono, jsonwebtoken
configdotenv, dotenv-expand, zod
cors/expresscors, express
errorsnone
errors/expressexpress, zod
errors/honohono, zod
express-utilsexpress
graceful-shutdownnone
healthnone
health/expressexpress
health/honohono
httpnone
loggerpino, zod
mcp@modelcontextprotocol/sdk
openapizod
openapi/expressexpress, swagger-jsdoc, zod
openapi/honohono, @hono/zod-openapi, @scalar/hono-api-reference
rate-limitnone
rate-limit/expressexpress
rate-limit/honohono
rate-limit/redisioredis
responsezod
security/expressexpress, helmet
testingjsonwebtoken, supertest
timeoutnone
timeout/expressexpress
timeout/honohono
ts-rest/expressexpress, @ts-rest/core, @ts-rest/express, @ts-rest/open-api, swagger-jsdoc, zod
upload/expressexpress, multer, multer-s3, @aws-sdk/client-s3
upload/honohono, @aws-sdk/client-s3
validationzod, zod-error
webhooksnone
webhooks/expressexpress
webhooks/honohono

Peers and supported versions​

PeerSupported rangeNeeded by
@aws-sdk/client-s3^3.0.0upload/express, upload/hono
@hono/zod-openapi^1.0.0openapi/hono
@modelcontextprotocol/sdk^1.32.2mcp
@scalar/hono-api-reference`^0.11.0
@ts-rest/core>=3.53.0-rc.1 <4ts-rest/express
@ts-rest/express>=3.53.0-rc.1 <4ts-rest/express
@ts-rest/open-api>=3.53.0-rc.1 <4ts-rest/express
amqplib`^0.10.0
cors^2.8.5cors/express
dotenv^18.0.9config
dotenv-expand^13.0.0config
express`^4.18.0
helmet^8.3.0security/express
hono^4.0.0auth/hono, errors/hono, health/hono, openapi/hono, rate-limit/hono, timeout/hono, upload/hono, webhooks/hono
ioredis`^5.0.0
jsonwebtoken^9.0.2auth, auth/express, auth/hono, testing
multer^2.0.0upload/express
multer-s3^3.0.0upload/express
pino^10.4.0logger
supertest^7.3.1testing
swagger-jsdoc^6.0.0openapi/express, ts-rest/express
zod^4.0.0config, errors/express, errors/hono, logger, openapi, openapi/express, response, ts-rest/express, validation
zod-error^2.0.0validation

pino-pretty is also an optional peer. Install it as a dev dependency if you want the pretty-printed output that the logger subpath uses in development.

Notes​

  • ts-rest peers (@ts-rest/core, @ts-rest/express and @ts-rest/open-api) need the release candidate. Install them with the rc tag, for example pnpm add @ts-rest/core@rc @ts-rest/express@rc @ts-rest/open-api@rc. npm's default latest is 3.52.1, which is outside the supported range and causes a peer conflict.
  • config needs dotenv, dotenv-expand and zod. Don't skip dotenv-expand.
  • zod is needed by config, logger, errors/express, errors/hono, openapi, openapi/express, response, validation and ts-rest/express.
  • Express is needed by every /express subpath, and by express-utils. Hono is needed by every /hono subpath. Subpaths never import a framework they don't name, so an Express app never loads Hono.
  • Testing needs jsonwebtoken and supertest in your dev dependencies.
  • If you are moving from the old packages, see Migrating from the old packages.