Kemal is a Fast, Effective, Simple web framework written in Crystal.

Hello everyone,

Kemal 0.21.0 is here :tada: This release brings long wanted features with more performance :rocket:

A long wanted feature, allows one to use HTTP::Server::Context in ws declarations :heart_eyes: This would allow accessing named url parameters and query parameters in WebSocket routes.

For example consider having a WebSocket url like

ws://myawesome.site/kemal?username=sdogruyol

Now you can access these variables from your url within your ws route :sunglasses:

ws "/:room_name" do |socket, env|
  env.params.url["room_name"] # => kemal
  env.params.query["username"] # => sdogruyol
end

Customizable Static File Headers :clap:

Another long wanted feature, which adds support for customizing the headers of built-in Kemal::StaticFileHandler :hammer: Useful for single page applications which rely on CORS.

Here’s a quick snippet for allowing CORS on .js files.

static_headers do |response, filepath, filestat|
  if filepath =~ /\.js$/
      response.headers.add("Access-Control-Allow-Origin", "*")
    end
  end
end

More Performance :rocket:

Kemal is built for being fast, we take performance seriously. In recent benchmarks we discovered that Kemal is being blazing fast :fire:

However, that’s not a reason to stop us from getting faster :fire: This release brings %10-%15 performance increase in overall execution times.

Kemal Blazing Fast


Thanks for using and supporting Kemal. You can check the full CHANGELOG here.

P.S: You can support Kemal development via Patreon :pray:

Happy Crystalling :heart: