Skip to main content

Create Your First App

Let’s build a real-time REST API in just a few minutes. We’ll create a messages service that automatically works via REST and WebSockets.
1

Create a new Feathers application

Use the Feathers CLI to scaffold a new application:
The CLI will ask you some questions about your project setup:
  • Choose TypeScript or JavaScript
  • Select your preferred database (we’ll use Memory for this quick start)
  • Choose Express or Koa
  • Select authentication options
For your first app, select Memory database and Express as the framework. You can always change these later.
2

Start the development server

Run the development server:
Your Feathers API is now running at http://localhost:3030!
You should see output indicating the server started successfully. The app automatically restarts when you make changes.
3

Create your first service

Let’s create a simple in-memory service manually to understand the core concepts:
app.ts
This creates a fully functional REST API with the following endpoints:
4

Test your API

Test the API with curl or any HTTP client:
The memory adapter automatically handles ID generation, validation, and pagination for you.

Understanding the Core Concepts

Services

Services are the heart of Feathers. They’re objects that implement specific methods for interacting with data:
packages/feathers/src/service.ts
You can also create a custom service:
Custom Service

The Feathers Application

The Feathers application is created using the feathers() function:
packages/feathers/src/application.ts
Key methods:
  • app.use(path, service) - Register a service
  • app.service(path) - Get a registered service
  • app.configure(callback) - Configure the application
  • app.listen(port) - Start the server

Adding Real-time with Socket.io

Add Socket.io support to enable real-time communication:
Real-time
The Socket.io configuration from the source:
packages/socketio/src/index.ts
Clients automatically receive events:
Client

Adding Hooks

Hooks are middleware for services. They run before, after, or around service methods:
Hooks Example
Hooks implementation from the source:
packages/feathers/src/hooks.ts

Using Express Middleware

Since Feathers extends Express, you can use any Express middleware:
Express Integration

Query Syntax

Feathers supports a rich query syntax for filtering data:
Query Examples

Next Steps

Complete Tutorial

Build a full chat application with authentication

Authentication

Add JWT authentication to your app

Database Adapters

Connect to MongoDB, PostgreSQL, or other databases

Deployment

Deploy your Feathers app to production
Check out the complete example on GitHub for more real-world implementations.