Restify
A Node.js framework purpose-built for REST API servers
js framework specifically optimized for building strict, RESTful HTTP APIs, providing built-in support for DTrace, request throttling, versioned routing, and structured error handling instead of the general-purpose web-app features…
Definition
Restify is a Node.js framework specifically optimized for building strict, RESTful HTTP APIs, providing built-in support for DTrace, request throttling, versioned routing, and structured error handling instead of the general-purpose web-app features (templating, sessions) found in frameworks like Express.
Overview
Restify was created in the early 2010s at Mark Cavage's team (later widely used at Netflix and other API-heavy companies) as a deliberate departure from general-purpose Node.js web frameworks. Where Express and similar frameworks are designed to serve both HTML web applications and APIs, Restify strips away templating engines, view rendering, and other browser-facing concerns to focus entirely on the semantics of building well-behaved REST services. A distinguishing feature of Restify is its native support for DTrace probes, letting operators trace and profile live request handling on supporting operating systems (notably Solaris/illumos and macOS) without adding application-level instrumentation. It also has built-in middleware for common API concerns: request throttling via token-bucket rate limiting, audit logging, CORS, gzip compression, and content negotiation, along with structured, RFC 7807-style error responses via its `RestError` classes, which standardize how the client sees HTTP error codes and messages. Restify's routing supports API versioning directly, letting a server dispatch to different handler implementations based on an `Accept-Version` header, which is useful for APIs that must support multiple client versions concurrently without URL-path versioning schemes. Its plugin and middleware model is conceptually similar to Express (`server.use()`), making migration between the two relatively straightforward for teams already familiar with Express idioms. Restify has historically been chosen by companies building large internal or public REST APIs — Netflix notably used it for parts of its API infrastructure — over general-purpose frameworks, precisely because it does not need to accommodate server-rendered HTML.
Key Features
- Purpose-built for JSON/REST APIs, with no bundled templating or view layer
- Native DTrace probe support for low-overhead production tracing
- Built-in request throttling and rate limiting
- Header-based API versioning (Accept-Version) for serving multiple client versions
- Structured RestError classes for consistent, machine-readable error responses
- Built-in audit logging, CORS, and gzip compression middleware
- Express-like middleware API (server.use) for familiarity