Build Your Own Sinatra

A book about Rack, Sinatra, Rails, and all the frustrating things in-between. You will master Rack while building your own Sinatra like framework.
Start ReadingGo Pro to Access Book
cover

You should read Build Your Own Sinatra if:

  • You have ever wanted to learn how ruby frameworks work.
  • You are curious about stuff like env(), call() and use()
  • You want to build your own framework
  • You want to modify and contribute to your favorite framework
  • You ever shout "WHY?!" at anything Sinatra or Rails did

What you will build

  • 1.

    Pure Rack Apps

    module MVC
      class BaseController
        @@routes = {'GET' => []}
    
        def self.call(env)
          route = self.find_route(env)
          route.block.call(env)
        end
        # ...
      end
    end
    

    You will build rack middleware and raw rack apps right on the metal. You will build a MVC app on top of Rack without any framework. No rails, no sinatra, no router, no framework of any kind just Rack.

  • 2.

    Your own framework

    class App < YourFramework
      get '/' do
        Rack::Response.new 'Hello World!'
      end
    end
    

    You will be walked through how to build a microframework called Eldr. Eldr is a simple, flexible, and clear framework without the magic.

  • 3.

    An Ecommerce App

    post '/purchases', name: :create do
      PurchaseBook.new(package: @package,
                          user: current_user,
                         token: @stripeToken)
      .call(env)
    end
    

    Once you have built a framework you will be walked through building a real world project. We will build a site that sales an ebook. We will build stripe powered purchases, views rendering, asset helpers, session handling, responders and access control extensions; all from scratch.

What you will get

  • open book icon

    8+ Chapters and 100+ pages

    Eight chapters packed full of code samples, tests, useful insights, and penguin puns* You will tackle everything from middleware building to building a framework! * small Disclaimer: no penguin puns are included in the book -- they got too cold.

  • code icon

    Code Commits + Full Example apps

    Code examples are split up into different commits and tagged so you can follow right along. Never get stuck with broken code, just git clone and see where you went wrong!

  • github icon

    The source to the book

    A pro membership to GetGoodAt includes the source for all content. You will be given access to a private GitHub repo with the book's source. You can file issues, make pull requests, customize ebook builds etc.

  • map icon

    An Awesome Framework

    A minimal, lighweight, clear and powerful framework. A framework that does not hide the rack and comes without magic. It is called Eldr and you can fork it on GitHub

This content is for PRO members

Support me by upgrading to pro. Only $25/month and you get access to all GetGoodAt content.

Upgrade to pro to unlock!