Command Overview

Azu CLI provides a comprehensive set of commands to help you develop, manage, and deploy your Azu applications. This reference covers all available commands, their options, and usage examples.

Command Overview

Project Management

  • azu new - Create a new Azu project

  • azu init - Initialize Azu in an existing project

Code Generation

Development Tools

  • azu serve - Start development server with hot reloading

  • azu dev - Alias for serve command

  • azu test - Run application tests with watch mode

Background Jobs

Session Management

Database Management

OpenAPI Integration

Plugin Management

Information & Help

Command Structure

All Azu CLI commands follow a consistent structure:

Examples

Global Options

These options are available for most commands:

Option
Short
Description

--help

-h

Show help for the command

--version

-v

Show version information

--debug

-d

Enable debug mode with verbose output

--verbose

Enable verbose output

--quiet

-q

Suppress non-error output

--config FILE

Use custom configuration file

Examples

Command Categories

Project Management Commands

Commands for creating and initializing Azu projects.

azu new <name>

Creates a new Azu project with the specified name.

Quick Examples:

azu init

Initializes Azu in an existing Crystal project.

Quick Examples:

Code Generation Commands

Commands for generating application components.

azu generate <type> <name>

Generates various types of components for your application.

Available Generators:

  • endpoint - HTTP endpoints (controllers)

  • model - Database models

  • service - Business logic services

  • middleware - HTTP middleware

  • contract - Request/response contracts

  • page - Page components (views)

  • component - Live interactive components

  • validator - Custom validators

  • migration - Database migrations

  • scaffold - Complete CRUD resource

Quick Examples:

Development Commands

Commands for development and testing.

azu serve

Starts the development server with hot reloading.

Quick Examples:

azu dev

Alias for the serve command.

Quick Examples:

azu test

Runs application tests with watch mode support.

Quick Examples:

Background Jobs Commands

Commands for managing JoobQ background jobs.

azu jobs:worker

Starts background job workers.

Quick Examples:

azu jobs:status

Shows job queue statistics.

Quick Examples:

azu jobs:clear

Clears job queues.

Quick Examples:

azu jobs:retry

Retries failed jobs.

Quick Examples:

azu jobs:ui

Launches JoobQ web interface.

Quick Examples:

Session Management Commands

Commands for session configuration and management.

azu session:setup

Configures session management.

Quick Examples:

azu session:clear

Clears all application sessions.

Quick Examples:

Database Commands

Commands for database management.

azu db:create

Creates the database for the current environment.

azu db:migrate

Runs pending database migrations.

azu db:rollback

Rolls back the last migration or a specific number of migrations.

azu db:seed

Seeds the database with sample data.

azu db:reset

Drops, creates, and migrates the database.

azu db:setup

Sets up the database by creating it and running migrations.

azu db:drop

Drops the database for the current environment.

Quick Examples:

OpenAPI Commands

Commands for OpenAPI specification integration.

azu openapi:generate

Generates Crystal code from an OpenAPI specification.

Quick Examples:

azu openapi:export

Exports an OpenAPI specification from existing code.

Quick Examples:

Plugin Management Commands

Commands for managing CLI plugins.

azu plugin

Manages Azu CLI plugins.

Quick Examples:

Information Commands

Commands for getting help and information.

azu help

Shows general help or help for a specific command.

Quick Examples:

azu version

Displays version information.

Quick Examples:

Command-Specific Options

Project Creation Options

Option
Description
Default

--database <db>

Database type (postgres, mysql, sqlite)

postgres

--type <type>

Project type (web, api, cli)

web

--template <name>

Use specific template

default

--skip-git

Skip Git repository initialization

false

--skip-deps

Skip dependency installation

false

Generation Options

Option
Description
Default

--force

Overwrite existing files

false

--skip-tests

Skip test file generation

false

--skip-routes

Skip route registration

false

Server Options

Option
Description
Default

--port <port>

Server port

4000

--host <host>

Server host

localhost

--env <environment>

Environment name

development

--ssl

Enable SSL

false

--ssl-cert <path>

SSL certificate path

--ssl-key <path>

SSL private key path

Database Options

Option
Description
Default

--env <environment>

Target environment

development

--steps <number>

Number of migrations to rollback

1

Environment Variables

Azu CLI respects these environment variables:

Variable
Description
Default

AZU_ENV

Current environment

development

AZU_DATABASE_URL

Database connection URL

AZU_PORT

Default server port

4000

AZU_HOST

Default server host

localhost

AZU_CONFIG

Configuration file path

azu.yml

AZU_DEBUG

Enable debug mode

false

Configuration File

You can create a configuration file (azu.yml) to set default options:

Exit Codes

Azu CLI uses standard exit codes:

Code
Meaning

0

Success

1

General error

2

Invalid usage/arguments

3

File/directory not found

4

Permission denied

5

Database connection error

Shell Completion

Enable shell completion for faster command usage:

Bash

Zsh

Fish

Common Workflows

Creating a New Application

Daily Development

Database Management

Getting Help

For detailed help on any command:

For more detailed information about each command, see the individual command documentation pages.


Next Steps:

Last updated