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
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