Skip to content

Home

API Reference ​

Packages ​

PackageDescription
@opengovsg/logging

A framework-agnostic structured logging core built on pino. It standardises a flat, Datadog-aligned newline-delimited JSON wire schema with custom syslog levels, scoped loggers that accumulate an action path, contextual metadata, an oversized-context guard, and pluggable error serialisation (a framework-neutral default, overridable via ).

Call once at boot with your deployment identity, then create request-scoped loggers from the returned .

@opengovsg/rate-limit

A framework-agnostic rate-limiting core built on rate-limiter-flexible.

Counters live in an injected Redis (ioredis) client so limits are shared across replicas, with an in-memory fallback that keeps enforcement alive through Redis outages or when no client is configured. A steady window can be composed with a short burst allowance to absorb legitimate spikes.

guards pre-authentication traffic by client IP.

enforces per-actor, per-resource quotas for identified traffic.

exposes the underlying core for anything else.

@opengovsg/testcontainersA declarative wrapper over testcontainers for integration and e2e test setups: a zod-validated container config schema, setup/teardown over GenericContainer, Vitest context handoff, and Postgres/Redis presets.
@opengovsg/validatorsA set of validators that provide sensible defaults to prevent common security vulnerabilities.