Feathers.js
A lightweight framework for real-time APIs and microservices
js framework for building REST and real-time APIs around a 'services' abstraction, where the same service logic automatically works over both HTTP and WebSockets, making it well suited for microservices and real-time applications.
Definition
Feathers.js is a lightweight Node.js framework for building REST and real-time APIs around a 'services' abstraction, where the same service logic automatically works over both HTTP and WebSockets, making it well suited for microservices and real-time applications.
Overview
Feathers.js was built around a simple but powerful idea: an application's core logic should be defined once as a 'service' — an object implementing standard methods like find, get, create, update, patch, and remove — and the framework should transparently expose that service over multiple transports (REST via Express or Koa integration, and real-time via Socket.io or Primus) without duplicating logic per transport. This means a client subscribing over WebSockets automatically receives real-time events (created, updated, removed) whenever the underlying service data changes, without any extra application code. Feathers is transport- and database-agnostic by design: it can sit on top of Express or Koa for HTTP handling, and it ships adapters for many databases and ORMs (Knex/SQL, Mongoose/MongoDB, Sequelize, and a generic in-memory adapter for prototyping), each exposing the same service interface. This lets developers swap the underlying persistence layer with minimal changes to application logic, and combine services backed by different databases within a single app. Cross-cutting concerns — authentication, validation, logging, permissions — are implemented as 'hooks,' functions that run before, after, or around a service method call, conceptually similar to middleware but scoped per-service and per-method rather than per-route. Feathers' official authentication module supports local, JWT, and OAuth strategies out of the box. Feathers is commonly chosen for applications needing both a conventional REST API and real-time updates from the same backend logic — collaborative tools, live dashboards, chat systems — without maintaining separate REST and WebSocket implementations.
Key Features
- Service abstraction exposing the same CRUD logic over REST and real-time transports
- Automatic real-time events (created/updated/removed) pushed to WebSocket clients
- Database-agnostic adapters for SQL (via Knex), MongoDB, Sequelize, and more
- Hooks system for cross-cutting concerns like auth, validation, and logging per service
- Works on top of Express or Koa for HTTP handling
- Built-in authentication module with local, JWT, and OAuth strategies
- CLI for scaffolding services, hooks, and authentication