# Setting up Sinatra Project create an empty project and add a Gemfile ```bash cd ~/Desktop mkdir project-name cd project-name touch Gemfile ``` ```ruby # Gemfile source 'https://rubygems.org' gem 'activerecord' gem 'sinatra-activerecord' gem 'sqlite3' gem 'rake' ``` Install the dependencies ```bash bundle install ``` Create an app.rb file ```ruby # app.rb require 'sinatra' require 'sinatra/activerecord' set :database, "sqlite3:project-name.sqlite3" ``` Create a Rakefile ```ruby # Rakefile require 'sinatra/activerecord/rake' require './app' ``` Create a migration for creating a users table ```bash rake db:create_migration NAME=create_users_table ``` Add code to the migration for creating columns ```ruby class CreateUsersTable < ActiveRecord::Migration[5.0] def change create_table :users do |t| t.string :fname t.string :lname t.string :email t.datetime :created_at t.datetime :updated_at end end end ``` Run the migration ```bash rake db:migrate ``` Create a User model ```ruby # models.rb class User < ActiveRecord::Base end ``` Load the User model into your app ```ruby # at the bottom of app.rb require './models' ``` Create some users with IRB ```ruby irb require './app' # Load app into IRB session User.connection User User.create(fname: 'Jane', lname: 'Doe', email: 'jane@example.com', created_at: Time.now(), updated_at: Time.now()) ``` Create an index.erb file in a views directory (views/index.erb) ```erb