Skip to main content

Overview

The feathers generate command (alias: feathers g) is the main entry point for running Feathers code generators. It provides an interactive CLI for scaffolding various parts of your Feathers application.

Usage

feathers generate <generator>
Or using the shorthand:
feathers g <generator>

Available Generators

The following generators are available:

app

Generate a new Feathers application

service

Generate a new service with database adapter

hook

Generate a hook for custom logic

connection

Add a new database connection

authentication

Add authentication to your application

Examples

Generate a new application

feathers generate app
This launches an interactive prompt that guides you through creating a new Feathers application with your preferred configuration.

Generate a service

feathers generate service
Creates a new service with database integration, schema validation, and test files.

Generate with alias

feathers g hook
The g alias provides a shorter command for frequent use.

Interactive Mode

All generators run in interactive mode by default, prompting you for configuration options. You can also pass options via flags to skip prompts (see individual generator documentation).

Terminal Output Example

$ feathers generate service
? What is the name of your service? messages
? Which path should the service be registered on? messages
? Does this service require authentication? Yes
? What database is the service using? MongoDB
? Which schema definition format do you want to use? TypeBox (recommended)

Generating service...
 Created src/services/messages/messages.schema.ts
 Created src/services/messages/messages.ts
 Created src/services/messages/messages.class.ts
 Updated src/services/index.ts
 Created test/services/messages.test.ts
The CLI validates your inputs and provides helpful error messages if something goes wrong.

Common Options

While each generator has specific options, some patterns are common across generators:
  • Most generators support a --name flag to set the name non-interactively
  • Language (TypeScript/JavaScript) is inherited from your app configuration
  • All generators respect your project’s prettier and formatting settings

Next Steps

Generate an app

Learn about creating a new Feathers application

Generate a service

Add services to handle your data

Build docs developers (and LLMs) love