Git Product home page Git Product logo

alertadotesouro's Introduction

🚨 Alerta do Tesouro

A web application that notifies you about Brazilian treasury bond rates.

Project   |    Tools   |    Developing   |    Back-end   |    Running locally

License

💻 Project

AlertaDoTesouro is a project elaborated with the intent of automatically monitoring Brazilian government bond and alerting users about them according to their preferences of rates. Tools such as Node.js, Express, PostgreSQL, Docker, Redis, linting and debugging tools, mail delivery systems, among others, were employed to build this system. Furthermore, this project was also presented as required academic work for the Integrated Project classes during the 2022/1 semester.

The application allows users to set one value per treasury bond, so they can get notified by email whenever its rate goes above or below that value.

Dashboard Sign in Notifications
Dashboard page Sign in page Notifications page

🔧 Tools

This project was developed using the following tools:

👷 Development

Clone the repository and enter it with your terminal.

Rename or copy the .env.test.example file to .env.test in /server and change values whenever needed. To run the development servers, run the following command:

docker compose --profile dev up

⚙️ Back-end

All files exclusively related to the back-end server are located in the folder /server.

The back-end REST API is fully functional and was made with Express. Multiple endpoints have been defined and they can be explored extensively by referring to the .insomnia.json file, which can be imported into Insomnia itself or possibly other HTTP clients.

🧪 Testing

Deploy the test database with the following command:

docker compose --profile dev --profile test up

When you need to wipe the volumes, just docker compose --profile dev --profile test down --volumes

Once running, you can unit test and integration test the back-end server by running the following command:

docker exec -t alertadotesouro-server-dev-1 yarn test

Example: listing treasury bond

A typical request would be a simple GET request to the /treasurybond endpoint. Response example:

[
  {
    "id": "233b7ab7-63dd-4a06-ab21-8fd2562069e5",
    "code": 162,
    "name": "Tesouro Prefixado com Juros Semestrais 2029",
    "expirationDate": "2029-01-01T03:00:00.000Z",
    "minimumInvestmentAmount": 0,
    "investmentUnitaryValue": 0,
    "semianualInterestIndex": true,
    "annualInvestmentRate": 0,
    "annualRedRate": 7.13,
    "minimumRedValue": 11.92,
    "ISIN": "BRSTNCNTF1Q6",
    "indexedTo": {
      "code": 19,
      "name": 19
    },
    "lastDateOfNegotiation": "2020-02-10T03:00:00.000Z",
    "texts": {
      "investmentSubtitle": "É mais interessante para quem precisa dos seus rendimentos para complementar sua renda, pois paga juros a cada semestre (cupons de juros). Em caso de resgate antecipado, o Tesouro Nacional garante sua recompra pelo seu valor de mercado.",
      "features": 162,
      "recommendedTo": "Indicado para aqueles que querem realizar investimentos de longo prazo."
    },
    "created_at": "2020-08-23T22:46:56.763Z",
    "updated_at": "2020-08-23T22:46:56.763Z"
  },
  [...]
]

📑 Documentation

You can build the documentation with typedoc. It is recommended that you install typedoc with tools like npx.

From the /server directory, run typedoc --out docs. The documentation will then be available at docs/.

🖥 Front-end

Running it with dev profile (see below) will automatically start the front-end server and you will have access to debugging logs on the browser console.

🏡 Running locally

Clone the repository and enter the folder with your terminal. To start the services with Compose v2, run the following command while on the project root directory:

docker compose up # TODO, only development is currently supported

You can append -d or --detach to run the services in detached mode.

Rename or copy the .env.example file to .env in both the /server and /web directories and change values whenever needed.

🤓 Back-end considerations

  • The default server port is 3333. You might want to change this if this port is already in use wherever you are running the server on.
  • You can and should change JWT_SECRET to another string. It is used by the hashing algorithm to generate hashed passwords.
  • The project uses Mailtrap for development purposes. You can of course use your preferred mail service by replacing the appropriate values in the .env file.

🤓 Front-end considerations

  • The default port is 3000. You might want to change this if this port is already in use wherever you are running the server on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.