Hexagon
The atoms of your platform
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:
- 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.
- 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:
- To be the fastest framework. Write the code fast and optimize only the critical parts. It is not slow anyway.
- 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.
- To be usable from Java. Hexagon is Kotlin first.
Quick Start
- Configure Kotlin in Gradle or Maven.
- Setup the JCenter repository (follow the link and click on the
Set me up!
button). - Add the dependency:
-
In Gradle. Import it inside
build.gradle
:compile ("com.hexagonkt:server_jetty:0.22.12")
-
In Maven. Declare the dependency in
pom.xml
:<dependency> <groupId>com.hexagonkt</groupId> <artifactId>server_jetty</artifactId> <version>0.22.12</version> </dependency>
-
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"]}!" } } }
-
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:
The code quality is checked by Codebeat:
Contribute
If you like this project and want to support it, the easiest way is to give it a star
If you feel like you can do more. You can contribute to the framework in different ways:
- By using it and spreading the word.
- Giving feedback by Twitter or Slack.
- Requesting new features or submitting bugs.
- Voting for the features you want in the issue tracker (using reactions).
- And... Drum roll... Submitting code or documentation.
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.