- docker 26.0.0
- docker-compose 1.29.2
The application is a personal financial manager, divided into microservices for more efficient operation. It allows users to manage their finances: view transaction information, add transactions, set goals, add accounts, and manage expense and income categories.
All microservices are implemented using gRPC to ensure efficient communication between them. Various tools and technologies are also used, such as Docker for containerization, protobuf for defining messages and services, and various libraries such as validator, pgx, envconfig and others.
You can view the documentation in Swagger format here.
You can run dockerized application via docker compose:
docker compose up --build
There are three entities that a user can manage: accounts, transactions, and categories.
Accounts are entities to which a person associates all his transactions. Money is transferred either from them or to them. They can be of two types: cash account and goal.
By account, we mean card or cash. A default account is automatically created in the application.
The goal refers to the amount of money that the user wants to accumulate. The user enters the amount and the date by which it needs to be accumulated, and the application calculates the monthly payment.
To create an account the user needs to make a request in terminal:
curl -X 'POST' \
'http://piglet-gateway:8083/piglet/bills/create' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--data '{}'
The curl body data depends on the account type:
- account:
--data '{ "billType": true, "billName": "account", }'
- goal:
--data '{ "billType": false, "billName": "goal", "goalSum": 500000, "date": "2024-05-18" }'
The command will return the account body, filling it with the values written to the database.
To update a transaction, the rules are similar to creation, but the user needs
to know the account id
. Replace {id}
with the account ID to be
deleted.
To update an account the user needs to make a request in terminal:
curl -X 'PUT' \
'http://piglet-gateway:8083/piglet/bills/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--data '{}'
To get all the accounts:
curl -X 'GET' \
'http://piglet-gateway:8083/piglet/bills/accounts' \
-H 'accept: application/json'
To get all the goals:
curl -X 'GET' \
'http://piglet-gateway:8083/piglet/bills/goals' \
-H 'accept: application/json'
To get an account:
curl -X 'GET' \
'http://piglet-gateway:8083/piglet/bills/{id}' \
-H 'accept: application/json'
Replace {id}
with the account ID to be deleted.
To delete an account:
curl -X 'DELETE' \
'http://piglet-gateway:8083/piglet/bills/{id}' \
-H 'accept: application/json'
Replace {id}
with the account ID to be deleted.
Transactions are records of money movements, such as income, expenses, debts, and transfers.
To create a transaction, the user needs to make a request in the terminal:
curl -X 'POST' \
'http://piglet-gateway:8083/piglet/transactions/create' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--data '{}'
The curl body data depends on the transaction type:
- income:
Parameters
--data '{ "transType": 1, "sum": 500, "date": "2024-05-18", "idCategory": "00000000-0000-0000-0000-000000000001", "idBillTo": "00000000-0000-0000-0000-000000000001", "repeat": true }'
idCategory
andidBillTo
are required for this transaction type.Repeat
is an optional (if undefined the transaction will be non-repeating). - expense:
Parameters
--data '{ "transType": 2, "sum": 500, "idCategory": "00000000-0000-0000-0000-000000000000", "idBillFrom": "00000000-0000-0000-0000-000000000001", "person": "Oleg" }'
idCategory
andidBillFrom
are required for this transaction type.Repeat
is an optional (if undefined the transaction will be non-repeating). - debt:
Parameters
--data '{ "transType": 3, "sum": 500, "debtType": true, "idBillTo": "", "idBillFrom": "00000000-0000-0000-0000-000000000001" }'
debtType
,idBillTo
andidBillFrom
required for each debt type. If you are the creditordebtType
sets true; otherwise, sets false. - transfer:
--data '{ "transType": 4, "sum": 500, "idBillTo": "e3662e81-5c56-4159-bbd2-0f989759c305", "idBillFrom": "00000000-0000-0000-0000-000000000001" }'
Parameters transType
, sum
required for all transactions.
Parameters transDate
, comment
, person
are optional (if undefined,
the date becomes equal to the transaction creation date, and the comment and
person remains empty).
To update a transaction, the rules are similar to creation, but the user needs
to know the transaction id
. Replace {id}
with the transaction ID.
curl -X 'PUT' \
'http://piglet-gateway:8083/piglet/transactions/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--data '{}'
To delete a transaction, the user needs to make a request in the terminal:
curl -X 'DELETE' \
'http://piglet-gateway:8083/piglet/transactions/{id}' \
-H 'accept: application/json'
Replace {id} with the transaction ID to be deleted.
To get details of a specific transaction, the user needs to make a request in the terminal:
curl -X 'GET' \
'http://piglet-gateway:8083/piglet/transactions/{id}' \
-H 'accept: application/json'
Replace {id} with the transaction ID.
To get all transactions, the user needs to make a request in the terminal:
curl -X 'GET' \
'http://piglet-gateway:8083/piglet/transactions/all' \
-H 'accept: application/json'
Categories are a transaction property used to classify transactions into different types, such as expenses or incomes and mandatory or optional. The system automatically creates default categories of expenses and income. This will include all transactions for which the user has not specified a category.
To add a category, the user needs to make a request in the terminal:
curl -X 'POST' \
'http://piglet-gateway:8083/piglet/categories/create' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"type": true,
"name": "Groceries",
"mandatory": true
}'
Parameters:
type
true for expense, false for incomemandatory
true for mandatory transaction
To update a category, the user needs to know the category id
and make
a request in the terminal:
curl -X 'PUT' \
'http://piglet-gateway:8083/piglet/categories/{id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
--data '{
"type": false,
"name": "Salary",
"mandatory": true
}'
Replace {id} with the category ID, and the category type, name, and mandatory flag as needed.
To delete a category, the user needs to make a request in the terminal:
curl -X 'DELETE' \
'http://piglet-gateway:8083/piglet/categories/{id}' \
-H 'accept: application/json'
Replace {id} with the category ID to be deleted.
To get details of a specific category, the user needs to make a request in the terminal:
curl -X 'GET' \
'http://piglet-gateway:8083/piglet/categories/{id}' \
-H 'accept: application/json'
Replace {id} with the category ID.
To get all categories, the user needs to make a request in the terminal:
curl -X 'GET' \
'http://piglet-gateway:8083/piglet/categories/all' \
-H 'accept: application/json'