Backend/server made as Evaluation task for Modus Create.
- application allow to manage your budget
- make monetary transactions asincome or an expense
- allow to consult the balance resulting from your financial transactions
- application support multiple users
What things you need to install the software and how to install them
- Docker - Container Management. Version: 19.03+ and Docker Compose Version: 1.25+
- Maven - Dependency Management
- Java - OpenJDK 8 or similar OracleJDK 8
A step by step series of examples that tell you how to get a env running
cd %project_parent_directory%/app./build.shIt will build project, run all tests
cd %project_parent_directory%/app./run.sh startIt will run all needed environment
./run.sh start-infrastructureNow you can play with code, run microservices from IDE, build tests etc.
./run.sh stop./run.sh removecd %project_parent_directory%/app./app.sh -h./app.sh -l %wanted_login% -p %wanted_password% -rLogin/Authorize (you will receive JWT token that needed for making transactions and getting balance)
./app.sh -l %your_login% -p %your_password% -a./app.sh -j %your jwt token from auth% -m %wanted monetary INT value% -i -tMake expense transaction (-e key) (value for -m parameter should be positive INTEGER). You can have negative balance if you expense too much ;)
./app.sh -j %your jwt token from auth% -m %wanted monetary INT value% -e -t./app.sh -j %your jwt token from auth% -b-hhelp flag. Without value-rregister flag. Allow you to register. Without value. Should goes in the end of command-llogin flag. Should goes with your login-ppassword flag. Should goes with your password-aauthorization flag. Allow you to get jwt token. Without value. Should goes in the end of command-ttransaction flag. Allow you to make income/expense transaction. Without value. Should goes in the end of command-jjwt flag. Should goes with your token (received via login)-mmonetary flag. Should goes with Integer value (whether you want to add income/expense to your account)-iincome flag. Define your transaction as income. Without value-eexpense flag. Define your transaction as expense. Without value-bbalance flag. Allow you to take a look at your balance. Without value. Should goes in the end of command-uurl flag. if you need to define custom url in format: http://localhost:8010 (without slash in the end) with any other command
Application Architecture implements Microservice choreography pattern and CQRS pattern
Application consist from 4 microservices:
- gateway - responsible for RestAPI and route queries to other services
- users - registration/login
- financial-transactions - keep financial transactions historically
- financial-balance - calculate balance, based on transactions and allow to retrieve it
To prevent additional AWS configuration, and be more atomic in running and vendor-free, following 3rd party (architecture) components was chosen
PostgreSQL
RabbitMQ
Docker (with docker-compose)
- Way more code should be covered with unit and integration tests
- Service inside gateway should not notify different queues for making single transaction. Some sort of topic (when all consumers read single message) should be implemented
- for real clustering - docker compose can't be applicable as solution. Docker swarm or Kubernetes should be chosen instead
- Balance calculates asynchronously. Race condition might happen and balance might be inaccurate
Application was run only on MacOs. Should works fine under Linux
- Ihor Tsinko - email
This project is licensed under MIT License - all details in LICENSE.md file