To start the app you need to have docker
and docker-compose
installed.
- download the repo by running
git clone git@github.com:dimaglushkov/epam-xm-test-assignment.git
- build and start containers by running
docker-compose up --build
- use postman or any similar tool (or scripts from
/bin
) to send HTTP requests to the app
Configuration is done by .env
file
Method Address Requires auth
GET /companies/:id -
POST /companies/ +
PATCH /companies/:id +
DELETE /companies/:id +
To access protected endpoints (
create
,update
,delete
), you need to set properAuthorization
HTTP header. Visit bin/create.sh to see an example.
The app is represented by several containers:
db
- represents postgresql db instancezookeeper
&kafka
- responsible for events-related communicationapp
- the app itself, contains the main logic of the applicationdummy-consumer
- simple go app responsible for consuming and logging every event sent byapp
The code structure I've ended up with is highly inspired by the hexagonal (a.k.a. ports and adapters architecture). The main objective of this approach is separation of concerns. The whole app is represented by several layers that are connected through interface. This approach allows to apply dependency inversion principle and provides, separates core application logic from any externals, and offers extreme flexibility in adding/removing external dependencies and tools.
Due to time constraints, I have not implemented several features that I believe are necessary for this app to be truly production-ready:
- Proper app monitoring (using tools such as Prometheus and Grafana)
- Better test coverage
- Advanced logging tools (e.g., logrus, zap, in place of the default log module)
- Improved documentation
- Proper Kafka & Postgres configuration
Since the task was to implement build a microservice to handle companies, I focused on the service, instead of infrastructure