ForrestJS & Fastify Examples

Learn by examples how easy is to build a Fastify based Web Service with ForrestJS and its feature composability.

ForrestJS & Fastify Examples

Lately, I fell in love with Fastify because it offers a straightforward way to compose a web application through plugins encouraging functional composition at the feature level.

ForrestJS takes this concept to the next level by offering an interface that services and features can use to interoperate without being tightly coupled. It also pushes hard for the Single Responsibility Principle and Open Closed Principle.

Today Iā€™d like to share with you a few running examples of the services that you can use to compose your web app.


Runs a Fastify instance within your ForrestJS App

Fastify Static

Wrapper around fastify-static plugin.

Fastify Healthz

Provides a health check route that you can configure via simple hooks.

Fastify JWT

Wrapper around fastify-jwt plugin.

Wrapper around fastify-cookie plugin.

Fastify GQL

Sets up an Apollo Graphql Server in the ForrestJS app and provides hooks to extend the schema from a feature.

NOTE: At the time of writing an issue prevents the apollo-server-fastify plugin from rendering the playground. (

Fastify Apollo

Sets up an Apollo Client in the ForrestJS app and makes it available to route handlers.

Fastify Fetchq

Sets up a Fetchq Client in the ForrestJS app and makes it available to route handlers.