arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Overview

Azu is a high-performance web framework for Crystal emphasizing type safety, modularity, and real-time capabilities.

hashtag
Quick Example

hashtag
Architecture

Endpoints are type-safe handlers with:

  • Request Contract: Validates and types incoming data

  • Response Object: Handles content rendering

  • Middleware: Cross-cutting concerns (auth, logging, etc.)

hashtag
Core Features

Feature
Description

hashtag
Documentation

New to Azu?
Need to do something?
Looking for API?
Want to understand?

hashtag
Tutorials

Step-by-step lessons to learn Azu:

  • - Install and create your first app

  • - Complete CRUD API tutorial

  • - Real-time features

hashtag
How-To Guides

Task-oriented guides for specific goals:

  • - Create endpoints, handle parameters, return formats

  • - Validate requests and models

  • - WebSocket channels and live components

hashtag
Reference

Technical specifications and API documentation:

  • - Endpoint, Request, Response, Channel, Component

  • - Built-in middleware handlers

  • - All configuration options

hashtag
Explanation

Conceptual understanding of Azu:

  • - How Azu works

  • - Request flow

  • - Compile-time guarantees

hashtag
Resources

  • - Common questions and troubleshooting

  • - Development setup and guidelines

require "azu"

module MyApp
  include Azu

  configure do
    port = 3000
  end
end

struct HelloRequest
  include Azu::Request
  getter name : String = "World"
end

struct HelloResponse
  include Azu::Response
  def initialize(@name : String); end
  def render
    "Hello, #{@name}!"
  end
end

struct HelloEndpoint
  include Azu::Endpoint(HelloRequest, HelloResponse)
  get "/"
  def call : HelloResponse
    HelloResponse.new(hello_request.name)
  end
end

MyApp.start [
  Azu::Handler::Logger.new,
  Azu::Handler::Rescuer.new
]
HTTP Request → Router → Middleware Chain → Endpoint → Response
                                              ↓
                                    Request Contract (validation)
- CQL integration
  • - Write comprehensive tests

  • - Production deployment

  • - Schema, models, queries, transactions
  • - Memory and Redis caching

  • - Custom handlers and logging

  • - Production, Docker, scaling

  • - Optimize endpoints and queries

  • - CQL API, validations, query methods
  • - HTTP error classes

  • - Why Azu is built this way

    Type-Safe Contracts

    Compile-time validation via Azu::Request

    Radix Routing

    O(log n) lookup with path caching

    WebSocket Channels

    Real-time bidirectional communication

    Live Components

    Server-rendered with client sync (Spark)

    Multi-Store Cache

    Memory and Redis with auto-metrics

    Middleware Stack

    CORS, CSRF, Rate Limiting, Logging

    Getting Started
    Building a User API
    Adding WebSockets
    Endpointsarrow-up-right
    Validationarrow-up-right
    Real-Timearrow-up-right
    Core APIarrow-up-right
    Handlers
    Configuration
    Architecture
    Request Lifecycle
    Type Safety
    FAQ
    Contributing
    Working with Databases
    Testing Your App
    Deploying to Production
    Databasearrow-up-right
    Cachingarrow-up-right
    Middlewarearrow-up-right
    Deploymentarrow-up-right
    Performancearrow-up-right
    Databasearrow-up-right
    Error Types
    Design Decisionsarrow-up-right
    Tutorialsarrow-up-right
    How-To Guidesarrow-up-right
    Referencearrow-up-right
    Explanationarrow-up-right