Hexagon
Hexagon

The atoms of your platform

Travis CI Codecov Codebeat Bintray

Quick Start | Guides | API Reference


Hexagon is a microservices library written in Kotlin. Its purpose is to ease the building of services (Web applications, APIs or queue consumers) that run inside a cloud platform.

It is meant to provide abstraction from underlying technologies to be able to change them with minimum impact. It is designed to fit in applications that conforms to the Hexagonal Architecture (also called Clean Architecture or Ports and Adapters Architecture).

The goals of the project are:

  1. Be simple to use: make it easy to develop user services (HTTP or message consumers) quickly. It is focused on making the usual tasks easy, rather than making a complex tool with a lot of features.
  2. Make it easy to hack: allow the user to add extensions or change the framework itself. The code is meant to be simple for the users to understand it. Avoid having to read blogs, documentation or getting certified to use it efectively.

What are NOT project goals:

  1. To be the fastest framework. Write the code fast and optimize only the critical parts. It is not slow anyway.
  2. Support all available technologies and tools: the spirit is to define simple interfaces for the most common features , so users can implement integrations with different tools easily.
  3. To be usable from Java. Hexagon is Kotlin first.

Quick Start

  1. Configure Kotlin in Gradle or Maven.
  2. Setup the JCenter repository (follow the link and click on the Set me up! button).
  3. Add the dependency:
  • In Gradle. Import it inside build.gradle:

    compile ("com.hexagonkt:server_jetty:0.22.11")
    
  • In Maven. Declare the dependency in pom.xml:

    <dependency>
      <groupId>com.hexagonkt</groupId>
      <artifactId>server_jetty</artifactId>
      <version>0.22.11</version>
    </dependency>
    
  1. Write the code in the src/main/kotlin/Hello.kt file:

     import com.hexagonkt.server.jetty.serve
    
     fun main(vararg args: String) {
         serve {
             get("/hello/{name}") { "Hello ${request["name"]}!" }
         }
     }
    
  2. Run the service and view the results at: http://localhost:2010/hello/world

You can read more details reading the Quick Start page, or checking the guides.

Status

DISCLAIMER: The project status is beta. Use it at your own risk. There are some modules not finished yet (e.g: storage and HTTP client) and the API is subject to change any time prior to release 1.0.

It is used in personal not released projects to develop APIs and Web applications.

Performance is not the primary goal, but it is taken seriously. You can check performance numbers in the TechEmpower Web Framework Benchmarks. You can also run the stress tests using JMeter with the hexagon_benchmark/load_test.jmx file.

Tests, of course, are taken into account. This is the coverage grid:

CoverageGrid

The code quality is checked by Codebeat:

codebeat badge

Contribute

If you like this project and want to support it, the easiest way is to give it a star :v:.

If you feel like you can do more. You can contribute to the framework in different ways:

To know what issues are currently open and be aware of the next features you can check the Project Board at Github.

You can ask any question, suggestion or complaint at the project’s Slack channel. And be up to date of project’s news following @hexagon_kt in Twitter.

Thanks to all project’s contributors!

License

The project is licensed under the MIT License. This license lets you use the source for free or commercial purposes as long as you provide attribution and don’t hold any project member liable.

compile "co.there4:hexagon:0.10.8"

Related Libraries

chrome-reactive-kotlin

Headless Chrome DevTools Protocol Client (RxJava2 + Kotlin)

Last updated 3 mins ago

vertx-lang-kotlin

Kotlin lang for Vert.x 3

Last updated 3 mins ago

kara

Kotlin Web Framework for the JVM

Last updated 3 mins ago

kraph

GraphQL request string builder written in Kotlin

Last updated 3 mins ago

tekniq

A framework designed around Kotlin providing a full-featured HTTP Framework, Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, Validations, and more

Last updated 3 mins ago