kemal v1.9.0

Fast, Effective, Simple Web Framework

Kemal

Kemal

Kemal is the Fast, Effective, Simple Web Framework for Crystal. It's perfect for building Web Applications and APIs with minimal code.

CI

Why Kemal?

  • πŸš€ Lightning Fast: Built on Crystal, known for C-like performance
  • πŸ’‘ Super Simple: Minimal code needed to get started
  • πŸ›  Feature Rich: Everything you need for modern web development
  • πŸ”§ Flexible: Easy to extend with middleware support

Quick Start

  1. First, make sure you have Crystal installed.

  2. Create a new Crystal application and step into it:

crystal init app my-kemal-app
cd my-kemal-app
  1. Add Kemal to your app's shard.yml:
dependencies:
  kemal:
    github: kemalcr/kemal
  1. Replace the contents of src/my_kemal_app.cr with your first Kemal app:
require "kemal"

# Basic route - responds to GET "http://localhost:3000/"
get "/" do
  "Hello World!"
end

# JSON API example
get "/api/status" do |env|
  env.response.content_type = "application/json"
  {"status": "ok"}.to_json
end

# WebSocket support
ws "/chat" do |socket|
  socket.send "Hello from Kemal WebSocket!"
end

Kemal.run
  1. Install dependencies and run your application:
shards install
crystal run src/my_kemal_app.cr
  1. Visit http://localhost:3000 - That's it! πŸŽ‰

Key Features

  • πŸš€ High-performance by default: Built on Crystal with a thin abstraction layer so you can serve a large number of requests with low latency and low memory footprint.
  • 🌐 Full REST & HTTP support: Handle all HTTP verbs (GET, POST, PUT, PATCH, DELETE, etc.) with a straightforward routing DSL.
  • πŸ”Œ WebSocket & real-time: First-class WebSocket support for building chats, dashboards and other real-time experiences.
  • πŸ“¦ JSON-first APIs: Native JSON handling makes building JSON APIs and microservices feel natural.
  • πŸ—„οΈ Static assets made easy: Serve static files (assets, uploads, SPA bundles) efficiently from the same application.
  • πŸ“ Template engine included: Built-in ECR template engine for server‑rendered HTML when you need it.
  • πŸ”’ Composable middleware: Flexible middleware system to add logging, auth, rate limiting, metrics and more.
  • 🎯 Ergonomic request/response API: Simple access to params, headers, cookies and bodies via a clear context object.
  • πŸͺ Session management: Easy session handling with kemal-session, suitable for production apps.

Philosophy

Kemal aims to be a simple, fast and reliable foundation for building production-grade web applications and APIs in Crystal.

  • Simple core, powerful building blocks: The core is intentionally simple and easy to reason about. Most power comes from Crystal itself and from middleware, not from hidden magic.
  • Performance as a baseline, not a feature: Crystal's native speed means high performance is the default. Kemal keeps abstractions thin so you stay close to the metal when you need to.
  • Minimal assumptions, maximum flexibility: Kemal does not force a specific ORM, template engine, or project layout. You are free to choose the tools that fit your application and your team.
  • Batteries within reason: Kemal ships with the essentials (routing, middleware, templates, static files, request/response helpers) while keeping advanced concerns in separate shards you can opt into as your app grows.

Kemal is designed to feel familiar if you come from popular web frameworks, while embracing Crystal's strengths and keeping your application code straightforward, maintainable, and ready for production.

Learning Resources

Contributing

We love contributions! Please read our Contributing Guide to get started.

Acknowledgments

Special thanks to Manas for their work on Frank.

License

Kemal is released under the MIT License.

Repository

kemal

Owner
Statistic
  • 3824
  • 191
  • 5
  • 741
  • 3
  • about 2 hours ago
  • October 23, 2015
License

MIT License

Links
Synced at

Tue, 03 Feb 2026 11:17:41 GMT

Languages