A curated list of awesome Ruby rack, middlewares, frameworks and web servers.
rackup tool.Rack::BuilderTesting Rack Apps
Roll your own frameworks
Videos from Railscasts
Rack::Auth::Basic is used in this
Episode.Videos from other source
Rack includes handlers for these web servers:
Mongrel parser, Event Machine network I/O
library and Rack, a minimal interface between webservers
and Ruby frameworks.These web servers include Rack handlers in their distributions:
EventMachine, Ryan Dahl’s
http-parser(https://github.com/joyent/http-parser) and
Rack::Builder.unicorn - a rackup-like command to launch the Unicorn HTTP
server (it uses Rack::Builder DSL) and unicorn_rails - a
script/server-like command to launch the Unicorn HTTP server.Miscellaneous
Rum - A gRand Unified Mapper for Rack by Christian Neukirchen. Rum apps use a small DSL to set up the mappings. (~120 LOC)
Frack-MVC - A small example implementation of how to build a simple MVC style application from scratch. Check out the commit history to see how I implemented it step-by-step. This is the example code for the slide: Ruby MVC from scratch with Rack
Hobbit -
A minimalistic microframework built on top of Rack (thanks to
Rack::Builder). Hobbit is a DSL inspired by Sinatra. (~ 150
LOC).
Hobbit::Environment, Hobbit::ErrorHandling,
Hobbit::Filter, Hobbit::Mote - render using mote,
Hobbit::Render, Hobbit::Sessionmruby-hibari - A Web
application framework for Web servers that support mruby and Rack-based API.
mruby-hibari currently supports the Web servers: ngx_mruby-enabled Nginx, mod_mruby-enabled Apache and h2o.
Cuba - Rum based microframework for web development. Integrates many templates via Tilt. Incredibly small, less than 200 lines of code.
Dolly - Minimal Ruby microframework inspired by Sinatra.
Nancy -
Minimal Ruby microframework for web development inspired in
Sinatra and Cuba (~150 LOC).
Rambutan - Ruby web microframework with Rails-ish controllers and routes.
NYNY - A (ridiculously) small and powerful web framework (~ 300 LOC). NYNY uses Journey for routing(Rail’s router). A NYNY app is a Rack middleware, it can be used inside Sinatra, Rails, or any other Rack-based app.
Eldr - A
lightweight, simple, modular and above all, clear framework without all
the magic. (~500 LOC). Eldr uses Mustermann to build its
Router.
rack-server-pages - Rack middleware and application for serving dynamic pages in very simple way. There are no controllers or models, just only views like a jsp, asp and php.
Serve - A small Rack-based web server that makes it easy to serve HTML, ERB, Haml, or a variety of template languages from any directory. Serve is meant to be a lightweight version of the Views part of the Rails MVC. Serve has full support for Rails-style partials and layouts.
RESTRack - RESTRack is a Rack-based MVC framework that makes it extremely easy to develop RESTful data services.
jellyfish -
Pico web framework for building API-centric web applications (~ 250
LOC).
junior - An MVC Web Framework.
u-web - A micro MVC framework based on Rack in a single file.
Kenji - A lightweight backend framework for Ruby.
cramp - A fully asynchronous realtime web application framework in Ruby. It is built on top of EventMachine.
Plezi - A framework for realtime, RESTful, websocket web apps. (M)VC desing, BYO models.
Brooklyn - Small web tool on top of Rack. No documentation.
Coset
- A framework specifically for implementing RESTful Rack applications by
Christian Neukirchen. Coset is introduced in the paper Introducing Rack.
Rango - An
ultralightweight, ultracustomizable, ultracool web framework inspired by
Django.
Pancake - Construct Rack stacks as mixins. Almost all key aspects of web frameworks are covered in Pancake as mixins to help you create your own re-usable Rack Stacks without worrying about the really low level plumbing.
Grape - An opinionated micro-framework for creating REST-like APIs in Ruby.
Napa - Simple
framework for building Rack based APIs using Grape, Roar and
ActiveRecord.
It’s designed to make it easy to quickly create and deploy new API
services by providing generators, middlewares and a console similar to
what you would expect from a Rails app.
Crep - A lightweight API framework designed to help you write clean, fast web services in Ruby. With an elegant and intuitive DSL inspired by RSpec, and with a nod to Grape, Crepe makes API design simple.
Praxis - A framework for both designing and implementing APIs.
Camping - A web framework which consistently stays at less than 4kB of code.
Espresso - Scalable Web Framework aimed at Speed and Simplicity.
Halcyon - A JSON Web Application Framework for developing lightweight applications interfaced via JSON-encoded HTTP requests.
Wee - A
light-weight, very high-level and modern web-framework that makes
Web engineering
easy
Mack - A Ruby web application framework. It takes the best ideas from several frameworks, including Rails, Merb, and Ramaze.
Racket - A small MVC framework built on top of rack.
Merb - A web development framework for fast, simple, and powerful development.
Hanami - (formerly Lotus) A Ruby MVC web framework comprised of many micro-libraries. It has a simple, stable API, a minimal DSL.
Ramaze - A simple, light and modular open-source web application framework written in Ruby.
Sin - A multi-app web-app DSL derived from Sinatra, riding on rack. Sin is a rebuild of sinatra, splitting up the classes into files and going for a reusable application class.
Gin - A small Ruby web framework, built on Rack, which borrows from Sinatra expressiveness, and targets larger applications.
Pakyow - An open-source framework for the modern web. Build web-based apps faster with a view-first development process that’s friendly to everyone.
Scorched - Light-weight, DRY as a desert, web framework for Ruby. Simliar to Sinatra. Scorched is a true evolutionary enhancement of Sinatra, with more power, focus, and less clutter.
Rack::App - Bare bone minimalistic (masochistic) pico framework for building rack apps. Inspired by sinatra, grape and the pure use form of Rack.
Trailblazer - A
high-level, modular architecture for Ruby framworks with domain and form
objects, view models, twin decorators.
Sinatra - Classy web-development dressed in a DSL for quickly creating web applications in Ruby with minimal effort. Sinatra is not a framework, nor a MVC, it’s a wrapper around Rack.
padrino - Padrino is a full-stack ruby framework built upon Sinatra.
Rails - Ruby on Rails, is a MVC web application framework written in Ruby.
Volt - A reactive web framework where your Ruby runs on both server and client (via Opal). A framework for building data rich web applications shockingly fast. Instead of syncing data between the client and server via HTTP, Volt uses a persistent connection between the client and server. When data is updated on one client, it is updated in the database and any other listening clients (with almost no setup code needed). Volt apps share MVC and routes between client and server. Same Ruby code runs on the client and server! (Isomorphic App Development) Volt plans to integrate RethinkDB and RubyMotion.
Where you can find middlewares
Rack::Builder - Implements a small DSL to iteratively
construct Rack applications.Rack::BodyProxy -Rack::Cascade - Tries a request on several apps, and
returns the first response that is not 404 or 405 (or in a list of
configurable status codes).Rack::Chunked - Middleware that applies chunked
transfer encoding to response bodies when the response does not include
a Content-Length header.Rack::CommonLogger - For creating Apache-style
logfiles.Rack::ConditionalGet - Middleware that enables
conditional GET using If-None-Match and If-Modified-Since. The
application should set either or both of the Last-Modified or Etag
response headers according to RFC 2616Rack::Config - modifies the environment using the block
given during initializationRack::ContentLength - Sets the Content-Length header on
responses with fixed-length bodiesRack::ContentType - Sets the Content-Type header on
responses which don’t have oneRack::ETag - Adds ETag header on all String bodies.
ETags are used to validate cache.Rack::File - serves files below the root directory
given, according to the path info of the Rack request. e.g. when
Rack::File.new(“/etc”) is used, you can access ‘passwd’ file as
http://localhost:9292/passwdRack::Deflater - enables compression of http responses,
currently supported compression algorithms: gzip, deflate, identy (no
transformation)Rack::Directory - serves entries below the root given,
according to the path info of the Rack request. If a directory is found,
the file’s contents will be presented in an html based index. If a file
is found, the env will be passed to the specified app.Rack::ForwardRequest - gets caught by
Rack::Recursive and redirects the current request to the
app at urlRack::Handler - Handlers connect web servers
with Rack. Rack includes Handlers for Thin, WEBrick, FastCGI, CGI, SCGI
and LiteSpeed. Handlers usually are activated by calling
MyHandler.run(myapp). A second optional hash can be passed
to include server-specific configuration.Rack::Head - returns an empty body for all HEAD
requests. It leaves all other requests unchanged.Rack::Lint - validates your application and the
requests and responses according to the Rack specRack::Lock - locks every request inside a mutex, so
that every request will effectively be executed synchronouslyRack::Logger - Sets up rack.logger to write to
rack.errors streamRack::MethodOverride - Override HTTP verbs. Lets you
use HTTP verbs such as PUT or DELETE in places where the client doesn’t
support it. The way this works is by letting the client do an HTTP POST
request and set the X-HTTP-Method-Override header and set the value to
the intended HTTP method (such as PATCH).Rack::Mime - Returns String with mime type if
foundRack::NullLogger -Rack::Recursive - allows applications called down the
chain to include data from other applications (by using
rack['rack.recursive.include'][...] or raise a
ForwardRequest to redirect internallyRack::Reloader - High performant source reloaderRack::Runtime - Sets an “X-Runtime” response header,
indicating the response time of the request, in secondsRack::Sendfile - The Sendfile middleware intercepts
responses whose body is being served from a file and replaces it with a
server specific X-Sendfile header. The web server is then responsible
for writing the file contents to the clientRack::Server - Rack Server starter, used by rackup to
start a rack server and use Rack::Builder to construct Rack
applications.Rack::ShowException - for catching unhandled exceptions
and presenting them in a nice and helpful way with clickable
backtrace.Rack::ShowStatus catches all empty responses and
replaces themRack::Static - intercepts requests for static files
(javascript files, images, stylesheets, etc) based on the url prefixes
or route mappings passed in the options, and serves them using a
Rack::File object. This allows a Rack stack to serve both static and
dynamic content. `Rack::TempfileReaper - Middleware tracks and cleans
Tempfiles created throughout a request (i.e. Rack::Multipart)
Ideas/strategy based on posts by Eric Wong and Charles Oliver
NutterRack::URLMap - takes a hash mapping urls or paths to
apps, and dispatches accordingly. Support for HTTP/1.1 host names exists
if the URLs start with http:// or https://.
URLMap modifies the SCRIPT_NAME and PATH_INFO
such that the part relevant for dispatch is in the
SCRIPT_NAME, and the rest in the PATH_INFO.
This should be taken care of when you need to reconstruct the URL in
order to create links.Rack::Utils - contains a grab-bag of useful methods for
writing web applications adopted from all kinds of Ruby librariesRack::Multipart - A multipart form data parser, adapted
from IOWA. Usually, Rack::Request#POST takes care of calling this.Rack::Request - which also provides query string
parsing and multipart handling.Rack::Response - for convenient generation of HTTP
replies and cookie handling.Rack::MockRequest and Rack::MockResponse-
for efficient and quick testing of Rack application without real HTTP
round-trips.Rack::Auth::Basic - implements HTTP Basic
Authentication, as per RFC 2617Rack::Auth::Digest::MD5 implements the MD5 algorithm
version of HTTP Digest Authentication, as per RFC 2617.Rack::Session::Cookie - provides simple cookie based
session management. The session is a Ruby Hash stored as base64 encoded
marshalled data set to :key (default: rack.session)Rack::Session::Pool - provides simple cookie based
session management. Session data is stored in a hash held by @poolRack::Session::Memcache - provides simple cookie based
session management. Session data is stored in memcachedRack::BodyProxy, Rack::Cascade,
Rack::File, Rack::ForwardRequest,
Rack::Handler, Rack::Mime,
Rack::Server, Rack::URLMap,
Rack::Utils, Rack::Multipart,
Rack::Request, Rack::Response,
Rack::MockRequest and Rack::MockResponse,rack-contrib - Contributed Rack Middleware and Utilities. This package includes a variety of add-on components for Rack:
Rack::AcceptFormat - Adds a format extension at the end
of the URI when there is none, corresponding to the mime-type given in
the Accept HTTP header.Rack::Access - Limits access based on IP addressRack::Backstage - Returns content of specified file if
it exists, which makes it convenient for putting up maintenance
pages.Rack::CSSHTTPRequest - Adds CSSHTTPRequest support by
encoding responses as CSS for cross-site AJAX-style data loadingRack::Callbacks - Implements DSL for pure before/after
filter like Middlewares.Rack::Config - Shared configuration for cooperative
middleware.Rack::Cookies - Adds simple cookie jar hash to envRack::Deflect - Helps protect against DoS attacks.Rack::Evil - Lets the rack application return a
response to the client from any place.Rack::HostMeta - Configures /host-meta
using a blockRack::JSONP - Adds JSON-P support by stripping out the
callback param and padding the response with the appropriate callback
format.Rack::LazyConditionalGet - Caches a global
Last-Modified date and updates it each time there is a
request that is not GET or HEAD.Rack::LighttpdScriptNameFix - Fixes how lighttpd sets
the SCRIPT_NAME and PATH_INFO variables in
certain configurations.Rack::Locale - Detects the client locale using the
Accept-Language request header and sets a rack.locale
variable in the environment.Rack::MailExceptions - Rescues exceptions raised from
the app and sends a useful email with the exception, stacktrace, and
contents of the environment.Rack::NestedParams - parses form params with subscripts
(e.g., * “post[title]=Hello”) into a nested/recursive Hash
structure (based on Rails’ implementation).Rack::NotFound - A default 404 application.Rack::PostBodyContentTypeParser - Adds support for JSON
request bodies. The Rack parameter hash is populated by deserializing
the JSON data provided in the request body when the Content-Type is
application/json.Rack::Printout - Prints the environment and the
response per requestRack::ProcTitle - Displays request information in
process title ($0) for monitoring/inspection with
ps(1).Rack::Profiler - Uses ruby-prof to measure request
time.Rack::RelativeRedirect - Transforms relative paths in
redirects to absolute URLs.Rack::ResponseCache - Caches responses to requests
without query strings to Disk or a user provider Ruby object. Similar to
Rails’ page caching.Rack::ResponseHeaders - Manipulates response headers
object at runtimeRack::Sendfile - Enables X-Sendfile
support for bodies that can be served from file.Rack::Signals - Installs signal handlers that are
safely processed after a requestRack::SimpleEndpoint - Creates simple endpoints with
routing rules, similar to Sinatra actionsRack::StaticCache - Modifies the response headers to
facilitiate client and proxy caching for static files that minimizes
http requests and improves overall load times for second time
visitors.Rack::TimeZone - Detects the client’s timezone using
JavaScript and sets a variable in Rack’s environment with the offset
from UTC.Rack::TryStatic - Tries to match request to a static
fileList of Middleware on Rack’s Wiki. Copied here (ver 2016/03/03):
Rubygems - Search the
keywords rack
or middleware
Rail’s ActionController Middleware Stack
To see what middleware your Rails app is using, open it up in command line and run:
rake middleware
You will see a big list of middleware classes that your current Rails app is using. A sample outout:
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007f93ff6810d8>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use BetterErrors::Middleware
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use ActionDispatch::Head
use Rack::ConditionalGet
use Rack::ETag
use ActionDispatch::BestStandardsSupport
use Warden::Manager
run MyApplication::Application.routesMiddlewares for Source Reloader
Rack::Reloader from Rack built-in middlewares - High
performant source reloaderrackup command that’s
shipped with Rack.ActionDispatch::Reloader from Rail’s ActionController Middleware
Stack - Provides prepare and cleanup callbacks, intended to assist
with code reloading during developmentMiddlewares for HTTP Routing
From Rack built-in middlewares:
Rack::URLMap - to route to multiple applications inside
the same process.Rack::Static - intercepts requests for static files
(javascript files, images, stylesheets, etc) based on the url prefixes
or route mappings passed in the options, and serves them using a
Rack::File object. This allows a Rack stack to serve both static and
dynamic content. `rack-no-www - This piece of simple middlweware catches requests that begin with “www” and redirects them to the equivalent “non-www” address. For example, a request to “http://www.example.org” will be redirected to “http://example.org”.
rack-routing - Map URL routes to Ruby methods
angus-router - A router for Rack applications.
rack-router - A simple router for rack apps. Requires Ruby 1.9+. (~ 200 LOC)
SimpleRouter - Small and simple standalone router, meant for use with Rack applications. Familiar Sinatra-like DSL for defining actions. Modular architecture.
Syro - Simple router for web applications inspired by Cuba. (~ 250 LOC)
Toro - Tree
Oriented Routing
http_router - This is an HTTP router for use in either a web framework, or on it’s own using Rack.
sinatra-router - A
tiny vendorable router that makes it easy to try routes from a number of
different modular Sinatra applications
sinatra-advanced-routes - Make Sinatra routes first class objects (extracted from BigBand).
Rack::Mount - A
stackable dynamic tree based Rack router.
Lotus::Router -
Rack compatible, lightweight and fast HTTP Router for Ruby and
Lotus.
Pendragon - Provides an HTTP router for use in Rack and Padrino
Journey - A router for rails. Journey is a router. It routes requests.
Usher - Pure ruby general purpose router with interfaces for rails, rack, email or choose your own adventure
Roda - Routing Tree Web Framework Toolkit
Rack Reverse Proxy - This is a simple reverse proxy for Rack that pretty heavily rips off Rack Forwarder.
Rack::Rewrite - A
rack middleware for defining and applying rewrite rules
Hanami::Router - Rack compatible, lightweight and fast HTTP Router for Ruby and Hanami.
Middlewares for Session Management
From Rack built-in middlewares:
Rack::Session::Abstract - includes
Rack::Session::Abstract::ID for implementing an id based
sessioning service and Rack::Session::Abstract::SessionHash
for lazily loading the session from store.Rack::Session::Cookie - provides simple cookie based
session management. The session is a Ruby Hash stored as base64 encoded
marshalled data set to :key (default: rack.session)Rack::Session::Pool - provides simple cookie based
session management. Session data is stored in a hash held by @poolRack::Session::Memcache - provides simple cookie based
session management. Session data is stored in memcachedFrom Rail’s ActionController Middleware Stack:
ActionDispatch::Session::CookieStore - Uses the cookie
based session store.ActionDispatch::Session::CacheStore - Uses the Rails
cache based session storeActionDispatch::Session::MemCacheStore - Uses the
memcached based session store.ActiveRecord::SessionStore - Uses the database based
session store.rack-deadline - A simple rack middleware that automatically clears sessions that have been open too long (by default, 1 day)
rack_session_access - provides rack middleware for ‘rack.session’ environment management
Moneta - Moneta provides a standard interface for interacting with various kinds of key/value stores. Moneta supports the well-known NoSQL and document based stores.
Rack::Session::Moneta - is a Rack middleware to use
Moneta for storing sessionsRack::MonetaCookies - is a Rack middleware which uses
Moneta to store cookiesActionDispatch::Session::MonetaStore - is a Rails
middleware to use Moneta for storing sessionsMiddlewares for Caching
Rack::ETag from Rack built-in middlewares - Adds
ETag header on all String bodies. ETags are used to validate
cache.
rack-cache - A quick drop-in component to enable HTTP caching for Rack-based applications that produce freshness (Expires, Cache-Control) and/or validation (Last-Modified, ETag) information
Garner - A set of
Rack middleware and cache helpers that implement various caching
strategies.
rack-cache-smash - Rack middleware to cache bust every CSS and JS asset request
Rack::Cachely - Rack Middleware for working with the CachelyApp Page Cache Service, Cachely
Faraday Http Cache - A Faraday middleware that respects HTTP cache, by checking expiration and validation of the stored responses.
Rack::Worker - Rack
middleware that implements the Worker Pattern. It processes GET requests
with a worker backend and only serves them straight from a cache. While
processing the request it serves empty HTTP 202 responses. Your web
frontend is never blocked processing the request.
Moneta - Moneta provides a standard interface for interacting with various kinds of key/value stores. Moneta supports the well-known NoSQL and document based stores.
Rack::MonetaStore - is a Rack middleware which places a
Moneta store in the environment and enables per-request cachingRack::Cache::Moneta - provides meta and entity stores
for Rack-CacheActiveSupport::Cache::MonetaStore - is a Rails cache
implementation which uses a Moneta store as backendRamaze::Cache::Moneta - is integrated into the Ramaze
project and allows Ramaze to use Moneta as caching storeMiddlewares for Authentication
Rack::Auth::Basic and Rack::Auth::Digest
from Rack built-in
middlewares - HTTP Basic Authentication and HTTP Digest
Authenticationruby-openid
libraryMiddlwares for Asset Pipeline
CoffeeScript files as
compiled javascriptMiddlewares for Debugging or Profiling
From Rack built-in middlewares:
Rack::ShowException - for catching unhandled exceptions
and presenting them in a nice and helpful way with clickable
backtrace.Rack::ShowStatus catches all empty responses and
replaces them with a site explaining the errorRack::Runtime sets an “X-Runtime” response header,
indicating the response time of the request, in secondsFrom Rail’s ActionController Middleware Stack:
ActionDispatch::ShowExceptions - Rescues any exception
returned by the application and calls an exceptions app that will wrap
it in a format for the end user.ActionDispatch::DebugExceptions - Responsible for
logging exceptions and showing a debugging page in case the request is
local.rack-webconsole - Rack-based interactive console (ana Rails console) in your web application’s frontend. That means you can interact with your application’s backend from within the browser itself!
rack-webconsole-pry
- based on rack-webconsole,
uses pry instead
of ripl, supports colors.
PryRescue::Rack - pry-rescue is an implementation of “break on unhandled exception” for Ruby. Whenever an exception is raised, but not rescued, pry-rescue will automatically open Pry for you.
rack-bug -
Rack::Bug adds a diagnostics toolbar to Rack apps. When
enabled, it injects a floating div allowing exploration of logging,
database queries, template rendering times, etc.
rack-debug -
A middleware that provides a simple interface to
ruby-debug. Helps debug apps running in Passenger
rack-insight -
Rack::Insight adds a diagnostics toolbar to Rack apps. When
enabled, it injects a floating div allowing exploration of logging,
database queries, template rendering times, etc.
Rack::Insight stores debugging info over many requests,
incuding AJAX requests. Forked from rack-bug
racksh - Console
for Rack based ruby web apps. It’s like script/console in Rails (~ 100
LOC) or merb -i in Merb, but for any app built on Rack. Thanks to
Rack::Test::Methods (from rack-test) and Ruby
REPLs (pry and irb).
rack-monitor - Rack middleware for collecting run-time information for monitoring tools like Munin
Rack::PerftoolsProfiler - Middleware for profiling Rack-compatible apps using perftools.rb
Bugsnag - The Bugsnag Notifier for Ruby gives you instant notification of exceptions thrown from your Rails, Sinatra, Rack or plain Ruby app
Better Errors - Better Errors replaces the standard Rails error page with a much better and more useful error page. It is also usable outside of Rails in any Rack app as Rack middleware.
rack-mini-profiler
- Middleware that displays speed badge for every html page. A simple but
effective mini-profiler for .NET, Ruby, Go and Node.js. Introduced in Railscasts #368 MiniProfiler
New Relic RPM Ruby
Agent - New Relic is a performance management system. It provides
you with deep information about the performance of your Rails or Ruby
application as it runs in production. When running in developer mode,
the New Relic Ruby Agent acts as a Rack middleware that maps /newrelic
to an application for showing detailed performance metrics on a page by
page basis. Installed automatically in Rails applications
Airbrake::Rack::Middleware - Airbrake Rack middleware for Rails and Sinatra applications (or any other Rack-compliant app). Any errors raised by the upstream application will be delivered to Airbrake and re-raised.
Middlewares for Protection
Cross Site Request Forgery,
Cross Site Scripting, Clickjacking,
Directory Traversal, Session Hijacking,
IP Spoofing. Note: This project has been merged upstream to
sinatra/sinatra.rack-blockActionDispatch::RemoteIp from Rail’s
ActionController Middleware Stack - Checks for IP spoofing
attacks.Middlewares for WebSocket
Middlewares for SEO
Miscellaneous Middlewares
Rack::SSL for Rails. Provides a
railtie for use with rack-sslFrom Rack built-in middlewares:
Rack::Request - which also provides query string
parsing and multipart handling.
Rack::Response - for convenient generation of HTTP
replies and cookie handling.
Rack::MockRequest and
Rack::MockResponse- for efficient and quick testing of Rack
application without real HTTP round-trips.
Rack::Builder - implements a small DSL to
iteratively construct Rack applications.
Rack::Lint - validates your application and the
requests and responses according to the Rack spec.
Rack::File - for serving static files.
Rack::Directory - serves entries below the root
given, according to the path info of the Rack request. If a directory is
found, the file’s contents will be presented in an html based index. If
a file is found, the env will be passed to the specified app.
Rack::Cascade - tries a request on several apps, and
returns the first response that is not 404 or 405 (or in a list of
configurable status codes).
Rack::Utils - contains a grab-bag of useful methods
for writing web applications adopted from all kinds of Ruby
libraries.
rackup - a useful tool for running Rack
applications, which uses the Rack::Builder DSL to configure
middleware and build up applications easily.
rackup automatically figures out the environment it is run in, and runs your application as FastCGI, CGI, or WEBrick—all from the same configuration.
rack-test - A
layer on top of Rack’s MockRequest similar to Merb’s
RequestHelper. (~ 200 LOC)
rack-test-test - an extension to rack-test that when combined with Test::Unit simplifies the process of unit testing properly designed RESTful API’s
Lookout::Rack::Test - RSpec and Cucumber test helpers.
test-unit-capybara - integration testing helper library for Rack applications, a Capybara adapter for test-unit
rack_toolkit - A dynamic Rack server and helper methods to help testing Rack apps.
Split - Rack based ab testing framework designed to work with Rails, Sinatra or any other rack based app. Split is heavily inspired by the Abingo and Vanity rails ab testing plugins and Resque in its use of Redis
Rack::Scaffold -
Automatically generate RESTful CRUD services
almost-rack - Rack in three lines of code.
rack-graph - Generate a tree displaying all your Rack middleware.
Apartment - Database multi-tenancy for Rack (and Rails) applications.
HTTP Clients
Vagrant Middlewares
Videos: Rack Middleware as a General Purpose Abstraction by Mitchell Hashimoto
Vagrant Middlewares - Vagrant calls middlewares “actions” and a stack of middlewares an “action sequence.” (But you may also just call them middleware and middleware stacks, they’re mostly called the other names for histortical purposes)
Vagrant::Action::Warden - The action warden is a
middleware which injects itself between every other middleware, watching
for exceptions which are raised and performing proper cleanup on every
action by calling the recover method. The warden therefore allows
middlewares to not worry about exceptional events, and by providing a
simple callback, can clean up in any erroneous caseVagrant::Action::Builtin::BoxAdd - This middleware will
download a remote box and add it to the given box collection.Vagrant::Action::Builtin::BoxCheckOutdated - This
middleware checks if there are outdated boxes. By default, it only
checks locally, but if box_outdated_refresh is set, it will refresh the
metadata associated with a box.Vagrant::Action::Builtin::BoxRemove - This middleware
will remove a box for a given provider.Vagrant::Action::Builtin::BoxUpdate - This middleware
updates a specific box if there are updates available.Vagrant::Action::Builtin::Call - This middleware class
allows a sort of “conditional” run within a single middlware sequence.
It takes another middleware runnable, runs it with the same environment,
then yields the resulting env to a block, allowing that block to
determine the next course of action in the middleware sequence.Vagrant::Action::Builtin::ConfigValidate - This class
validates the configuration and raises an exception if there are any
validation errors.Vagrant::Action::Builtin::Confirm - This class asks the
user to confirm some sort of question with a “Y/N” question. The only
parameter is the text to ask the user. The result is placed in
env[:result] so that it can be used with the
Call class.Vagrant::Action::Builtin::DestroyConfirm - This class
asks the user to confirm the destruction of a machine that Vagrant
manages.Vagrant::Action::Builtin::EnvSet - This middleware
class allows you to modify the environment hash in the middle of a
middleware sequence. The new environmental data will take affect at this
stage in the middleware and will persist through.Vagrant::Action::Builtin::GracefulHalt - This
middleware class will attempt to perform a graceful shutdown of the
machine using the guest implementationVagrant::Action::Builtin::HandleBox - This built-in
middleware handles the box setting by verifying the box is already
installed, dowloading the box if it isn’t, updating the box if it is
requested, etcVagrant::Action::Builtin::HandleBoxUrlVagrant::Action::Builtin::HandleForwardedPortCollisions
- This middleware class will detect and handle collisions with forwarded
ports, whether that means raising an error or repairing them
automatically.Vagrant::Action::Builtin::IsState - This middleware is
meant to be used with Call and can check if a machine is in the given
state ID.Vagrant::Action::Builtin::Lock - This class creates a
multi-process lock using flock. The lock is active for the remainder of
the middleware stack.Vagrant::Action::Builtin::Message - This middleware
simply outputs a message to the UI.Vagrant::Action::Builtin::Provision - This class will
run the configured provisioners against the machine.Vagrant::Action::Builtin::ProvisionerCleanup - This
action will run the cleanup methods on provisioners and should be used
as part of any Destroy action.Vagrant::Action::Builtin::SSHExec - This class will
exec into a full fledged SSH console into the remote machine. This
middleware assumes that the VM is running and ready for SSH, and uses
the Machine#ssh_info method to retrieve SSH information
necessary to connect.Vagrant::Action::Builtin::SSHRun - This class will run
a single command on the remote machine and will mirror the output to the
UI. The resulting exit status of the command will exist in the
:ssh_run_exit_status key in the environment.Vagrant::Action::Builtin::SetHostname - This middleware
sets the hostname of the guest according to the “vm.hostname”
configuration parameter if it is setVagrant::Action::Builtin::SyncedFolderCleanup - This
middleware will run cleanup tasks for synced folders using the
appropriate synced folder pluginVagrant::Action::Builtin::SyncedFolders - This
middleware will setup the synced folders for the machine using the
appropriate synced folder plugin.Vagrant::Action::Builtin::WaitForCommunicator - This
waits for the communicator to be ready for a set amount of time.Vagrant Middleware Stack Builder and Runner
Vagrant::Action::Builder - Action builder which
provides a nice DSL for building up a middleware sequence for Vagrant
actions. This code is based heavily off of Rack::Builder and
ActionDispatch::MiddlewareStack in Rack and Rails, respectively.Vagrant::Action::Runner - This runner does the default
expected behavior of running the middleware stacks in order, then
reversing the order.Vagrant::Action::Hook - This class manages hooks into
existing Builder stacks, and lets you add and remove middleware classes.
This is the primary method by which plugins can hook into built-in
middleware stacks.WSGI (Python) - The Web Server Gateway Interface (WSGI) is a specification for simple and universal interface between web servers and web applications or frameworks for the Python. WSGI is a Python standard described in detail in PEP 3333
Rack (Ruby) - Rack provides a modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses it unifies the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.
Plug (Elixir) - Plug is A specification for composable modules between web applications, and it’s also connection adapters for different web servers in the Erlang VM. Plug is sinatra-like, and Elixir has a Rails-like framework called Phoenix
Clack (Lisp) - Clack is a web application environment for Common Lisp inspired by Python’s WSGI and Ruby’s Rack.
Hack (Haskell) - Hack2 is a port of Ruby’s Rack webserver interface.
JSGI (JavaScript) - JavaScript Gateway Interface, is an interface between web servers and JavaScript-based web applications and frameworks. It was inspired by the Rack for Ruby and WSGI for Python and was one of the inspirations of PSGI for Perl.
PSGI (Perl) - Perl Web Server Gateway Interface is an interface between Web servers and Perl-based Web applications and frameworks that allows writing portable applications that can be run as standalone servers or using CGI, FastCGI, mod_perl, et al. It is inspired by the Web Server Gateway Interface for Python, Rack for Ruby and JSGI for JavaScript.
WSAPI (Lua) -
WSAPI is an API that abstracts the web server from Lua web applications.
By coding against WSAPI your application can run on any of the supported
servers and interfaces (currently CGI, FastCGI and Xavante, on Windows
and UNIX-based systems). WSAPI’s main influence is Ruby’s Rack
framework, but it was also influenced by Python’s WSGI
(PEP 333). It’s not a direct clone of either of them,
though, and tries to follow standard Lua idioms.
StackPHP (PHP) - a PHP interface for framework-agnostic code sharing
OWIN (.NET) - Open Web Interface for .NET, defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools. Katana is the implementation of OWIN components.
To the extent possible under law, coopermaa has waived all copyright and related or neighboring rights to this work. rack.md Github