Skip to content
An opinionated framework for scalable web 🌎
Branch: master
Clone or download
Latest commit a68a134 Mar 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
spec feat (View): `.xml` macro to render XML views Mar 17, 2019
src feat (View): `.xml` macro to render XML views Mar 17, 2019
.editorconfig initial release Oct 29, 2017
.gitignore feat: split HTTP and REST components Feb 17, 2019
LICENSE i12e (CI): build API docs for release tags only Mar 17, 2019
shard.yml bump: 0.7.1 Mar 17, 2019


Built with Crystal Travis CI build Docs API docs Latest release

An opinionated framework for scalable web.

About πŸ‘‹

Onyx::HTTP is an opinionated HTTP framework for Crystal language. It features DSL and modules to build modern, scalabale web applications with first-class support for websockets.

Installation πŸ“₯

Add these lines to your application's shard.yml:

    github: onyxframework/onyx
    version: ~> 0.3.0
    github: onyxframework/http
    version: ~> 0.7.0

This shard follows Semantic Versioning v2.0.0, so check releases and change the version accordingly. Please visit to know more about Crystal shards.

Usage πŸ’»

The simplest hello world:

require "onyx/http"

Onyx.get "/" do |env|
  env.response << "Hello, world!"


Encapsulated endpoints:

struct GetUser
  include Onyx::HTTP::Endpoint

  params do
    path do
      type id : Int32

  errors do
    type UserNotFound(404)

  def call
    user = Onyx.query(User.where(id: # This code is part of onyx/sql
    raise unless user


Onyx.get "/users/:id", GetUser

Encapsulated views:

struct UserView
  include Onyx::HTTP::View

  def initialize(@user : User)

  json id:, name:

Websocket channels:

struct Echo
  include Onyx::HTTP::Channel

  def on_message(message)
end "/", Echo

Documentation πŸ“š

The documentation is available online at

Community πŸͺ

There are multiple places to talk about Onyx:

Support ❀️

This shard is maintained by me, Vlad Faust, a passionate developer with years of programming and product experience. I love creating Open-Source and I want to be able to work full-time on Open-Source projects.

I will do my best to answer your questions in the free communication channels above, but if you want prioritized support, then please consider becoming my patron. Your issues will be labeled with your patronage status, and if you have a sponsor tier, then you and your team be able to communicate with me privately in Twist. There are other perks to consider, so please, don't hesistate to check my Patreon page:

You could also help me a lot if you leave a star to this GitHub repository and spread the word about Crystal and Onyx! πŸ“£


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'feat: some feature') using Angular style commits
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request



This software is licensed under MIT License.

Open Source Initiative

You can’t perform that action at this time.