A REST API to register debit and credit transactions from customers accounts.
startup options
flag | description |
---|---|
-d | create database |
-s | seed operation types table |
Configurations
var | example value | description |
---|---|---|
SERVER_PORT | 5566 | defines the port for the accessing server |
SQL_DRIVER | mysql / sqlite3 | defines the database drive |
CONNECTION_STRING | file:/teste.db | defines the connection string to database |
CONNECTION_TIMEOUT | 5 | defines timeout to wait connection in seconds |
LOG_LEVEL | 1 - 6 (logrus levels) | defines logrus level to log |
TTL | 3 | Defines time to leave of io operations by context in seconds |
SCHEMAS_PATH | ./v1_schema.sql | Path to SQL schema to configure database. |
command | description |
---|---|
clean | clean resources |
test | run all tests |
coverage | run all tests and generate coverage report |
updatemocks | update all mocks generated by mockgen |
build | compile program |
buildimage | build docker production image |
rundev | run program with dev configuration .env-dev |
runtest | run program with test configuration .env-test |
docker and docker-compose configurations
docker-compose -f ./docker/docker-compose.yaml up -d
Resources
- Local host api: http://localhost:5566
- swagger-ui: http://localhost:8081
- mysql: localhost:3306
- swagger file
- collections
Concepts of clean architecture and DDD
Represents all business rules, no external dependencies.
-
- Represents a business unity, important concepts.
- One point of validation
- Closed to modifications
- Isolated Business rules
-
- Adapter to receive and dispatch data
- Only interfaces
-
- Represents a single business use case
- Single responsibility
- No dependencies.
Implementation of adapters to input and output data
-
- Abstraction to access data sources, with apis, databases e etc.
-
- Implementation of domain repository interfaces
-
- Data model, represents external data models.
Facade to execute business rules with useCases
-
- Services by context
cross cutting layer, share common contents
-
- custom errors by context
Application entry points
-
- entry point adapters
- rest
- controller
- request controllers
- model
- input output data models
- responses
- wrapper rest output responses
- middlewares
- adapters to rest clint
- core
- bootstrap file and dependency container
- server
- Server application
- controller
- rest
- entry point adapters