diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 000000000..b0224045b
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,4 @@
+# List the ports you want to expose and what to do when they are served. See https://www.gitpod.io/docs/config-ports/
+ports:
+ - port: 3000
+ onOpen: open-browser
\ No newline at end of file
diff --git a/.theia/launch.json b/.theia/launch.json
new file mode 100644
index 000000000..a2ea02c46
--- /dev/null
+++ b/.theia/launch.json
@@ -0,0 +1,6 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ "version": "0.2.0",
+ "configurations": []
+}
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 000000000..fb56b47f0
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,93 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ activemodel (4.2.11.3)
+ activesupport (= 4.2.11.3)
+ builder (~> 3.1)
+ activerecord (4.2.11.3)
+ activemodel (= 4.2.11.3)
+ activesupport (= 4.2.11.3)
+ arel (~> 6.0)
+ activesupport (4.2.11.3)
+ i18n (~> 0.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
+ arel (6.0.4)
+ bond (0.5.1)
+ builder (3.2.4)
+ coderay (1.1.3)
+ concurrent-ruby (1.1.7)
+ i18n (0.9.5)
+ concurrent-ruby (~> 1.0)
+ method_source (1.0.0)
+ minitest (5.14.2)
+ multi_json (1.15.0)
+ mustermann (1.1.1)
+ ruby2_keywords (~> 0.0.1)
+ nio4r (2.5.4)
+ pry (0.13.1)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ puma (5.0.4)
+ nio4r (~> 2.0)
+ rack (2.2.3)
+ rack-protection (2.1.0)
+ rack
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rake (13.0.1)
+ ripl (0.7.1)
+ bond (~> 0.5.1)
+ ripl-multi_line (0.3.1)
+ ripl (>= 0.3.6)
+ ripl-rack (0.2.1)
+ rack (>= 1.0)
+ rack-test (~> 0.6.2)
+ ripl (>= 0.7.0)
+ ruby2_keywords (0.0.2)
+ shotgun (0.9.2)
+ rack (>= 1.0)
+ sinatra (2.1.0)
+ mustermann (~> 1.0)
+ rack (~> 2.2)
+ rack-protection (= 2.1.0)
+ tilt (~> 2.0)
+ sinatra-activerecord (2.0.21)
+ activerecord (>= 4.1)
+ sinatra (>= 1.0)
+ sinatra-contrib (2.1.0)
+ multi_json
+ mustermann (~> 1.0)
+ rack-protection (= 2.1.0)
+ sinatra (= 2.1.0)
+ tilt (~> 2.0)
+ sqlite3 (1.3.13)
+ thread_safe (0.3.6)
+ tilt (2.0.10)
+ tux (0.3.0)
+ ripl (>= 0.3.5)
+ ripl-multi_line (>= 0.2.4)
+ ripl-rack (>= 0.2.0)
+ sinatra (>= 1.2.1)
+ tzinfo (1.2.8)
+ thread_safe (~> 0.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord (~> 4.2.0)
+ activesupport
+ pry
+ puma
+ rake
+ shotgun
+ sinatra
+ sinatra-activerecord
+ sinatra-contrib
+ sqlite3 (~> 1.3.6)
+ tux
+
+BUNDLED WITH
+ 2.1.4
diff --git a/README.md b/README.md
index 2577b6932..d1371d6d9 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/lighthouse-labs/finstagram)
+
# finstagram
diff --git a/app/actions.rb b/app/actions.rb
index e69de29bb..e631cfc24 100755
--- a/app/actions.rb
+++ b/app/actions.rb
@@ -0,0 +1,136 @@
+helpers do
+ def current_user
+ User.find_by(id: session[:user_id])
+ end
+end
+
+
+get '/' do
+ @finstagram_posts = FinstagramPost.order(created_at: :desc)
+ erb(:index)
+end
+
+
+get '/signup' do
+ @user = User.new
+ erb(:signup)
+end
+
+
+post '/signup' do
+ email = params[:email]
+ avatar_url = params[:avatar_url]
+ username = params[:username]
+ password = params[:password]
+
+ @user = User.new({ email: email, avatar_url: avatar_url, username: username, password: password })
+
+ if @user.save
+ "User #{username} saved!"
+ else
+ erb(:signup)
+ end
+end
+
+
+get '/login' do # when a GET request comes into /login
+ erb(:login) # render app/views/login.erb
+end
+
+
+post '/login' do
+ username = params[:username]
+ password = params[:password]
+
+ user = User.find_by(username: username)
+
+ if user && user.password == password
+ session[:user_id] = user.id
+ redirect to('/')
+ else
+ @error_message = "Login failed."
+ erb(:login)
+ end
+end
+
+
+post '/signup' do
+ email = params[:email]
+ avatar_url = params[:avatar_url]
+ username = params[:username]
+ password = params[:password]
+
+ @user = User.new({ email: email, avatar_url: avatar_url, username: username, password: password })
+
+ if @user.save
+ redirect to('/login')
+ else
+ erb(:signup)
+ end
+end
+
+
+get '/logout' do
+ session[:user_id] = nil
+ redirect to('/')
+end
+
+
+get '/finstagram_posts/new' do
+ @finstagram_post = FinstagramPost.new
+ erb(:"finstagram_posts/new")
+end
+
+
+post '/finstagram_posts' do
+ photo_url = params[:photo_url]
+
+ @finstagram_post = FinstagramPost.new({ photo_url: photo_url, user_id: current_user.id })
+
+ if @finstagram_post.save
+ redirect(to('/'))
+ else
+ erb(:"finstagram_posts/new")
+ end
+end
+
+
+get '/finstagram_posts/:id' do
+ @finstagram_post = FinstagramPost.find(params[:id]) # find the finstagram post with the ID from the URL
+ erb(:"finstagram_posts/show") # render app/views/finstagram_posts/show.erb
+end
+
+
+
+post '/comments' do
+ # point values from params to variables
+ text = params[:text]
+ finstagram_post_id = params[:finstagram_post_id]
+
+ # instantiate a comment with those values & assign the comment to the `current_user`
+ comment = Comment.new({ text: text, finstagram_post_id: finstagram_post_id, user_id: current_user.id })
+
+ # save the comment
+ comment.save
+
+ # `redirect` back to wherever we came from
+ redirect(back)
+end
+
+
+post '/likes' do
+ finstagram_post_id = params[:finstagram_post_id]
+
+ like = Like.new({ finstagram_post_id: finstagram_post_id, user_id: current_user.id })
+ like.save
+
+ redirect(back)
+end
+
+delete '/likes/:id' do
+ like = Like.find(params[:id])
+ like.destroy
+ redirect(back)
+end
+
+
diff --git a/app/models/comment.rb b/app/models/comment.rb
new file mode 100644
index 000000000..ddbd0478e
--- /dev/null
+++ b/app/models/comment.rb
@@ -0,0 +1,10 @@
+class Comment < ActiveRecord::Base
+
+ # Associations from a previous exercise
+ belongs_to :user
+ belongs_to :finstagram_post
+
+ # New validation code
+ validates_presence_of :text, :user, :finstagram_post
+
+end
\ No newline at end of file
diff --git a/app/models/finstagram_post.rb b/app/models/finstagram_post.rb
new file mode 100644
index 000000000..d586044b6
--- /dev/null
+++ b/app/models/finstagram_post.rb
@@ -0,0 +1,26 @@
+class FinstagramPost < ActiveRecord::Base
+ # (this is where your associations are, e.g. has_many :finstagram_posts, etc.)...
+ belongs_to :user
+ has_many :comments
+ has_many :likes
+ # validations in between association definitions and methods!
+ validates :photo_url, :user, presence: true
+ # (this is where your def humanized_time_ago method is, along with the rest of your methods in this file)...
+ def humanized_time_ago
+ time_ago_in_seconds = Time.now - self.created_at
+ time_ago_in_minutes = time_ago_in_seconds / 60
+ if time_ago_in_minutes >= 60
+ "#{(time_ago_in_minutes / 60).to_i} hours ago"
+ else
+ "#{time_ago_in_minutes.to_i} minutes ago"
+ end
+ end
+ # New Stuff Start
+ def like_count
+ self.likes.size
+ end
+ def comment_count
+ self.comments.size
+ end
+ # New Stuff End
+end
\ No newline at end of file
diff --git a/app/models/like.rb b/app/models/like.rb
new file mode 100644
index 000000000..b4a8fb81f
--- /dev/null
+++ b/app/models/like.rb
@@ -0,0 +1,12 @@
+class Like < ActiveRecord::Base
+
+ belongs_to :user
+ belongs_to :finstagram_post
+
+ # ...
+
+ validates_presence_of :user, :finstagram_post
+
+
+
+end
\ No newline at end of file
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 000000000..61ab65902
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,15 @@
+class User < ActiveRecord::Base
+
+ # ... The rest of your code is still here ...
+
+ # --- Add these lines ---
+ validates :email, :username, uniqueness: true
+ validates :email, :avatar_url, :username, :password, presence: true
+
+has_many :finstagram_posts
+has_many :comments
+has_many :likes
+
+ # -----------------------
+
+end
\ No newline at end of file
diff --git a/app/views/finstagram_post.erb b/app/views/finstagram_post.erb
new file mode 100644
index 000000000..4c5917654
--- /dev/null
+++ b/app/views/finstagram_post.erb
@@ -0,0 +1,27 @@
+
+ <%= comment.user.username %>: <%= comment.text %> +
+
+ <%= comment.user.username %>: <%= comment.text %> +
+