Author: An Do
I try to design and implement the challenge with microservice design in mind. However, the setup and configuration of microservices quickly grows and draws too much effort that distract me from real business logic. Nevertheless, I decided to take a hybrid approach:
- Module packages under
de.superchat
could be viewed as microservices on their own. You might expect some model duplication due to this nature. - Database tables are designed to be used in their own service context boundary.
The only exception is auth and user services share
user
table. - Internal communication are done by REST client and context propagation. No service discovery registration.
- No API gateway. I intended to add Nginx as API routing but because we keep code in one place and run in same Quarkus instance. There is no more need.
I assume a couple of things during the development:
- Only local dev environment supported, no production build.
- No realtime chat supported.
- I actually created
source
table with external webhook. However, I end up to not support creation and chatting with external users. The main focus for webhook is to "receive messages from an external service via a webhook", not communicate with them.
- Language:
Java
(sorry, notKotlin
!) - Framework:
Quarkus
- Database:
Postgres
- Messaging:
Kafka
- ORM:
Hibernate
- Build tool:
Maven
- DevOps:
Docker
To ease the development, dependencies(Postgres, Admininer, Kafka) start in docker containers. However, the quarkus application itself run directly in localhost using Maven.
DEBUG log files are generated under logs/ folder.
Adminer is deployed at http://localhost:8082/. You could manage Postgres DB with its simple UI. Use below configuration to connect:
- username=superuser
- password=superuser
- host=superchat-postgres
- database=superchat_database
- schema=public