CLI Commands

The Harpia CLI is a powerful tool designed to accelerate your development workflow. It provides commands for starting the server, running tests, generating boilerplate code, and managing your database.

You can run it using Bun. To see all available commands and options at any time, run:

bun harpia --help

Application Commands

dev

Starts the application in development mode with Hot Module Replacement (HMR).

bun harpia dev

If your application is configured as fullstack (via the MODE environment variable), this command will also automatically compile your TailwindCSS and bundle your frontend JavaScript scripts.

start

Starts the application in production mode.

bun harpia start

Development Tools

tests

Runs the test suite using Bun’s native test runner.

bun harpia tests

You can run tests sequentially or filter by module:

# Run tests sequentially
bun harpia tests --sequential

# Run tests for a specific module
bun harpia tests users

lint

Runs the Biome linter on your project files to ensure code quality and formatting. By default, it lints all modules, but you can target specific modules or files.

# Lint all modules
bun harpia lint

# Lint a specific module
bun harpia lint users

# Lint a specific file within a module (extension added automatically)
bun harpia lint users services/auth

Code Generation

The generate command provides an interactive prompt to scaffold various components of your application, ensuring consistency and saving time.

bun harpia generate

You can also pass the generator name directly:

bun harpia generate module

Available generators include:

  • module: Scaffolds a complete feature module (Controller, Service, Router).
  • controller: Creates a new HTTP controller.
  • middleware: Creates a new custom middleware.
  • validation: Generates an input validation schema.
  • factory: Creates a factory for test data generation.
  • seed: Generates a new database seeder.
  • test: Scaffolds test files for your modules.
  • observer: Creates a new event observer.
  • task: Generates a background job/task.

setup

A special generator for setting up pre-configured features like Authentication.

bun harpia generate setup

Available setups:

  • session: Configures cookie-based session authentication.
  • bearer: Configures JWT Bearer authentication.

Database Commands (Prisma)

Harpia provides convenient wrappers around Prisma CLI commands.

migrate

Generates the Prisma client and applies pending migrations to your development database.

bun harpia migrate

deploy

Applies migrations in production without creating new ones.

bun harpia deploy

seed

Runs the database seeders to populate your database with initial or dummy data.

bun harpia seed

You can optionally pass a specific seeder name:

bun harpia seed UsersSeeder

studio

Opens Prisma Studio, a visual editor for your database.

bun harpia studio

Pro Tip

You can define aliases in your package.json to make running these commands even shorter, such as "dev": "bun harpia dev".