Azu CLI - Command Line Interface

Feature-Complete, Production-Ready CLI for the Azu Toolkit

AZU is a toolkit for artisans with expressive, elegant syntax that offers great performance to build rich, interactive type safe, applications quickly, with less code and cohesive parts that adapts to your preferred style.

Features

Target Frameworks

The Azu CLI is specifically designed to work with two main frameworks from the Azu Toolkit ecosystem:

CQL ORM Framework

CQL (Crystal Query Language) is a comprehensive Object-Relational Mapping (ORM) library designed to simplify and enhance the management and execution of SQL queries in Crystal.

Key Features:

Repository: https://github.com/azutoolkit/cql

Azu Web Framework

Azu is a high-performance, type-safe web framework for Crystal that emphasizes developer productivity, compile-time safety, and real-time capabilities.

Key Features:

Repository: https://github.com/azutoolkit/azu

Jennifer ORM Support (Legacy)

Jennifer is an ORM (Object Relation Mapping) built for Crystal language that is supported for legacy projects.

Documentation

Installation

From Source

# Clone repository
git clone https://github.com/azutoolkit/azu_cli
cd azu_cli

# Install dependencies
shards install

# Build CLI
shards build

# Install globally (may require sudo)
sudo make install

Using Makefile

make install

The azu command will be available system-wide.

Quick Start

# Create a new project (interactive mode asks about JoobQ and other options)
azu new my-app

# Or create with specific options
azu new my-app --type web --database postgresql --joobq

# Navigate to project
cd my-app

# Setup database
azu db:create
azu db:migrate

# Generate a model
azu generate model User name:string email:string

# Generate a complete CRUD scaffold
azu generate scaffold Post title:string content:text

# Start development server with hot reloading
azu serve

# Run tests in watch mode (in another terminal)
azu test --watch

Available Commands

Project Management

Database Commands (Rails-Like)

Development Commands

Job Queue Commands (JoobQ)

Session Commands

Code Generators

Examples

Create a Blog

# Create project
azu new blog
cd blog

# Setup database
azu db:create

# Generate models
azu generate model User name:string email:string
azu generate model Post title:string content:text author_id:int64

# Generate CRUD
azu generate scaffold Post title:string content:text published:bool

# Setup authentication
azu generate auth --strategy jwt

# Migrate and seed
azu db:migrate
azu db:seed

# Start development
azu serve

Create an API

# Create API project
azu new api-service --type api
cd api-service

# Generate API scaffold
azu generate scaffold Product name:string price:float64 --api-only

# Setup background jobs
azu generate job ProcessOrder order_id:int64
azu session:setup --backend redis

# Start services
azu db:create && azu db:migrate
azu serve &
azu jobs:worker --workers 4 &

Migration System

Azu CLI uses CQL's powerful migration system with automatic schema synchronization:

# Generate a migration
azu generate migration CreateUsers name:string email:string age:int32

# Migrations use CQL Schema DSL
class CreateUsers < CQL::Migration(20240115103045_i64)
  def up
    schema.table :users do
      primary :id, Int64
      column :name, String
      column :email, String, unique: true
      timestamps
    end
    schema.users.create!
  end

  def down
    schema.users.drop!
  end
end

# Run migrations (automatically updates src/db/schema.cr)
azu db:migrate

# Rollback migrations
azu db:rollback --steps 2

Key Features:

See MIGRATION_FIXES_SUMMARY.md for detailed migration guide.

Documentation

For complete documentation, see:

Contributing

  1. Fork it (https://github.com/azutoolkit/azu_cli/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors