Skip to content

Latest commit

 

History

History
169 lines (119 loc) · 3.52 KB

README.md

File metadata and controls

169 lines (119 loc) · 3.52 KB

Habitual | Habit Progress Tracker

An app to track and organize your habit goals daily.

Features

  • Authentication and authorization features that allows users to sing in or create an account.
  • Create a list of habit goals with personalized color configuration and interactive progress bar.

Tech Stack

  • JavaScript
  • React
  • Ruby
  • Rails

Getting Started

Requirements

  • Ruby 2.7.4
  • NodeJS (v16), and npm
  • Postgresql

See Environment Setup below for instructions on installing these tools if you don't already have them.

Install Dependencies

# This installs all gems to the system that are listed in Gemfile as well as their dependencies.
bundle install

# This installs all modules that are listed on the package.json file and their dependencies.
npm install --prefix client

Local Servers Setup

You can use the following commands to run the application:

In one terminal, run:

# run the backend on http://localhost:3000
`rails s`

In another one, run:

# run the frontend on http://localhost:4000
npm start --prefix client

Environment Setup

If needed, here's some instruction on how to get the required technologies for this project.

Install Ruby Version 2.7.4

Verify which version of Ruby you're running by entering this in the terminal:

$ ruby -v

If you need to upgrade you can install it using rvm:

$ rvm install 2.7.4 --default

You should also install the latest versions of bundler and rails:

$ gem install bundler
$ gem install rails

Install NodeJS

Verify you are running a recent version of Node with:

node -v

If your Node version is not 16.x.x, install it and set it as the current and default version with:

nvm install 16
nvm use 16
nvm alias default 16

You can also update your npm version with:

npm i -g npm

Install Postgresql

Note: if you prefer to use SQLite, you will need to make the following changes in the project files:

  1. In the Gemfile, replace gem 'pg', '~> 1.1' with gem 'sqlite3', '~> 1.4'.
  2. In the database.yml file, change the line adapter: postgresql to adapter: sqlite3.
PostgreSQL Installation for WSL

To install Postgres for WSL, run the following commands from your Ubuntu terminal:

sudo apt update
sudo apt install postgresql postgresql-contrib libpq-dev

Then confirm that Postgres was installed successfully:

psql --version

Run this command to start the Postgres service:

sudo service postgresql start

Finally, you'll also need to create a database user so that you are able to connect to the database from Rails. First, check what your operating system username is:

whoami

If your username is "ian", for example, you'd need to create a Postgres user with that same name. To do so, run this command to open the Postgres CLI:

sudo -u postgres -i

From the Postgres CLI, run this command (replacing "ian" with your username):

createuser -sr ian

Then enter control + d or type logout to exit.

This guide has more info on setting up Postgres on WSL if you get stuck.

Postgresql Installation for OSX

To install Postgres for OSX, you can use Homebrew:

brew install postgresql

Once Postgres has been installed, run this command to start the Postgres service:

brew services start postgresql