Project

rhail

0.01
No commit activity in last 3 years
No release in over 3 years
Ruby Hail is fast-by-design Rack-based nano-framework. It provides generator and helper to quickly create Rack-based web-apps. You have options to make plain html-based app with basic templates. You can chain htmls and utilize ruby string interpolation. You can generate simple json API with authentication. Or you can go with SPA (single-page app). It uses Vue.js for UI because it shares fast-by-design philosophy and very similar to AngularJS 1. In all cases you have database (sqlite by default) available out of the box.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 2.0
 Project Readme

Ruby Hail

Gem Version

About

Ruby Hail is Rack-based nano framework. It's the fastest-by-design Rack-based framework. It requires less learning (besides Rack, you suppose to know it by this time) than any other framework. It works great for simple dynamic web-sites, single-page web-apps and microservices.

Official website

Why

Watch video with the story

I was looking for balance between simplicity and development speed. If you go bellow Rack it's a lot of extra work for simple things. If you put a lot of abstractions on top of Rack then you loose track of what's going on under the hood and with high probability slowing things down.

I believe in right tool for the right job. If you look for fully-featured framework you might need Rails, something simpler - Sinatra, static site - Jekyll, blog - Wordpress. When you need simple web app or API that can do just couple of things really fast and easy - go Ruby Hail.

It was born when I was looking for web frameworks for Go and people advocated to not to use any except for the very basic ones. Otherwise you can't get the performance you're aiming for. So I took this concept to my favorite language - Ruby. I wanted to use as bare metal approach much as possible and to implement only the most necessary things so everyone can solve one task per app with high efficiency.

Use

Watch video with examples

Regular install

gem install rhail

More secure install

gem cert --add <(curl -Ls https://raw.github.com/E-Xor/rhail/master/certs/rhail-public-cert.pem)
gem install rhail -P MediumSecurity

The rest of installation process

rhail generate <plain|json|spa> path/to/folder # it will create directory with app structure
cd path/to/folder
# Install ruby via rvm if needed
gem install bundler
bundle install
bundle exec rackup # Go to http://127.0.0.1:9292 or wherever output tells you.

To run it in production treat it as any other Rack-based (Rails or Sinatra) app. For example Passenger should be ponted to <the folder>/public.

Enjoy!

Generators

Plain

Watch video with detailed explanation

rhail generate plain path/to/folder

Traditional server-side-based web-app, with example of (relatively secured) form, database and very simple html templating. You can chain htmls and utilize ruby string interpolation.

JSON

rhail generate json path/to/folder

JSON Web-API with authentication.

Play with it

curl -i -H 'Authorization: Token token="afbadb4ff8485c0adcba486b4ca90cc4"' http://127.0.0.1:9292/
curl -i -H 'Authorization: Token token="afbadb4ff8485c0adcba486b4ca90cc4"' http://127.0.0.1:9292/example_one
curl -i -H 'Authorization: Token token="afbadb4ff8485c0adcba486b4ca90cc4"' -H "Content-Type: application/json" -X POST -d '{"city":"asd","state":"asd","zipcode":"123","name":"asd"}' http://127.0.0.1:9292/example_two

SPA

rhail generate spa path/to/folder

Single-page app based on Ruby Hail with VueJS. VueJS has a lot of similarities to AngularJS 1, minus performance issues.

Custom code

Once you play with automatically generated code you will want to extend it with your real functionality.

RhailHelper.render_json(response_structure: {}, headers: {}
RhailHelper.render_html files: %w(head body foot), local_vars: {}, headers: {}

Benchmarks

In another repo