Skip to main content
The Feathers Application is the central object that manages services, configuration, and the application lifecycle. It extends Node’s EventEmitter and provides a clean API for building scalable applications.

Creating an Application

Create a new Feathers application using the feathers() factory function:
The application is fully typed and supports generics for services and settings:

Core API

app.use(path, service, options?)

Register a service at a specific path:
application.ts:145-189
Service Options:
The methods option defines which service methods are exposed externally to clients. Custom methods must be explicitly listed.

app.service(path)

Retrieve a registered service by its path:
application.ts:61-73

app.unuse(path)

Remove a service and call its teardown method if available:
application.ts:191-204

Configuration

app.set(name, value) & app.get(name)

Store and retrieve application settings:
application.ts:42-49

app.configure(callback)

Run configuration functions with the application context:
application.ts:51-55

Lifecycle Methods

app.setup(server?)

Initialize the application and call setup() on all registered services:
application.ts:75-93
setup() should only be called once. Services registered after setup() is called will have their setup() method invoked immediately.

app.teardown(server?)

Cleanly shut down the application and call teardown() on all services:
application.ts:110-128

Sub-Applications

Mount entire Feathers applications as sub-apps:

Application Hooks

Register hooks that run for all services:
application.ts:206-223

Application Properties

app.services

An object containing all registered services keyed by path:
application.ts:26

app.settings

The settings object:
application.ts:27

app.version

The Feathers version string:
application.ts:29

app.mixins

Array of functions that run when services are registered:
application.ts:28

Real-World Example

Best Practices

  1. Use app.service() to access services - Never access app.services directly
  2. Call setup() once - Let your transport (Express, Koa) handle this automatically
  3. Implement graceful shutdown - Always call teardown() before exiting
  4. Type your application - Use TypeScript generics for better developer experience
  5. Use configure() for plugins - Keep configuration modular and reusable

Next Steps

Services

Learn about service methods and architecture

Hooks

Understand the powerful hooks system