Skip to content

Backend with FeatherJS

Feathers is a lightweight web framework for creating realtime applications.

There are only really a couple of things about Feathers as seen in the image:

Feathers Architecture

Feathers has functions that are similar and you can run both client-side or server side. This means when you write tests, you use the same functions as you would when you use it for client-side (almost, I'll talk about that in a second). There are 2 parts about it as (I recommend reading the original documentation further):

1. Services

Services are the endpoints in FeathersJS. Unless specified in this documentation, all services supports all the HTTP methods

  • GET (find + get service methods)
  • POST (create service method)
  • PATCH (patch service method)
  • UPDATE (update service method)
  • DELETE (remove service method)

2. Hooks

Hooks are just functions that runs before, after, or on error.

Example: Authentication hooks

We know that there are a lot of services in this application that may require authentication. Hence, the idea is to be able to reuse a single function that performs authentication before certain service methods.

Developer Tools with FeathersJS

Install the feathers cli , these will help you lot in extending the backend. You can use it to generate/bootstrap the boilerplate codes when generating services, and hooks.

Feathers-Redux / The Frontend Wrapper around Redux

Feathers-redux is a wrapper around redux and feathers. The purpose of this is to map the feathers functions directly to your store.

In effect, whenever you do let say "create" call, then it updates the database, and automatically updates your frontend.

Difference of the service calls

With the original feathers call, the syntax is client.service('users').create(...), in Feathers Redux it is app.service.users.create(...).

Mongoose/MongoDB

MongoDB is a NoSQL database used for this project. Mongoose is just an ORM to add types and validation. The customised wrapper for Feathers is Feathers-Mongoose.

Custom Queries from Endpoints

The main advantage of MongoDB is the whitelists parameters eg. $populate which can be used with Feathers (see example).

At the end of the day, the database doesnt really matter as much. If you'd like to change it, you can just replace it with many of the Feathers Database Adapter.