Skip to main content
The @feathersjs/client package provides a complete Feathers client build that consolidates all client-side modules into a single package. It includes support for REST and WebSocket connections, authentication, and error handling.

Installation

Browser Usage

You can also use the pre-built browser bundle:

Basic Usage

REST Client with Fetch

Socket.io Client

Exported Modules

The client package re-exports all necessary modules:

Core

Authentication

object
Authentication configuration options
Storage
Storage instance for JWT token (defaults to localStorage in browser)
string
Key name for storing the JWT (defaults to ‘feathers-jwt’)
string
Name of the JWT authentication strategy (defaults to ‘jwt’)

REST Client

string
The base URL of the Feathers API server
RestClient
REST client instance with transport methods (fetch, axios, etc.)

Socket.io Client

Socket
Socket.io client instance
object
Socket.io client configuration
number
Request timeout in milliseconds

Error Handling

Available error classes:
  • BadRequest (400)
  • NotAuthenticated (401)
  • PaymentError (402)
  • Forbidden (403)
  • NotFound (404)
  • MethodNotAllowed (405)
  • NotAcceptable (406)
  • Timeout (408)
  • Conflict (409)
  • Unprocessable (422)
  • TooManyRequests (429)
  • GeneralError (500)
  • NotImplemented (501)
  • Unavailable (503)

Complete Examples

Browser Client with Authentication

Node.js Client

Real-time Events

TypeScript Support

The client package includes full TypeScript support:

Browser Bundles

The package provides several pre-built browser bundles:
  • dist/feathers.js - Full client with all features
  • dist/feathers.min.js - Minified full client
  • dist/core.js - Core only (no transport or auth)
  • dist/core.min.js - Minified core
Use in HTML:

Module Export Pattern

The package uses a special export pattern for CommonJS compatibility:
In CommonJS: