mellomaths / cryptocoinmarketapp

A Ruby on Rails and React Native App to list price of the top 10 most important cryptocurrencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crypto Coin Market App

A Ruby on Rails and React Native App to list price of the top 10 most important cryptocurrencies based on market capitalization according to CoinMarketCap.

The app consumes the CoinMarketCap REST API, see the documentation here.

Guides

Table of Contents

Quick start

The Rails REST has two endpoints:

One for getting the cryptocurrencies stored on database: /cryptos. And the other to update the price, market cap and its position based on market cap: /update_cryptos. The server will get this information from the CoinMarketCap REST API and store on the database.

See a further documentation here.

The React Native App will consume this API and show the data to the user.

Running the application locally

System requirements

You need to have in your machine:

Note: MySQL is option since you can configure a different database for the Active Record.

Clone the repository

git clone https://github.com/mellomaths/criptocoinmarketapp.git
cd cryptocoinmarketapp

Configure the mysql2 adapter

Note: If you don't have MySQL Server, you can use the sqlite3 gem. Read more here. If you are going to configure a different database as the database for Active Record, you should do that before the rest of the tutorial.

In the /server/config/database.yml file, set the variables username and password to your local MySQL Database configuration.

default: &default
  ...
  username: <YOUR-DATABASE-USERNAME>
  password: <YOUR-DATABASE-PASSWORD>
  host: localhost

Rails Database Creation and Migration

cd server
rake db:create
rake db:migrate

Installing Rails dependencies

bundle install

Running the Rails REST API

rails s

Installing the mobile App dependencies

cd app
npm install

Using Yarn:

yarn install

Start your android emulator

After starting the emulator (like Genymotion), you should map the Rails REST API port to the deviced started.

adb reverse tcp:3000 tcp:3000

Run the android project

cd cryptocoinmarketapp
npm run android

And should be all set and running.

Possible problems and solutions

Set sqlite3 on Rails Server

In the /server/config/database.yml file, you should find a adapter variable configured to use the mysql2. Change that to sqlite3 like the example below and delete the variables username and password as they are not needed.

default: &default
  adapter: 'sqlite3'
  ...

In the /server/Gemfile file, replace the gem 'mysql2', '>= 0.3.18', '< 0.6.0' line to gem 'sqlite3'.

About

A Ruby on Rails and React Native App to list price of the top 10 most important cryptocurrencies


Languages

Language:Ruby 62.6%Language:JavaScript 16.5%Language:Objective-C 11.0%Language:Starlark 5.5%Language:Java 3.7%Language:HTML 0.6%