Skip to content

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

License

Notifications You must be signed in to change notification settings

gabriellopes00/surfforecast

Repository files navigation

Surfforecast App 🌊

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