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
Code Generation
azu generate- Generate application components
Development Tools
azu serve- Start development server with hot reloadingazu dev- Alias for serve commandazu test- Run application tests with watch mode
Background Jobs
azu jobs:worker- Start job workersazu jobs:status- Show job queue statusazu jobs:clear- Clear job queuesazu jobs:retry- Retry failed jobsazu jobs:ui- Start JoobQ web interface
Session Management
azu session:setup- Setup session managementazu session:clear- Clear all sessions
Database Management
azu db:create- Create the databaseazu db:migrate- Run database migrationsazu db:rollback- Rollback migrationsazu db:seed- Seed database with sample dataazu db:reset- Reset database (drop, create, migrate)azu db:status- Show migration statusazu db:setup- Setup database (create and migrate)azu db:drop- Drop the database
OpenAPI Integration
azu openapi:generate- Generate code from OpenAPI specificationazu openapi:export- Export OpenAPI specification from code
Plugin Management
azu plugin- Manage CLI plugins
Information & Help
azu help- Show help informationazu version- Display version information
Command Structure
All Azu CLI commands follow a consistent structure:
Examples
Global Options
These options are available for most commands:
--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>
azu new <name>Creates a new Azu project with the specified name.
Quick Examples:
azu init
azu initInitializes Azu in an existing Crystal project.
Quick Examples:
Code Generation Commands
Commands for generating application components.
azu generate <type> <name>
azu generate <type> <name>Generates various types of components for your application.
Available Generators:
endpoint- HTTP endpoints (controllers)model- Database modelsservice- Business logic servicesmiddleware- HTTP middlewarecontract- Request/response contractspage- Page components (views)component- Live interactive componentsvalidator- Custom validatorsmigration- Database migrationsscaffold- Complete CRUD resource
Quick Examples:
Development Commands
Commands for development and testing.
azu serve
azu serveStarts the development server with hot reloading.
Quick Examples:
azu dev
azu devAlias for the serve command.
Quick Examples:
azu test
azu testRuns application tests with watch mode support.
Quick Examples:
Background Jobs Commands
Commands for managing JoobQ background jobs.
azu jobs:worker
azu jobs:workerStarts background job workers.
Quick Examples:
azu jobs:status
azu jobs:statusShows job queue statistics.
Quick Examples:
azu jobs:clear
azu jobs:clearClears job queues.
Quick Examples:
azu jobs:retry
azu jobs:retryRetries failed jobs.
Quick Examples:
azu jobs:ui
azu jobs:uiLaunches JoobQ web interface.
Quick Examples:
Session Management Commands
Commands for session configuration and management.
azu session:setup
azu session:setupConfigures session management.
Quick Examples:
azu session:clear
azu session:clearClears all application sessions.
Quick Examples:
Database Commands
Commands for database management.
azu db:create
azu db:createCreates the database for the current environment.
azu db:migrate
azu db:migrateRuns pending database migrations.
azu db:rollback
azu db:rollbackRolls back the last migration or a specific number of migrations.
azu db:seed
azu db:seedSeeds the database with sample data.
azu db:reset
azu db:resetDrops, creates, and migrates the database.
azu db:setup
azu db:setupSets up the database by creating it and running migrations.
azu db:drop
azu db:dropDrops the database for the current environment.
Quick Examples:
OpenAPI Commands
Commands for OpenAPI specification integration.
azu openapi:generate
azu openapi:generateGenerates Crystal code from an OpenAPI specification.
Quick Examples:
azu openapi:export
azu openapi:exportExports an OpenAPI specification from existing code.
Quick Examples:
Plugin Management Commands
Commands for managing CLI plugins.
azu plugin
azu pluginManages Azu CLI plugins.
Quick Examples:
Information Commands
Commands for getting help and information.
azu help
azu helpShows general help or help for a specific command.
Quick Examples:
azu version
azu versionDisplays version information.
Quick Examples:
Command-Specific Options
Project Creation Options
--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
--force
Overwrite existing files
false
--skip-tests
Skip test file generation
false
--skip-routes
Skip route registration
false
Server Options
--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
--env <environment>
Target environment
development
--steps <number>
Number of migrations to rollback
1
Environment Variables
Azu CLI respects these environment variables:
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:
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:
Generators Guide - Learn about code generation
Development Workflows - Common development patterns
Configuration - Advanced configuration options
Last updated