- Docker
- JDK 11+
- Gradle
The application uses Postgres DB, therefore I should be deployed before usage of the application locally.
To start the postgres instance locally run
docker run --name some-postgres -e POSTGRES_PASSWORD=<password> -d postgresThen execute sh run.sh to start the application.
When you see in logs like
[main] INFO i.c.ProductionConfiguration - Initialization is finished
[main] INFO Application - Application started in 0.533 seconds.
[DefaultDispatcher-worker-1] INFO Application - Responding at http://0.0.0.0:8080It means that application is up and running.
- An order is created over the REST endpoint
PUT /order, and it is stored in stateCREATED - A payment confirmation endpoint
PUT /payment-confirmationis used to transit from stateCREATEto statePAID - After an order is
PAID, the system submits a fulfillment request to external service. In case of successful submission, an order transit to stateIN_FULFILLMENT - The system can be notified about successful fulfillment using fulfillment confirmation endpoint
PUT /fulfillment-confirmation. In that case, an order transit to stateCLOSED
The order management system is implemented using
- Kotlin - as main programming language
- Gradle - as the build tool
- Ktor - as HTTP routing framework
- Arrow-kt - for error handling following functional programming approach
- Postgres DB - to store the state of the system
- Ktlint - to maintain the common code style
- Jacoco - as coverage engine
- Credential management to restrict access to endpoints and the database
- Safety mechanisms against attacks like SQL injection prevention
- More real order fields to be closer to reality (e.g. customer details)
- More complex order validation
- Database related changes like
- Separate database schema for the application
- Usage of an ORM framework for more convenient work with the database
- Good database structure, like indices, foreign keys or normalization
- Deployment configuration to cloud (e.g. k8s)
- Resilience instruments for dependencies like circuit breaker, etc
- Testing
- Performance testing
- Mutational testing
- System testing
- Proper management of the object lifecycle
- Monitoring, for example prometheus metrics, open tracing, etc
- Use Kover instead of jacoco to support kotlin coverage better

