Skip to content

v0.1.1

Choose a tag to compare

@github-actions github-actions released this 05 Aug 00:20
· 31 commits to main since this release

Altair v0.1.1

The first full public release: the batteries-included web framework for
Crystal, end to end — foundation, router, controllers, views, ORM, CLI and
generators — together with the documentation site and one-command
installers for every platform.

The framework

Phases 0–5 ship with passing specs.

  • Application core — a conventional Altair::Application subclass with
    typed per-environment config, singleton instance, rescue_from exception
    mapping, and a middleware pipeline (Logger + Static with path-traversal
    protection).
  • Router — compile-time DSL (get/post/put/patch/delete,
    namespace, resources, root) with typed references to controller
    actions, path helpers as real methods, 404/405 handling, and a wave of
    post-launch additions:
    • resources blocks with member / collection routes and nesting
    • singular resource :profile (six id-less routes, no-argument helpers)
    • glob segments (/files/*path) and permanent redirect "/old", to: "/new"
    • per-route constraints: { id: /\d+/ } and the implicit .{ext} format
      suffix (/posts/5.jsonparams["format"])
    • smarter pluralization (notes, courses, addresses)
  • Controllers — per-request instances, render (html/text/json),
    redirect_to, head, merged typed params (fetch/require/permit),
    send_file / stream, _method override.
  • Views — compile-time .ecr templates with typed locals (a wrong local
    is a compile error), auto-escaping by default, layouts with yield,
    partials, helpers (including block components), a form builder, and an
    optional htmx layer.
  • Smart error pages — debug-mode 404 with route suggestions, 405 with
    _method hints, and full 500 diagnostics; plain text in production.
  • Request hardening — a 2 MB body limit (configurable) answers 413
    before the body is read.

Altair::Record — the ORM

Shipped across three waves:

  • Foundation — adapter interface with SQLite3 and PostgreSQL, pooled
    connections, transactions and savepoints, migrations DSL + runner with a
    schema_migrations table and auto-regenerated db/schema.cr, on_query
    instrumentation.
  • Modelstable macro with compile-time typed attributes, CRUD,
    find_by_* finders, pluck, validations (presence, length, numericality,
    uniqueness, inclusion/exclusion, format, confirmation), automatic
    timestamps, and the eight save/create/update/destroy callbacks.
  • Associationsbelongs_to / has_many / has_one with batched
    eager loading via Relation#includes, dependent: :destroy /
    :delete_all / :nullify, plus dirty tracking with partial updates and
    JSON / decimal / bigint columns.
  • Performance and safety — lock-free connection lookup, fiber-safe
    transaction state, single-statement saves for callback-free models, and a
    configurable pool warm-up; the contract suite runs against both SQLite and
    PostgreSQL.

CLI, generators and installers

  • altair new <name> scaffolds a runnable project (src/, db/,
    public/, bin/altair + bin/altair.cmd).
  • altair g model / g migration / g controller and the full
    altair g scaffold Post title:string body:text write ready-to-edit
    files with a seeded db/schema.cr.
  • Inside a project, bin/altair server, bin/altair routes,
    bin/altair db:migrate and bin/altair db:rollback drive the app.
  • altair install copies the binary onto your PATH (~/.local/bin
    on Unix, %USERPROFILE%\.altair\bin on Windows), prints its SHA-256
    digest, is idempotent and refuses to clobber an unrelated file without
    --force.
  • Distributed installsrelease.yml (triggered by a v* tag) builds
    Linux/macOS/Windows binaries (amd64 + arm64) with SHA256SUMS, and the
    fail-safe scripts/install.sh / install.ps1 / install.cmd download,
    verify and install in one command.

Website

A documentation site at https://arab-open-source.github.io/Altair/
landing page, install, usage, features and CLI reference — generated from
markdown in website/ and deployed to GitHub Pages.

Fixes

  • shards install inside a generated project no longer fails looking for a
    prebuilt executable.
  • altair new writes a real executable bin/altair launcher, so the
    documented commands work exactly as written.
  • Running app commands through the global binary inside a project now points
    you at the launcher instead of a bare Unknown command.

Try it

curl -fsSL https://github.com/Arab-Open-Source/Altair/releases/latest/download/install.sh | sh
altair new blog
cd blog && shards install && altair server