Skip to content

kareemserry/nytbr

Repository files navigation

NYT's BESTREADS

New York Times Bestselling lists web app with React using The NYT's Books API & Google Books API. Top 15 bestselling fiction and non fiction books alongside a favourites section where you can add your favourite books. Clicking on a specific book takes you to it's amazon link so you can buy it.

Requirements

For development, you will only need Node.js and a node global package, Npm or Yarn, installed in your environement.

Node

  • Node installation on Windows

    Just go on official Node.js website and download the installer. Also, be sure to have git available in your PATH, npm might need it (You can find git here).

  • Node installation on Ubuntu

    You can install nodejs and npm easily with apt install, just run the following commands.

    $ sudo apt install nodejs
    $ sudo apt install npm
    
  • Other Operating Systems

    You can find more information about the installation on the official Node.js website and the official NPM website.

If the installation was successful, you should be able to run the following command.

$ node --version
v8.11.3

$ npm --version
6.1.0

If you need to update npm, you can make it using npm! Cool right? After running the following command, just open again the command line and be happy.

$ npm install npm -g

Yarn installation

In case you want to install yarn, just run the following command.

  $ npm install -g yarn

Config File

config.json file exists in nytbr/frontend/src

{
   "backendUrl": 
}

this value should reflect the value of the full path to the backend server. When running through the docker images or docker-compose this should reflect the path to the external url not the internal one.

Variables you should add to your Enviroment

{
   "NYTBR_BACKEND_PORT": , 
   "NYTBR_BACKEND_URL": ,
   "NYTBR_FIREBASE_APP_ID":,
   "NYTBR_FIREBASE_API_KEY":,
   "NYTBR_FIREBASE_AUTH_DOMAIN":,
   "NYTBR_FIREBASE_DATABASE_URL":,
   "NYTBR_FIREBASE_MESSAGING_SENDER_ID":,
   "NYTBR_FIREBASE_PROJECT_ID":,
   "NYTBR_FIREBASE_STORAGE_BUCKET":,
   "NYTBR_NYT_API_KEY":,
   "NYTBR_SECRET":,
   "NYTBR_DISCORD_TOKEN":,
   "NYTBR_FRONTEND_URL":,
}

Adding Variables to your Environment

1. On Windows

1-Right-click the Computer icon and choose Properties, or in Windows Control Panel, choose System.
2-Choose Advanced system settings.
3-On the Advanced tab, click Environment Variables.
4-Click New to create a new environment variable. Click Edit to modify an existing environment variable.

2. On Unix

1-sudo -H gedit /etc/environment
2-VARNAME="my value"

Installing

cd nytbr
cd backend
npm install

Open a new terminal
cd nytbr
cd frontend
npm install

Running The App

Start the Express Server

cd backend
node index.js

Start the Discord Server

cd discord
node index.js

Start Create React App

In a different terminal tab...

cd frontend
npm start

Docker

Build

to build the images run these commands

docker build -t backend -f ./backend/Dockerfile .
docker build -t discord -f ./discord/Dockerfile .
docker built -t frontend ./frontend

Run

to run these images simply

docker run backend
docker run discord
docker run frontend

Options

  • -p use this option to specifiy what ports to bridge from the image to the outside world
  • -env use this option to pass all the required env variables to the image

Docker Compose

the docker-compse.yml handles all the runtime config needed for the running of the images simply type

docker-compose build
docker-compose up

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published