mrkeyoor.comAsk

fastify/fastifytested 24 Oct 2026commit ce41dc0

fastify review

Use Fastify for a Node.js API organized around JSON Schemas and scoped plugins.

  • README install 7.3 s
  • README snippet failed
63 sto install
  • 15.0 MB on disk
  • 47 dependencies
Webevaluationupdated 25 Nov 2026
+18stars / 7d

Fastify is a Node.js web framework for HTTP APIs and server routes. It supports JSON Schema validation, response serialization, hooks, decorators and scoped plugins.

Verdict

Use Fastify for a Node.js API organized around JSON Schemas and scoped plugins. Retain Express when unchanged middleware compatibility is required. Our November run combined the README reference at f5757f12298e with npm Fastify 5.12.8; the README identifies main as v6 and directs v5 users to 5.x. The unchanged example failed, and the separate October source-checkout tests exited 1 after 84 seconds.

Fastify infographic: build Node.js APIs with schemas and scoped plugins, plus our test result and who it suits
Tested 25 November 2026: the README snippet failed with "SyntaxError: Identifier". Before that: 24 Oct: source install 63 s; npm install took 7.3 s.

We ran it

Lab card: what happened when we ran fastify
Lab card from our sandbox run
Screenshot of fastify (www.fastify.dev)
www.fastify.dev
Install✓ · 63s609 packages · 195 MB
Buildn/ano build script
Tests✗ · 84sran, no count parsed
Known vulns00 critical · 0 high · 0 moderate · 0 low (npm audit)
Repo397 files~80,296 lines of source · 3 MB · 20 CI workflows · tests dir

Answers from our run

Does fastify build from source?

Dependencies installed in 63 seconds (609 packages), and the project has no separate build step. We cloned commit ce41dc0 into a clean Debian container with 3 CPUs and no project-specific setup.

Do fastify's tests pass?

No. The project's own test command exited unsuccessfully after 84 seconds, and its output did not expose an individual test count.

Does fastify have known vulnerabilities in its dependencies?

npm audit found none in the dependency tree at the time of our run.

Who should not use fastify?

Express teams whose migration requires existing middleware to work unchanged.

What are the alternatives to fastify?

Express, Hono, NestJS. Use Fastify for a Node.

Setup3/5In our 2026-11-25 run it installed as the README says in 7.3 s, but the README’s “Example” example failed as written with “SyntaxError: Identifier 'fastify' has already been declared”.Editor’s note: The source install succeeded, but tests failed and the separate unchanged quickstart stopped before serving a request. A complete setup rating needs more evidence.
Docs3/5The README has an install section (“Quick start”) and a usage section (“Example”), but its “Example” example failed as written in our 2026-11-25 run (“SyntaxError: Identifier 'fastify' has already been declared”).Editor’s note: The guides describe schemas, plugin scope and deployment choices. The quickstart combined repository documentation with npm 5.12.8 rather than a version-matched documentation test.
Community5/5Last push on 2026-11-25, 37,459 stars and maintainers answered or closed 10 of the 10 most-discussed issues we sampled.Editor’s note: Sampled issues contain contributor discussion and reported workarounds. Support response times and current maintainer capacity were not measured.
Maturity4/5Latest release v5.12.8 on 2026-11-02, repository created 2016-09-28 and its test suite did not pass in our sandbox.Editor’s note: The source checkout recorded CI workflows and tests, but its test command failed without named failing cases in the captured tail. Production reliability was not assessed.

How we score

Discussed on

  1. hnShow HN: Fastify DX, a full stack framework based on Fastify and Vite47 points
  2. hnBuild a Fast REST API with Node.js and Fastify8 points
  3. hnFastify v5 is Now Officially Released7 points
  4. hnShow HN: Fastify-zod, type-once, run everywhere (TypeScript/OpenAPI)7 points
  5. hnFastify is 7x Faster than Next.js7 points

Who it’s for

Node.js API developers who want schemas alongside their routes.
Teams organizing database connections and route modules around plugin scopes.
TypeScript users who manage framework, compiler and plugin versions together.

Who it’s NOT for

Express teams whose migration requires existing middleware to work unchanged.
Developers who expect to copy both alternative initializations in the README Example block into one file.
Teams choosing an HTTP framework primarily to obtain a React application framework or Python API stack.

Setup reality

Our October 24, 2026 source-checkout install succeeded in 63 seconds at ce41dc0, recording 609 dependencies and 195 MB on disk. The build was skipped because there was no build script or target. Tests exited 1 after 84 seconds; the captured tail ends at a failing-tests heading without identifying the failed cases. npm audit reported 0 known vulnerabilities.

Our November 25 consumer-package quickstart installed Fastify 5.12.8 in 7.3 seconds, using repository commit f5757f12298e as its README reference. The README says main refers to v6 and directs v5 users to 5.x. This run combined repository documentation with a separately installed npm package. The unchanged 23-line Example block failed with a duplicate fastify identifier.

October used 3 CPUs, 8 GB RAM and image lab-node:22; November used 2 CPUs and 4 GB RAM. The README presents ESM and CommonJS initializations together. Choose one when adapting the example, and include type: module in package.json for ESM, as the getting-started guide instructs.

Short answer: use Fastify when you want explicit API contracts

Use Fastify for Node.js APIs organized around schemas and scoped plugins; retain Express when unchanged middleware compatibility is required. Our November quickstart then stopped with SyntaxError: Identifier 'fastify' has already been declared when it ran the README example unchanged, as our recorded snippet failure shows. The adoption decision and the copy-and-paste failure answer different questions: Fastify's documented schema and plugin model is the reason to consider it, while the example requires choosing one initialization style.

A route schema describes accepted input or serialized output. A scoped plugin gives a component its own registration context, which affects where its decorators are available. Those choices suit teams willing to make dependencies explicit. For an existing Express application, MakerStack identifies direct middleware incompatibility, so migration includes adapting the middleware stack rather than replacing only the framework import. Start the decision with the routes and integrations your application already owns.

What people use Fastify for

Developers have used Fastify for JSON endpoints, Firebase Functions integration, bundled TypeScript declarations and server-rendered templates. Each example below has a named author or issue participant, so a tutorial outcome stays distinct from a user's integration report. Together, they show several ways to use the framework's routes and plugins without turning those examples into a claim about how widely Fastify is deployed.

Person and task What happened What you can take from it
Mostafa Elgreatly compared a JSON endpoint in Fastify and Express His article reports greater Fastify throughput for its endpoint A concrete benchmark design using Fastify 5.0.0 and Express 4.21.1. Elgreatly's comparison
mtermoul integrated Firebase Functions mtermoul reported success after code from nwoltman and shwei An attributed integration outcome. Issue #946
trivikr checked bundled TypeScript declarations trivikr confirmed the declarations worked without a separate @types/fastify package Use the framework's bundled declarations. Issue #649
Demian Kostelny rendered EJS templates His tutorial rendered templates with server-provided data through @fastify/view A tutorial path for HTML rendering. Kostelny's walkthrough
Ethan-Arrowood generated types from JSON Schemas The contributor reported a working local json-schema-to-typescript demo using route generics A prototype connecting schemas and request types. Issue #1668

In the Firebase discussion, nwoltman's adapter captures the request handler through serverFactory, reuses one Fastify instance and waits for fastify.ready() before dispatch. shwei reported TypeError: Cannot set property ip of [object Object] which has only a getter. nwoltman attributed it to Firebase supplying Express-extended request and response objects where Fastify expected Node's native objects. Issue #946 records both that explanation and mtermoul's success, making lifecycle and request-object compatibility separate parts of the integration.

What happened when we ran it

Our November 25 run installed Fastify 5.12.8 from npm and used commit f5757f12298e as its README reference. The run record identifies a fresh unprivileged container with 2 CPUs, 4 GB RAM, no published ports and no secrets. The README says main refers to v6 and directs v5 users to 5.x. This run combined repository documentation with a separately installed package; the package version and documentation reference are separate recorded inputs.

November quickstart step Recorded result
Clone recipe 2 seconds.
npm install fastify@latest Fastify 5.12.8 installed in 7.3 seconds.
Installed node_modules 15.0 MB on disk.
Additional packages 47 besides Fastify.
Unedited README example Exit 1 in 0.1 seconds: SyntaxError: Identifier 'fastify' has already been declared.
Teardown ok.

The unchanged 23-line JavaScript Example block failed before serving a request. The README Example contains an ESM initialization and a CommonJS initialization, each declaring const fastify. Treat those as alternatives when preparing a file. The getting-started guide also instructs ESM users to include type: module in package.json. This explains the visible duplicate declaration while preserving the recorded execution outcome: the unchanged example exited 1.

Our October 24 source-checkout run used commit ce41dc0, 3 CPUs, 8 GB RAM and image lab-node:22. We measured an installation lasting 63 seconds, with 609 dependencies and 195 MB on disk in that source-checkout run. The repository contained 397 files, approximately 80,296 source lines and a 3 MB checkout. These figures describe contributor installation, whereas November's 15.0 MB describes the consumer package's node_modules directory.

October source-checkout step Recorded result
Install Succeeded in 63 seconds, 609 dependencies, 195 MB on disk
Build No build script or target, skipped
Tests Exit 1 after 84 seconds
npm audit 0 known vulnerabilities across critical, high, moderate and low categories
Repository signals 20 CI workflow files, a tests directory, no Dockerfile detected

The October test command exited 1 after 84 seconds, with the harness marking no overall timeout. Its tail contains passing checks for stream errors, hostname and port handling, IPv6, serialization metadata, Pino stream options and requests with a body but no content type. It then ends at ✖ failing tests:. The recorded build outcome is skipped, and the audit outcome is a dated result of 0 known vulnerabilities for that dependency environment.

Where people get stuck: scope, compiler versions and request objects

A shared database connector needs the right registration order and scope. The getting-started guide registers the connector before its consuming routes and wraps it with fastify-plugin to expose its decorators and hooks to the parent. A decorator attaches a property or method to a Fastify instance, request or reply; its scope determines where that attachment can be used. The guide's MongoDB example makes that dependency visible in the application structure.

Symptom Evidence and useful response Resolution boundary
Parent route cannot see a database decorator Register the shared connector before consumers and wrap it with fastify-plugin. Official connector example Documented composition pattern
npm cannot find @types/fastify trivikr confirmed that bundled typings work without a separate package. Issue #649 Reporter-confirmed answer
TypeScript compilation breaks during an upgrade voxpelli reported that upgrading TypeScript removed the errors. Issue #4873 Participant-reported workaround
Kubernetes readiness probe cannot reach the app The recommendations explain the pod-IP versus localhost mismatch. Kubernetes listener guidance Deployment configuration
Handler tries to send twice FixDevs recommends choosing between sending and returning response data. Response troubleshooting Attributed troubleshooting advice
Firebase adapter hits an ip getter error shwei reported the error; nwoltman explained the request-object mismatch. Issue #946 Historical integration discussion

The compiler discussion concerns Fastify 4.19 and TypeScript 4.6, including @fastify/passport. In issue #4873, voxpelli says compilation stopped producing errors after upgrading TypeScript. Record the framework, compiler and authentication plugin versions together when planning an upgrade. Separately, FixDevs discusses reading a body before parsing and recommends preValidation onward; its response troubleshooting also distinguishes a handler that returns data from one that calls reply.send().

Plugin maintenance is a package-by-package decision

Issue #5116 documents a v5 preparation task covering module updates, archival and deprecation decisions. Maintainers proposed examining commit history, usage, dependencies and CI rather than carrying every module forward automatically. The closed v5 coordination issue gives a practical starting point for an application inventory: identify the plugins on the request path and record which framework major each installed version supports.

Package renaming is another maintenance task. Issue #3733 tracks the transition toward @fastify names, including separate major-version changes for renaming and framework migration. A renamed package and a compatible package answer different questions. The release workflow has its own coordination history: issue #2748 records an open automation task and discussion of OTP support. Those records describe particular maintenance work rather than a single ecosystem-wide health score.

Validation and routing choices affect request work

Fastify's production recommendations identify regular-expression routes, many route parameters and version constraints as routing costs. They favor native plugins or hooks on sensitive request paths and response schemas for JSON serialization. The recommendations connect performance to those concrete choices, so a capacity plan should include route shape and the code attached to each request rather than using the framework name as its only input.

Ajv's allErrors setting changes validation work. The recommendations advise leaving it disabled by default, enabling detailed feedback where needed and avoiding it on latency-sensitive endpoints. They also describe a reverse proxy handling concerns such as TLS termination, redirects, static files and multiple domains. Listener configuration belongs alongside that architecture: the official guide shows host 0.0.0.0 for all IPv4 interfaces, while the README warns about the exposure involved in listening on every interface.

Security features can live outside core

Issue #4917 distinguishes Fastify core from the @fastify/helmet plugin when discussing the nosniff header. Uzlopak says core does not set that header and points to the plugin that covers it. The OpenSSF badge discussion therefore gives a concrete way to review application behavior: identify whether a response feature comes from core, a registered plugin or infrastructure in front of the process.

Our October npm audit recorded 0 known vulnerabilities, and the README lists a security disclosure route and long-term-support documentation. Those are separate records with separate jobs: the audit describes the scanned dependency environment, while the README directs users toward project support and security information. For an application inventory, keep the authentication integration, HTTP-header plugin and proxy configuration beside their exact installed versions rather than treating a badge as the configuration itself.

Fastify vs Express, Hono, NestJS and FastAPI

Fastify's schema and plugin model, Hono's runtime options, Nest's application abstraction and FastAPI's Python foundation answer different selection questions. Express migration adds the middleware adaptation described by MakerStack. The comparison below separates those documented differences so a team can choose an application structure and deployment target before assigning value to framework throughput.

Comparison Choose on this basis Evidence
Fastify vs Express Favor Fastify for schemas and scoped plugins; retain Express when unchanged middleware compatibility is required. Migration tradeoff, Fastify features
Fastify vs Hono Consider Hono when deployment across JavaScript runtimes is a requirement. Hono runtime documentation
Fastify vs NestJS Choose Nest's application abstraction separately from its HTTP adapter; Nest can use Fastify. Nest introduction
Fastify vs FastAPI Choose the service language and libraries: Fastify targets Node.js, while FastAPI builds Python APIs using type hints. Fastify homepage, FastAPI introduction
Fastify vs Next.js Choose whether the task calls for an HTTP service or a React application framework. Next.js documentation

Hono documents runtime options including Cloudflare Workers, Deno, Bun and Node.js. Nest can optionally be configured to use Fastify. FastAPI builds APIs with Python based on standard Python type hints. These statements come from the Hono documentation, Nest introduction and FastAPI introduction, respectively. They give each alternative a concrete selection reason without assigning a numerical product rating or making an adoption claim.

What the other reviews get wrong

ArchitectViewMaster describes Fastify as written in TypeScript, while the official TypeScript reference identifies vanilla JavaScript. The official reference discusses maintaining declarations for TypeScript consumers separately from the implementation language. Other corrections concern entity identity, benchmark scope, validation work and startup patterns. Each row names the review being corrected rather than treating an unattributed claim as common knowledge.

Review and claim Correction
ArchitectViewMaster describes a TypeScript implementation The official reference says vanilla JavaScript. Article, TypeScript reference
FirstSales presents Fastify as an AI platform with sales pricing Its page describes fastify.ai, a different entity from fastify/fastify. FirstSales page, framework homepage
MakerStack calls Hono faster and repeats a general Express speed multiplier Fastify's illustrative comparison lists Fastify 5.12.8 at 78,696 req/s and Hono 4.13.17 at 74,163 req/s. MakerStack, versioned comparison
Elgreatly says adoption has no downside for stability or development The TypeScript compilation report and middleware adaptation are concrete adoption costs. Article, issue #4873, migration discussion
ArchitectViewMaster promises zero runtime penalty for validation Official recommendations say detailed Ajv validation can perform more work per request. Article, validation recommendations
AST Consulting says an explicit start function is required The official guide also calls listen directly with a callback. Comparison, getting-started example

Elgreatly's comparison used Fastify 5.0.0 and Express 4.21.1 and reported 9,480 versus 4,562 requests per second. Its conclusion explicitly says switching frameworks will not automatically double whole-application speed because database queries, business logic and I/O also contribute. That author's own explanation qualifies the broad Express multiplier. The README's older synthetic benchmark and the homepage's illustrative comparison also identify different framework versions and results.

FAQ

Fastify is a Node.js web framework for HTTP routes, with JSON Schema validation and response serialization described on its homepage. The questions below cover the framework's identity, npm entry point and selection against Express. They combine the recurring comparison questions into one decision rather than repeating the same Express, Hono and NestJS answer under several headings.

What is Fastify, and what is it used for?

Fastify handles HTTP routes in Node.js and supports hooks, plugins, decorators and route schemas. Its getting-started guide demonstrates a JSON response, separate route modules and MongoDB-backed animal routes, including reads and a schema-validated POST. Kostelny's template tutorial adds an HTML-rendering example through @fastify/view. These are concrete starting points for an API or server route rather than a description of the unrelated fastify.ai service.

Should I choose Fastify or Express for my API?

Choose Fastify when schemas and scoped plugins fit the API you want to build; retain Express when unchanged middleware compatibility is required. MakerStack identifies middleware adaptation as migration work, while Fastify's guide demonstrates registering a database connector before its consumers. List those dependencies before deciding how much code a migration involves. If the larger decision concerns Nest's application architecture or Hono's deployment targets, the comparison table above separates those choices from the HTTP middleware question.

How do I install Fastify through npm and find its documentation?

The documented command for adding Fastify to an existing project is npm i fastify. The README also describes npm init fastify for generating a project, followed by dependency installation and development or production commands. It identifies main as v6 and points v5 users to 5.x. Follow that release-line distinction when choosing documentation, then select one ESM or CommonJS initialization from the opening example.

What we have not tested yet

The November run stopped at the unchanged example, and October's test command exited 1 with the failed cases absent from its captured tail. A corrected quickstart, version-matched v5 example and complete October failure diagnosis remain outside these results. The November README reference and npm 5.12.8 installation are separate inputs. The lab-node:22 image labels record configuration; actual runtime and operating-system versions require toolchain logs.

Neither run measured a representative production API workload. We did not benchmark Fastify against Express, Hono, FastAPI, NestJS, Next.js, Koa or Elysia. There is no production cost study, sustained-load result, latency distribution, memory-under-traffic measurement or tested compiler/framework/plugin matrix here. The external endpoint benchmark and upstream comparisons describe their own workloads. The Firebase and TypeScript reports are historical discussions rather than current tests of their workarounds.

The badge discussion and October audit are not deployment security assessments. Current support response times, staffing and maintainer capacity were also unmeasured; the historical v4 release discussion records a contributor's capacity concern without settling today's situation. The four YouTube entries contain no usable transcripts, the research contains no Reddit or X reports, and the Bilibili evidence consists of titles. Rendered layout, accessibility, related links, recommendation modules and template behavior were outside this text review.

Alternatives

ProjectWhat it isPick it when
Express gh↗A Node.js web framework built around routing and middleware.Retain it when unchanged compatibility with your existing Express middleware is required.
Hono gh↗A web framework whose documentation lists multiple JavaScript runtimes.Consider it when Cloudflare Workers, Deno, Bun and Node.js deployment options matter.
NestJS gh↗An application framework that can use Express or Fastify underneath.Choose it when you want its application abstraction, then select its HTTP adapter separately.
FastAPI gh↗A Python API framework based on standard Python type hints.Choose it when the service belongs in Python and depends on Python libraries.

What people are saying

  1. [github-trending] fastify/fastify

Sources

  1. Fastify README
  2. Fastify getting started
  3. Fastify production recommendations
  4. Hono documentation
  5. NestJS introduction
  6. FastAPI documentation
  7. Next.js documentation
  8. Fastify TypeScript regression, issue 4873

More web reviews