Code Monkey home page Code Monkey logo

gratify-me's Introduction

Project: Gratify Me

A hub for keeping track of notes, quotes, and anything that is text-based.

wakatime

โ— Objectives

This web-app must accomplish the following:

  • Login users with social services (providers) such as Google, GitHub & Twitter with the help of Devise and Omniauth.
  • Make sure there's only one login created for each email regardless of which provider he/she uses.
  • If a user signs in with the same email but with a different provider, automatically sign in with the provider they logged in initially.
  • After user signs in, they can add more info about them via the Profile page.
  • Ability to add profile photos via Active Storage & Cloudinary and display photos on the page with a focus on the face.
  • Users can then add notes, quotes, etc to their feed. Show error when they try to add an empty post.
  • Show users' posts on their homepage sorted from the latest.
  • Provide users the ability to search words or expressions of the post they created through the Search Form gem.
  • Show appropriate flash messages wherever necessary.
  • Show sign-up count to logged-out users.
  • Build a responsive site using bootstrap.
  • When a user manually enters a URL that doesn't exist, redirect them to the homepage with a flash message informing them that the URL doesn't exist.

๐Ÿ’Ž Required Gems

This project was built on Ruby version 3.1.2.

Following important gems were installed in these versions:

Gem Names Gem Version Use
Rails 'rails' 6.1.7.2 Use for executing and rendering web-app
Postgresql 'pg' 1.2.3 Use postgres as the database for Active Record
Bootstrap 'bootstrap-sass' 3.4.1 For SCSS Styling
Devise 'devise' 4.8.0 Flexible authentication solution
Omniauth 'omniauth' 2.0.4 Authenticate via Social logins
Cloudinary 'cloudinary' 1.21.0 A cloud service for storing user images
Simple Form 'simple_form' 5.1.0 Search query through attributes in database
Pagy 'pagy' 5.3.1 For Pagination

โš™๏ธ 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 use 2.7.2
git clone [email protected]:JuzerShakir/gratify-me.git
cd gratify-me
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

To use Social Login services you will need to create apps for each provider you want to use to generate tokens and secret on their respective developer site.

After creating tokens and secrets for each provider, use credential.yml file to store the credentials :

provider:
  id: abcdefg
  secret: xxxxx

Replace provider with provider name such as google, twitter etc and enter your id and secret for respective providers.

The code in the config/initializers/devise.rb helps load these credentials for each provider.

To use cloudinary, make a cloudinary account. After creating, visit Dashboard page and just right to the 'Account Details' you will see Download YML, click on it and save the file in your config/ folder as cloudinary.yml file. Keep it as it is. DO NOT EDIT IT!

After setting up all this, you're ready to use this webapp.

rails s

gratify-me's People

Contributors

dependabot[bot] avatar juzershakir avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.