Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ESchouten/CleanArchitecture
Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, OpenAPI/REST & KGraphQL/GraphQL generated endpoints, Gradle.
https://github.com/ESchouten/CleanArchitecture
backend clean-architecture exposed flyway gradle graphql hexagonal-architecture jwt kotlin ktor openapi swagger
Last synced: 3 months ago
JSON representation
Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, OpenAPI/REST & KGraphQL/GraphQL generated endpoints, Gradle.
- Host: GitHub
- URL: https://github.com/ESchouten/CleanArchitecture
- Owner: ESchouten
- License: mit
- Created: 2021-04-26T17:44:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-21T12:23:01.000Z (almost 2 years ago)
- Last Synced: 2024-08-02T19:37:56.004Z (6 months ago)
- Topics: backend, clean-architecture, exposed, flyway, gradle, graphql, hexagonal-architecture, jwt, kotlin, ktor, openapi, swagger
- Language: Kotlin
- Homepage:
- Size: 490 KB
- Stars: 314
- Watchers: 5
- Forks: 27
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - ESchouten/CleanArchitecture - Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, OpenAPI/REST & KGraphQL/GraphQL generated endpoints, Gradle. (Kotlin)
README
# Kotlin Clean Architecture Backend
Kotlin backend based on the Clean Architecture principles.
The application is separated into three modules: Domain, Usecases and Adapters
- Domain module contains all entities, it's validation and repository interfaces
- Usecases module performs actions on the domain entities and repositories and does authorizationThe domain and usecases modules do not have any external dependencies.
- Adapter layer: each adapter is implemented as a standalone module, lowering dependence on specific frameworks and
libraries and making them interchangable. The infrastructure module consumes all adapters (e.g. databases, (graphql)
endpoints, authentication logic)GraphQL endpoints are auto-generated from the Usecases
##### Technologies:
Ktor, JWT, Exposed, Flyway, OpenAPI/REST & KGraphQL/GraphQL generated endpoints, Gradle.
![image](https://miro.medium.com/max/800/1*0R0r00uF1RyRFxkxo3HVDg.png)
## OpenAPI REST
Docs URL: http://localhost:8080/docs
API definitions: http://localhost:8080/openapi.json
## GraphQL
Playground URL: http://localhost:8080/graphql
### Login
```
query Login {
LoginUser(a0: { email: "[email protected]", password: "P@ssw0rd!" })
}
```### Retrieve current user
```
query CurrentUser {
AuthenticatedUser {
id
authorities
}
}
```##### HTTP Headers
```
{
"Authorization": "Bearer [TOKEN FROM LOGIN]"
}
```### Create new user
```
mutation CreateUser {
CreateUser(
a0: {
email: "[email protected]"
password: "Penait1!"
authorities: [USER]
}
) {
id
authorities
}
}
```##### HTTP Headers
```
{
"Authorization": "Bearer [TOKEN FROM LOGIN]"
}
```