A Ktor REST server.
- Multi-project setup.
- Exposed database framework.
- Database Connection Pooling with HikariCP .
- Encryption at field level example.
- Koin dependency injection.
- Quartz Scheduler integration. A popular and flexible job scheduling library.
- In-memory hashed passwords storage lookup, with enhanced security.
- Pagination and filtering examples.
- JSON serialization with Kotlinx.
- RBAC (Role Based Access Control) example, including a basic role dashboard.
- JWT-authentication example.
- Basic-authentication example.
- OAuth-authentication example.
- Connection Rate limit examples.
- HTML DSL example.
- H2 embedded database, both in-memory and file-based.
- HOCON configuration example, including parsing for strongly typed settings.
- OpenAPI integration, including Swagger-UI and Redoc.
- Routing organization examples.
- Call Logging and Call ID examples for events traceability.
- Snowflake unique IDs for logging purposes, suitable for distributed systems.
- Micrometer Metrics with Prometheus integration. Configuration steps for Prometheus and Grafana are included.
- Flyway database migration example.
- Contextual Transactions, allowing to execute concrete transactions per database connection and/or schema.
- Custom exceptions including composite error responses.
- Custom serializers examples.
- Custom validators and custom table column constraints.
- Fat Jar building and execution example.
- Docker containerization example.
For convenience, it is included a Postman Collection with all the available REST endpoints.
Kcrud serves as a comprehensive example of a Ktor server, showcasing a variety of features and best practices.
The code intentionally contains redundancies and inconsistencies to illustrate different approaches and strategies to achieve similar results. For example, different authentication methods (JWT, OAuth, and Basic, despite Basic being discouraged); different approaches to exception handling and validations across layers. The project also examines data persistence, illustrating custom columns with validation, field level encryption, different ways to store enums in a database, etc.