Basic Sinatra Skeleton MVC CRUD App with Sprockets, Warden, ActiveRecord and PostgresQL
Switch branches/tags
Nothing to show
Clone or download

Basic Sinatra App with Sprockets, Warden, ActiveRecord and PostgresQL

This repository aims to be a boilerplate for a modular and modern (v2) Sinatra app.

demo on heroku (admin area is locked up πŸ˜‰)

please check out the credits section! Without the community, this never would have been possible. Thank you.

Feel free to contribute, add more features, strip features or simply improve existing code - pull requests welcome πŸ˜„

Why not Rails?

Sinatra is a ruby/rack framework, that can be used as an alternative where Rails would simply be an overkill.

I started working my way through the sinatra docs, aiming for a setup that can easily be modeled to a basic use case.

What is in?

I want this Sinatra boilerplate app to:

  • work with Bundler
  • use ORM is ActiveRecord
  • have an MVC-like structure
  • support Sass/Scss and CoffeeScript
  • party with jQuery and Turbolinks! Yes, Turbolinks.
  • roll an Authentication System
  • use PostgresQL as Database
  • run on heroku (don't forget: $ heroku config:add APP_ENV=production)

Get started

You need Ruby (>= 2.4) and Bundler (of course).

Have you heard of frozen_string_literal? No? Read this

If you do not have a local PostgresQL DB running, heroku can handle the code as is - do not forget to add Heroku PostgresQL addon in your dashboard.

  • $ git clone
  • $ bundle install
  • edit config/database.yml
  • $ rake db:setup
  • $ thin start or rerun rackup (rerun gem - not included by default!)
  • edit titles in views/layout.haml and views/nav.haml
  • check/set timezone config/timezone.rb

now what?

  • read the credits
  • read the code
  • run the code, see what it does
  • delete what you don't need and built from there, should a barebone branch be offered? What do you think? 😁

Most code is commented, so you'll learn what it does.

What needs to be done

  • enable flash messages, especially for validation feedback


  • Send in pull requests, improve this project with features or simply by adding/improving comments 😁
  • Be nice, make public forks
  • What did you use this app for? Please, let me know! Share your projects.

Credits / Blood, Sweat & Tears

❀️ πŸ˜“ 😭

Contributors to this project

thank you for open sourcing, writing documentation, blogging, answering and giving a hand on stackoverflow πŸ‘


sklises repo

Steve Klise Blog post

Coderwall on Sinatra + Warden

What Ches wrote up

What Mike Ebert wrote

ActiveRecord + PostgresQL




Kieran's Answer on StackOverflow

BCrypt Gem


Sinatra Recipe for Sprockets

Official Sinatra Docs

Sinatra Intro

Sinatra recipes