Skip to content

Installation

  • Node.js >= 18 (ES2022 target)
  • TypeScript >= 5.0 (recommended)

Install the adapter package for your framework. Each adapter includes @guardcore/core as a dependency.

Terminal window
npm install @guardcore/express
pnpm add @guardcore/express
yarn add @guardcore/express
bun add @guardcore/express
Terminal window
npm install @guardcore/fastify
pnpm add @guardcore/fastify
yarn add @guardcore/fastify
bun add @guardcore/fastify
Terminal window
npm install @guardcore/nestjs
pnpm add @guardcore/nestjs
yarn add @guardcore/nestjs
bun add @guardcore/nestjs
Terminal window
npm install @guardcore/hono
pnpm add @guardcore/hono
yarn add @guardcore/hono
bun add @guardcore/hono

These are all optional. Install them to enable specific features.

PackageFeatureRequired for
ioredisRedis clientDistributed rate limiting, IP bans, caching
re2-wasmReDoS-safe regexSafe pattern matching on untrusted input
maxmindGeoIP lookupsCountry-based filtering (blockedCountries, whitelistCountries)
heHTML entity decodingEnhanced content preprocessing in detection engine
acornJS AST parsingCode injection risk scoring in semantic analyzer
Terminal window
# Redis support
pnpm add ioredis
# ReDoS-safe regex (recommended for production)
pnpm add re2-wasm
# GeoIP country filtering
pnpm add maxmind

All features gracefully degrade when their peer dependency is not installed:

  • Without ioredis: rate limiting and IP bans use in-memory storage
  • Without re2-wasm: falls back to native RegExp with worker_threads timeout protection
  • Without maxmind: country-based filtering is unavailable (you can still provide a custom geoResolver)

CORS integration requires a framework-specific CORS package:

AdapterCORS Package
@guardcore/expresscors
@guardcore/fastify@fastify/cors
@guardcore/honoBuilt-in (hono/cors)
@guardcore/nestjsUse Express CORS or @nestjs/platform-express