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.

Fastify

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. (https://github.com/apollographql/apollo-server/issues/4463)

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.