Each cardholder (holder) has an account with their information. For each operation performed, a transaction is created and associated with the respective account. Transactions have specific types, e.g., Normal Purchase, Purchase with installments, Withdrawal, and Credit Voucher. Normal Purchase and Withdrawal transactions are recorded with negative values, while Credit Voucher transactions are recorded with positive values.
The HTTP contract is published in openapi.yaml at the repository root and detailed in the documentation pages linked
below. To exercise it, import the Postman collection. It covers every
operation, and running it top to bottom against a local stack opens an account, moves money across the four operation
types, and reads the result back. It carries its own baseUrl, so no environment import is needed to point it at
http://account.localhost:8090.
Figure 01: Account transaction flow diagram.
To clone the repository using the command line, run:
git clone https://github.com/gustavofreze/account.gitTo install project dependencies locally, run:
make configureTo start the application containers, run:
make startTo stop the application containers, run:
make stopRun all tests with coverage and mutation testing:
make testsRun a single test file:
make test-file FILE=AccountTestRun static code analysis:
make reviewFix static code analysis issues:
make fix-reviewOpen static analysis reports (e.g., coverage, lints) in the browser:
make show-reportsRemove dependencies and generated artifacts:
make cleanYou can check other available commands by running
make help.
| Environment | DNS |
|---|---|
Local |
http://account.localhost:8090 |
Every variable the application and its migration run read. This is a proof of concept, so .env.local is committed at
the repository root and the Development value column below is the literal content of that file. Every value in it is a
local-only default and never a real credential. A deployed environment supplies its own values through the container
environment instead. The Makefile hands the file to Docker Compose with --env-file, and both the account and the
account-migrate services load it through env_file.
| Variable | Description | Development value |
|---|---|---|
DEBUG |
Toggles the detailed error output of the HTTP error handler | false |
SOURCE |
Repository URL the application reports as its source | https://github.com/gustavofreze/account |
APP_NAME |
Component name the structured logger stamps on every entry | account |
DATABASE_HOST |
Database host (docker service name) | account-adm |
DATABASE_PORT |
Database port inside the compose network, published on the host as 3307 | 3306 |
DATABASE_NAME |
Database schema name | account_adm |
DATABASE_USER |
Database user the application connects as | root |
DATABASE_PASSWORD |
Password of the database user | root |
FLYWAY_URL |
JDBC URL the migration run connects to | jdbc:mysql://account-adm:3306/account_adm?allowPublicKeyRetrieval=true&useUnicode=yes&characterEncoding=UTF-8 |
FLYWAY_USER |
Database user the migration run connects as | root |
FLYWAY_TABLE |
Table Flyway keeps its schema history in | schema_history |
FLYWAY_SCHEMAS |
Schema the migrations are applied to | account_adm |
FLYWAY_PASSWORD |
Password of the migration user | root |
FLYWAY_LOCATIONS |
Directory the migration files are read from | filesystem:/flyway/sql |
FLYWAY_CLEAN_DISABLED |
Blocks flyway clean from dropping the schema |
false |
FLYWAY_VALIDATE_MIGRATION_NAMING |
Fails the migration run when a file name breaks the Flyway convention | true |
The structured logger writes to standard output, so the container runtime holds the log stream. Follow it with:
docker logs -f account