This is a demo project that handles monitoring of the availability of web pages. The main goal of this project is to try the technologies mentioned below, while keeping in mind a future deployment to AWS.
- Ktor as a web framework
- kotlinx.serialization for working with JSON
- Kodein for DI
- Hoplite to load configuration files
- jasync-sql to access MySQL
- kotest for tests
- mockk for mocks
- MySQL (AWS Aurora)
- SQS
- Gradle multi-module project
- Set-up Ktor
- Set-up Kodein
- Set up Micrometer & Prometheus
- Configuration via YAML
- docker-compose with dependencies
- terraform for localstack resources
- Makefile (with up, down, run, ci commands)
- openapi.yaml with API endpoints
- Implement endpoints from OpenAPI spec
- Set up database migrations using FlyWay
- Implement repository layer using jasync
- Add error handling to the API
- Implement an mvp for scheduler
- Implement an mvp for worker
- At least one test using kotest
- At least one test using mockk
- At least one test for db layer
- At least one test for API (using mock server)
- At least one test validating API responses against OpenAPI spec
- At least one integration test for API
- At least one integration test for the scheduler (writing to SQS)
- At least one integration test for the worker (reading from SQS)
- default way to configure Ktor sucks, as it's relying on a conf file in HOCON format
- stack traces are hard to read or missing line numbers
- jasync ConnectionPool's API is not super Kotlin friendly
- jasync is using JodaTime instead of java.time.*
- swagger-request-validator has no out-of-the-box support for Ktor
- Ktor does not support reading request body in tests
- had to add ApiTestSpec to be able to write boilerplate free API tests