Forx News

forxnews

Description

Forx News is a restaurant review website based on Yelp datasets. It aims to help users search restaurants in a simplistic way, and present them with insightful restaurant reviews.

Project Wiki: https://forx-news.gitbook.io/forx-news-wiki

Demo Video: https://youtu.be/nuDBwg3mG6o

Deployment on Heroku: https://forxnews.herokuapp.com

Tech Stack

System Architecture

architecture

Folder Structure

We host our backend codes in the root project folder, and nest frontend codes inside the client folder.

.
├── client                  # Frontend
│   ├── public              # Static resources, such as icons and images
│   └── src
│       ├── components      # Pages, components and styles
│       ├── hooks           # Custom hooks
│       ├── constants       # Constants
│       ├── utils           # Helper functions
│       ├── App.js
│       ├── index.css
│       └── index.js
├── config                  # Env variables, such as API keys and secrets
├── middlewares             # Custom middleware functions
├── routes                  # Route handlers
├── services                # Third-party services, such as Passport.js
├── database.js             # MySQL connection
├── index.js                # Configures server, middlewares and routes
└── schema.js               # Request schema validation rules

Development Guidelines

Make sure you have installed git, node, npm before starting.

1. Get Started

  1. Clone repo: git clone [email protected]:ruichen199801/cis550-fa22-project.git
  2. Checkout feature branch: git checkout -b <feature branch name>
  3. Install backend dependencies: cd cis550-fa22-project && npm i
  4. Install frontend dependencies: cd client && npm i
  5. Run frontend and backend concurrently: cd .. && npm run dev

2. Before Commit

  1. Stash uncommited changes on your local branch: git stash
  2. Fetch remote changes into local main: git checkout main && git pull origin main
  3. Sync your branch with local main: git checkout <your branch name> && git merge main
  4. Restore changes and continue your work: git stash pop

3. Commit Your Work

  1. Sanity check: git status, git branch
  2. Push changes: git add ., git commit -m <commit message>, git push
  3. Open pull request and assign code reviewer
  4. Merge codes after approval

4. After Merge

Archive branch according to https://gist.github.com/zkiraly/c378a1a43d8be9c9a8f9

5. DO NOT

  1. Push to main directly or force merge into main
  2. Push untested or bugged codes
  3. Use API keys and secrets explicitly in code
  4. Include node_modules in commits
  5. Overwrite package-lock.json without introducing new dependencies (use npm ci instead for subsequent npm install)

6. Common Issues

  1. Port already in use: lsof -i tcp:<port>, then kill -9 <PID>
  2. Nodemon app crashed: pkill -f nodemon, then restart server
  3. Node.js Error: connect ECONNREFUSED: make sure installed node version is 14.17.6, as the app may not be compatible with newer versions

7. Debug

Heroku logs: heroku logs -t

8. Test Suites

Run in Postman