Surfforecast App ๐ŸŒŠ

February 5, 2021 ยท View on GitHub

An app that queries a weather API to provide a better weather forecast for surfing on your favorite beaches.
An API mande with

typescript mongodb nodejs docker eslint jest heroku storm-glass react leaflet-maps

About this project ๐Ÿ“š

This is a project made with Node.js, Typescript, Mongodb and React.js, witch the users register and can record your favorite beaches, and get a forecast for each beach in certain times, containing wind speed, wind direction, wave speed, wave duration, wave height, swell direction, swell height... In addition, based in the forecasts, will be calculated a rating, to choose the best beach to surf.

Project structure โš™

  • .github โฏ github workflows setup files
  • src โฏ main application code (layers)
    • config โฏ specifics configuration files
    • @types โฏ custom types definition files
    • domain โฏ application models and usecases
    • implementation โฏ application internal usecases implementations
    • infra โฏ external libs implementations
    • presentation โฏ layer witch communicates the application with external environment
    • main โฏ components composition layer
  • tests โฏ functional tests code
  • . โฏ general configuration files

Building ๐Ÿ”ง

This app is made with Node.js and Mongodb, so you need to have this technologies installed, or you can run the app using Docker. And i recommend that you have installed the Yarn to run the app scripts.

Cloning Repository
git clone https://github.com/gabriellopes00/surfforecast.git
cd surfforecast
yarn install --frozen-lockfile || npm install

To run this project, you need to have a stormglass private key, to get the forecasts requests. Go to stormglass website and register yourself to get your private key.

After run the project, go to created directory /surfforecast/src/.env.example, update the file data, with you own information (api_port, stormglass_token, jwt_secret...) , and finally change the env file to .env.

Running with docker ๐Ÿณ

If you don't have Mongodb installed locally, you can run the only database with Docker. With the command below, a mongo image will be pulled, and mongodb will be started at port 27017 into your localhost, in a container called surfforecast-mongo.

docker run -d -p 27017:27017 --rm --name surfforecast-mongo mongo

And you can run the app completely using docker-compose. Will be created 2 services. The first is called api, and in this will be started Nodejs and all the app code will run in this service. The other will create a mongodb server, with will start mongo db at localhost:27017. To connect this services, will be created a network called surfforecast. You just need to use docker-compose to up the app:

docker-compose up -d

After you can stop the service with:

docker-compose down
Running in local development environment
yarn dev || npm run dev
Generating Build and running final build
yarn build && yarn start || npm run build && npm run start
Useful scripts ๐Ÿ“‹
Tests (jest) ๐Ÿงช
  • Coverage โฏ yarn test:ci
  • Watch โฏ yarn test:watch
  • Unit(.spec) โฏ yarn test:unit
  • Clear Cache โฏ yarn test:cache
Lint and Style (eslint | prettier) ๐ŸŽญ๐Ÿ–‹
  • Lint(fix) โฏ yarn lint:fix
  • Style(fix) โฏ yarn style:fix
Statistics of the types of commits ๐Ÿ“Š๐Ÿ“ˆ

Following the standard of the Conventional Commits.

  • feature commits(amount) โฏ git shortlog -s --grep feat
  • test commits(amount) โฏ git shortlog -s --grep test
  • refactor commits(amount) โฏ git shortlog -s --grep refactor
  • chore commits(amount) โฏ git shortlog -s --grep chore
  • docs commits(amount) โฏ git shortlog -s --grep docs
  • build commits(amount) โฏ git shortlog -s --grep build
  • fix commits(amount) โฏ git shortlog -s --grep fix

Contact ๐Ÿ“ฑ

Github Badge Linkedin Badge Twitter Badge Gmail Badge Facebook Badge Instagram Badge StackOverflow Badge