Hi everyone, I’ve just released Sinator version 3.0.0.

Sinator, previously named Melodiest, is a Sinatra based web application generator. Generated application is based on my use cases.

The major differences compare with previous version are:

  • Replace Thin with Puma web server
  • Generate Puma configuration for development and production environment
  • Replace Sinatra-Asset-Pipeline with Sprockets
  • Add Rake tasks for assets:precompile and assets:clean
  • Set version for all gems listed in Gemfile

List of Ruby Gems

  • sinatra
  • sinatra-contrib
  • encrypted_cookie
  • Sinatra::Reloader in development environment only
  • puma
  • Rack::Session::EncryptedCookie
  • Rack::Csrf
  • sequel
  • sequel_pg as PostgreSQL adapter
  • sprockets
  • sass
  • uglifier
  • tux for console


gem install sinator

with Bundler, put this code in your Gemfile:

gem 'sinator'

How to Use

generate app in current directory without database

sinator -n my_app

generate app in target directory without database

sinator -n my_app -t target/dir

generate app in current directory with database. -d option will generate app with Sequel ORM and PostgreSQL adapter.

sinator -n my_app -d

Example Application

See github.com/kuntoaji/todo_sinator

Example Usage

This example assume that PostgreSQL is already running and desired database is already exist.

  1. run sinator -n my_app -d
  2. cd my_app
  3. run bundle install
  4. configure your database setting in config/database.yml
  5. create file db/migrations/001_create_artists.rb and put the following code:

    Sequel.migration do
      up do
        create_table(:artists) do
          primary_key :id
          String :name, :null=>false
      down do
  6. run rake db:migrate
  7. create file app/models/Artist.rb and put the following code:

    class Artist < Sequel::Model
  8. create file app/routes/artists.rb and put the following code:

    class MyApp
      get '/artists' do
        @artists = Artist.all
        erb :"artists/index"
      post '/artists' do
        @artist = Artist.new
        @artist.name = params[:name]
        redirect '/artists'
  9. create file app/views/artists/index.erb and put the following code:

    <h1>List of Artist</h1>
      <% @artists.each do |artist| %>
        <li><%= artist.name %></li>
      <% end %>
    <form action="/artists" method="post">
      <%= Rack::Csrf.tag(env) %>
      <input type="text" name="name" />
  10. run the server bundle exec puma
  11. open url localhost:9292/artists