EventEmitter and provides a clean API for building scalable applications.
Creating an Application
Create a new Feathers application using thefeathers() factory function:
Core API
app.use(path, service, options?)
Register a service at a specific path:application.ts:145-189
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 itsteardown 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 callsetup() on all registered services:
application.ts:75-93
- Service Setup
- With Hooks
app.teardown(server?)
Cleanly shut down the application and callteardown() 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
- Use
app.service()to access services - Never accessapp.servicesdirectly - Call
setup()once - Let your transport (Express, Koa) handle this automatically - Implement graceful shutdown - Always call
teardown()before exiting - Type your application - Use TypeScript generics for better developer experience
- Use
configure()for plugins - Keep configuration modular and reusable
Next Steps
Services
Learn about service methods and architecture
Hooks
Understand the powerful hooks system