Ruby is a popular dynamically typed language that really gained traction in the mid 2000s for developing MVC websites using the Ruby on Rails (RoR) framework. While less popular with modern APIs and Single Page Apps, you’ll still see APIs being built with Ruby in the wild.

Ruby is an easy language to get started with for web development and shares many features with Python. The RoR framework is very opinionated with batteries included which can be very useful for new entrants to web development.

Like Python, Ruby suffers from the Global Interpreter Lock (GIL) issues as famously seen with Twitter trying to scale Ruby and eventually switched to Scala. While developers can now write decent performing non-blocking code. Developers looking to build CPU bound parallel applications should probably look at some other languages.

Ruby has a very active open source community which can make documentation more difficult but provides, a much lower cost to getting started relative to some other communities like .NET.

Ruby Background

Tutorials on Creating Restful API

Most RESTful APIs are created using a framework of some sort, often it is same frameworks that are used for Web applications. The tutorials below are organized by framework.

Tutorials for Creating GraphQL APIs

Deploying Ruby APIs

Useful Libraries aka Gems, and Resources

Ruby libraries are called gems, and are managed by

  • Documentation

    • swagger-docs - Generates swagger-ui json files for Rails APIs with a simple DSL.
    • ruby-swagger - A super-duper-simple library to read or create Swagger API documents.
    • grape-swagger - Add OAPI/swagger v2.0 compliant documentation to your grape API
  • Authentication

    • brypt - a Ruby binding for the OpenBSD bcrypt() password hashing algorithm
    • ruby-jwt - A pure ruby implementation of the RFC 7519 OAuth JSON Web Token (JWT) standard.
    • OmniAuth - A library that standardizes multi-provider authentication utilizing Rack middleware.
    • devise-token-auth - Token based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth.
    • api-auth - HMAC authentication for Rails and HTTP Clients.
    • Knock - Seamless JWT authentication for Rails API.
    • A tutorial
    • Doorkeeper - An OAuth2 provider for Rails.
    • OAuth2 - A Ruby wrapper for the OAuth 2.0 protocol.
  • CORS

    • rack-cors - A middleware for Rack that supports CORS.
  • JSON

  • Utilities

    • httparty
    • faraday - Simple, but flexible HTTP client library, with support for multiple backends.
    • concurrent-ruby - Modern concurrency tools including agents, futures, promises, thread pools, actors, supervisors, and more.
  • Databases, Query Builder and ORMs

  • Testing

  • RESTful APIs

    • Blanket - An API wrapper.
    • Crepe - Lightweight API framework.
    • Grape - An opinionated micro-framework for creating REST-like APIs in Ruby.
    • Her - An ORM that maps REST resources to Ruby objects. Designed to build applications that are powered by a RESTful API instead of a database.
    • jbuilder - Create JSON structures via a Builder-style DSL.
    • jsonapi-rb – Efficient and convenient JSON API (de)serialization library.
    • JSONAPI::Resources - JSONAPI::Resources provides a framework for developing a server
    • JSONAPI::Utils - JSONAPI::Utils is built on top of JSONAPI::Resources taking advantage of its resource-driven style and bringing an easy way to build modern JSON APIs.
    • Pliny - Opinionated template Sinatra app for writing excellent APIs in Ruby.
    • rabl - General ruby templating with json, bson, xml, plist and msgpack support.
    • Rails::API - Rails for API only applications.
    • Roar - Parse and render REST API documents using representers.
    • Spyke - Interact with REST services in an ActiveRecord-like manner.
    • Version Cake - An unobtrusive way to version APIs in your Rails app.
    • versionist - A plugin for versioning Rails based RESTful APIs.
  • GraphQL

  • WebSockets

    • AnyCable - Polyglot replacement for Ruby WebSocket servers with Action Cable protocol.
    • Em-websocket - EventMachine based WebSocket server.
    • Faye-websocket-ruby - Standards-compliant WebSocket client and server.
    • Websocket-driver-ruby - WebSocket protocol handler with pluggable I/O.
    • Websocket-ruby - Universal Ruby library to handle WebSocket protocol.
    • Scorched - Light-weight web framework for Ruby.
    • Firehose - Build realtime Ruby web applications. Created by the fine folks at Poll Everywhere.
    • Slanger - Open Pusher implementation compatible with Pusher libraries.
    • render_sync - Real-time Rails Partials.
    • websocket-rails - Plug and play websocket support for ruby on rails.

Leave a Comment