Skip to content

JuzerShakir/scheduled_tweets

Repository files navigation

Scheduled Tweets

A tweet scheduler

wakatime

❗ Objectives

This web-app accomplishes the following:

  • Able to Sign Up, Sign In and send an email to reset the password.
  • Able to connect with Multiple Twitter Accounts
  • Able to list all twitter accounts that the user has linked.
  • Able to schedule a tweet.
  • Enable backgrounds Job with Sidekiq & Redis to publish the tweet to the Twitter.
  • Show all the tweets that were created.
  • Able to edit and delete the tweets that are not yet published.
  • Able to see the tweet on twitter if the tweet has been published.

💎 Required Gems

This project was built on Ruby version 3.1.2.

Following gems were installed in these versions to execute the functionality:

Gem Names Gem Version Use
Rails 'rails' **_** Use for executing and rendering web-app
Postgresql 'pg' **_** Use postgres as the database for Active Record
BCrypt 'bcrypt' 3.1.16 Secure hash algorithm for safely storing passwords
omniauth-twitter 'omniauth-twitter' 1.4.0 Twitter API
CSRF Protection 'omniauth-rails_csrf_protection' 1.0.1 Omniauth CSRF Protection
Twitter 'twitter' 7.0.0 Authenticating web-app & user for publishing tweets
Sidekiq 'sidekiq' 6.5.1 Background Job to connect with Twitter to publish tweet

⚙️ Setting up a PostgreSQL user

If you don't have a user set on postgres, here's how to set new user:

sudo -u postgres createuser -s [username]

To set a password for this user, log in to the PostgreSQL command line client:

sudo -u postgres psql

Enter the following command to set the password:

\password your_password

Enter and confirm the password. Then exit the PostgreSQL client:

\q

📋 Execution

Run the following commands to execute locally:

The following will install required version of ruby (make sure rvm is installed.)

rvm install 3.1.2
rvm use 3.1.2
git clone git@github.com:JuzerShakir/scheduled_tweets.git
cd scheduled_tweets
gem install rails -v 6.1.6.1
bundle install

💡 Imp Note:

To successfully create development and test database, you will need to update config.database.yml file with correct postgresql username and password. To edit the it without exposing your credentials, give the following command:

EDITOR="code --wait" rails credentials:edit

code for Visual Studio Code subl for sublime

This will open credential.yml file and enter credential as follows in it:

database:
  username: your_username
  password: your_password

Hit ctrl + s to save and then close the credential.yml file from the editor. This will save the credentials. To check if it did save, run the following inside rails console:

Rails.application.credentials.dig(:database, :username)
rails db:create
rails s

To see this web-app up and running without executing above commands locally, I have deployed it on Heroku.