Skip to content

A budgeting application for rising the user's financial awareness.

License

Notifications You must be signed in to change notification settings

RosenUrkov/Monetize

Repository files navigation

Monetize

Build Status

View online: monetizeonline.work

Description

A budgeting application for rising the user's financial awareness.

  • Main technologies used: Production pipeline with Tests, CI/CD, Docker and Kubernetes, Microservices with Nest and Typescript, Client with React and Redux
  • Overview: There are three main services - Balance, Budget and Statistics. The Balance service contains the logic about manipulating the user's input payments and the Budget service handles the budget actions. Both services emit to the Statistics service on every change so it has the most recent data. The Statistics service's job is to accumulate all of the payments over a given period and compare them with the budget for that period so it can help the user improve their financial habits. The services are hidden behind the API Gateway which holds the authentication logic. The architecture is containerized with Docker and Kubernetes who will host the services in separate isolated containers that are inaccessible for the outside world. With pure Docker (docker-compose) our point of entrance is a reverse-proxy nginx server that will route the traffic between the client and the API Gateway. With the Kubernetes setup the point of entrance becomes the load-balancing ingress service.

Diagram

Starting the project

  • Start without containers: In order to start the application locally without containers you must start all of the services and the client separately. Each project has its own README with instructions that you can follow.

  • Start with docker-compose: You need to have docker installed on your machine. The docker-compose.yml file is on the root level with all needed configurations and environment variables.

    • Start the containers: docker-compose up
    • There are three main databases with migrations and seed scripts that you need to run once in order to initialize properly:
      • Find the api-gateway container and run: docker exec -it {container id} sh. Then inside container run npm run typeorm -- migration:run and npm run seed
      • Find the balance-service container and run: docker exec -it {container id} sh. Then inside container run npm run typeorm -- migration:run and npm run seed
      • Find the budget-service_ container and run: docker exec -it {container id} sh. Then inside container run npm run typeorm -- migration:run and npm run seed
    • The application will be served on localhost.
  • Start with minikube and kubectl: You need to have minikube and kubectl installed on your machine.

    • Start the minukube virtual machine: minikube start
    • Enable the ingress addon: minikube addons enable ingress
    • There are four kubernetes secrets that we need to create:
      • JWT key: kubectl create secret generic jwt-secret --from-literal JWTSECRET=s3cr3t
      • API Gateway Database Password: kubectl create secret generic api-gateway-database-password --from-literal PASSWORD=p@ssw0rd
      • Balance Service Database Password: kubectl create secret generic balance-service-database-password --from-literal PASSWORD=p@ssw0rd
      • Budget Service Database Password: kubectl create secret generic budget-service-database-password --from-literal PASSWORD=p@ssw0rd
    • Apply the kubernetes configurations from the k8s folder: kubectl apply -f ./k8s/. Wait until all of the containers are running.
    • There are three main databases with migrations and seed scripts that you need to run once in order to initialize properly:
      • Find one of the api-gateway pods and run: kubectl exec -it {pod name} sh. Then inside container run npm run typeorm -- migration:run and npm run seed
      • Find one of the balance-service pods and run: kubectl exec -it {pod name} sh. Then inside container run npm run typeorm -- migration:run and npm run seed
      • Find one of the budget-service_ pods and run: kubectl exec -it {pod name} sh. Then inside container run npm run typeorm -- migration:run and npm run seed
    • Get the ip of minikube: minikube ip and open it in the browser.

About

A budgeting application for rising the user's financial awareness.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published