Git Product home page Git Product logo

cleanarchitecture's Introduction

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 authorization

The 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

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
    email
    authorities
  }
}
HTTP Headers
{
  "Authorization": "Bearer [TOKEN FROM LOGIN]"
}

Create new user

mutation CreateUser {
  CreateUser(
    a0: {
      email: "[email protected]"
      password: "Penait1!"
      authorities: [USER]
    }
  ) {
    id
    email
    authorities
  }
}
HTTP Headers
{
  "Authorization": "Bearer [TOKEN FROM LOGIN]"
}

cleanarchitecture's People

Contributors

eschouten avatar francynox avatar sugasaki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.