Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martishin/cqrs-hotel-management
CQRS and Event Sourcing-based hotel management system, built using Kotlin, Ktor, Akka, and Cassandra
https://github.com/martishin/cqrs-hotel-management
akka cassandra cqrs docker event-sourcing gradle kotlin kotlin-coroutines ktor
Last synced: about 2 months ago
JSON representation
CQRS and Event Sourcing-based hotel management system, built using Kotlin, Ktor, Akka, and Cassandra
- Host: GitHub
- URL: https://github.com/martishin/cqrs-hotel-management
- Owner: martishin
- Created: 2024-09-12T22:43:14.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-24T22:00:15.000Z (4 months ago)
- Last Synced: 2024-12-18T23:43:33.355Z (about 2 months ago)
- Topics: akka, cassandra, cqrs, docker, event-sourcing, gradle, kotlin, kotlin-coroutines, ktor
- Language: Kotlin
- Homepage: https://www.martishin.com/posts/project-cqrs-akka-kotlin
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CQRS and Event Sourcing Example with Kotlin, Ktor, Akka, and Cassandra
This project demonstrates how to build an app that uses **CQRS (Command Query Responsibility Segregation)** and **Event Sourcing** patterns using Kotlin, Ktor, Akka, and Cassandra.
It implements hotel reservation management functionality with separate commands for creating, updating, and deleting reservations, along with querying operations to fetch individual or all reservations.## Running locally
1. Clone the repository
```bash
git clone https://github.com/martishin/cqrs-akka-kotlin-example.git
cd cqrs-akka-kotlin-example
```
2. Start the Cassandra database
```bash
docker compose up cassandra
```
3. Build and run the application
```bash
./gradlew run
```
4. The server will be available at http://localhost:8080.## Making API Requests
You can interact with the system using the following curl commands. You can also execute these REST calls using [Postman](https://www.postman.com/).
* Create a reservation
```bash
curl -X POST http://localhost:8080/reservations \
-H "Content-Type: application/json" \
-d '{
"guestId": "guest123",
"startDate": "2023-11-01",
"endDate": "2023-11-05",
"roomNumber": 101
}'
```* Update the reservation
```bash
curl -X PUT http://localhost:8080/reservations/{confirmationNumber} \
-H "Content-Type: application/json" \
-d '{
"startDate": "2023-12-01",
"endDate": "2023-12-05",
"roomNumber": 102
}'
```
3. Delete the reservation
```bash
curl -X DELETE http://localhost:8080/reservations/{confirmationNumber}
```
4. Get all reservations
```bash
curl -X GET http://localhost:8080/reservations
```
5. Get the reservation
```bash
curl -X GET http://localhost:8080/reservations/{confirmationNumber}
```## Testing
Run tests
```bash
./gradlew test
```## Technologies Used
* [Kotlin](https://kotlinlang.org/) with [coroutines](https://kotlinlang.org/docs/coroutines-overview.html) - modern JVM language with concise syntax and safety features
* [Akka](https://akka.io/) - actor-based concurrency framework
* [Ktor](https://ktor.io/) - Kotlin framework for building asynchronous servers and clients
* [Apache Cassandra](https://cassandra.apache.org/_/index.html) - distributed NoSQL database for scalability and high availability
* [Gradle](https://gradle.org/) - build automation tool