Description
Grip is designed to be modular and easy to use, with the ability to scale up to the limits of the Crystal programming language. It offers extensibility and it has integrated middleware which alter the parts of the request/response context and pass it on to the actual endpoint, a filtering layer which was inherited from Kemal, an exception handling layer which represents a modified version of a Kemal exception handler and a router which somewhat resembles that of Phoenix framework's router.
grip alternatives and similar shards
Based on the "Web Frameworks" category.
Alternatively, view grip alternatives based on common mentions on social networks and blogs.
-
lucky
A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts. -
amber
A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance. -
runcobo
An api framework with type-safe params, elegant json serializer. Thanks for enjoying it! ๐ป๐ป https://runcobo.github.io/docs/ -
Shivneri
Component based MVC web framework based on fort architecture targeting good code structures, modularity & performance.
CodeRabbit: AI Code Reviews for Developers

Do you think we are missing an alternative of grip or a related project?
Popular Comparisons
README
The microframework for writing powerful web applications.
Grip is a microframework for building RESTful web applications. It is designed to be modular and easy to use, with the ability to scale up to the limits of the Crystal programming language. It offers extensibility and has integrated middleware called "pipes". Pipes can alter parts of the request/response context and then get passed to the actual endpoint. Grip's router is very similar to the router of the Phoenix framework. And most of all: Grip is fast.
Motivation
This project exists due to the fact that Kemal lacks one crucial part of a framework, a structure. An example for the absence of a structure can be found here.
Features
- HTTP 1.1 support.
- WebSocket RFC 6455 support.
- Built-in exceptions support.
- Parameter handling support.
- JSON serialization and deserialization support (fastest framework with JSON in Crystal).
- Middleware support.
- Request/Response context, inspired by expressjs.
- Advanced routing support.
Code example
Add this to your application's application.cr
:
require "grip"
class IndexController < Grip::Controllers::Http
def get(context : Context) : Context
context
.put_status(200) # Assign the status code to 200 OK.
.json({"id" => 1}) # Respond with JSON content.
.halt # Close the connection.
end
def index(context : Context) : Context
id =
context
.fetch_path_params
.["id"]
# An optional secondary argument gives a custom `Content-Type` header to the response.
context
.json(content: {"id" => id}, content_type: "application/json; charset=us-ascii")
.halt
end
def error(context : Context) : Context
if context.request.path.includes?("/api/error")
raise ArgumentError.new("An example message.")
end
context
.json({"id" => UUID.random.to_s})
.halt
end
end
class ExceptionController < Grip::Controllers::Exception
def call(context : Context) : Context
context
.json({"error" => context.exception.try(&.message)}) # The exception is nilable.
.halt
end
end
class Swigger::Swagger
include HTTP::Handler
def call(context : HTTP::Server::Context) : HTTP::Server::Context
context
.html("<h1>Hello, World!</h1>")
.halt
end
end
class PoweredByGrip
include HTTP::Handler
def call(context : HTTP::Server::Context) : HTTP::Server::Context
context.put_resp_header("Server", "grip/#{Grip::VERSION}")
context
end
end
class Authorization
include HTTP::Handler
def call(context : HTTP::Server::Context) : HTTP::Server::Context
raise Grip::Exceptions::Unauthorized.new unless context.get_req_header?("Authorization")
context
end
end
class Application < Grip::Application
def initialize(environment : String, serve_static : Bool)
# By default the environment is set to "development" and serve_static is false.
super(environment, serve_static)
exceptions [Grip::Exceptions::Unauthorized, Grip::Exceptions::NotFound], ExceptionController
exception ArgumentError, ExceptionController
pipeline :api, [PoweredByGrip.new, Authorization.new]
pipeline :docs, [PoweredByGrip.new]
scope "/api" do
get "/error", IndexController, as: :error
scope "/v1" do
pipe_through :api
get "/", IndexController
get "/:id", IndexController, as: :index
end
end
scope "/docs" do
pipe_through :docs
forward "/swagger", Swigger::Swagger
end
# Enable request/response logging.
router.insert(0, Grip::Handlers::Log.new)
end
end
app = Application.new(environment: "development", serve_static: false)
app.run
Installation
Add this to your application's shard.yml
:
dependencies:
grip:
github: grip-framework/grip
And run this command in your terminal:
shards install
API Reference
Documentation can be found on the official website of the Grip framework.
Contribute
See our contribution guidelines and read the code of conduct.