The main ports are:
- The HTTP server: supports HTTPS, HTTP/2, mutual TLS, static files (serve and upload), forms processing, cookies, sessions, CORS and more.
- The HTTP client: which supports mutual TLS, HTTP/2, cookies, form fields and files among other features.
- Template Processing: allows template processing from URLs (local files, resources or HTTP content) binding name patterns to different engines.
Each of these features or ports may have different implementations called "Adapters".
Hexagon is designed to fit in applications that conform to the Hexagonal Architecture (also called Clean Architecture or Ports and Adapters Architecture). Its design principles also fit into this architecture.
Simple Hello World HTTP example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Hexagon's goals and design principles:
Put you in Charge: There is no code generation, no runtime annotation processing, no classpath based logic, and no implicit behaviour. You control your tools, not the other way around.
Modular: Each feature (Port) or adapter is isolated in its own module. Use only the modules you need without carrying unneeded dependencies.
Pluggable Adapters: Every Port may have many implementations (Adapters) using different technologies. You can swap adapters without changing the application code.
Batteries Included: It contains all the required pieces to make production-grade applications: logging utilities, serialization, resource handling and build helpers.
Kotlin First: Take full advantage of Kotlin instead of just calling Java code from Kotlin. The library is coded in Kotlin for coding with Kotlin. No strings attached to Java (as a Language).
Properly Tested: The project's coverage is checked in every Pull Request. It is also stress-tested at TechEmpower Frameworks Benchmark.
Not in Scope¶
- Kotlin Native: because of the added complexity of Kotlin Native, focus will be set on the JVM platform, native binaries' generation will rely on GraalVM.
- Asynchronous by Coroutines: the goal is to be a Toolkit suited for fast development. On the performance/simplicity trade-off, we'll stick to the first. Async support may come in 3.0 though.
How Hexagon fits in your architecture in a picture.
Using this toolkit won't make your application compliant with Hexagonal Architecture (by its nature, no tool can do that), you have to provide a layer of abstraction by yourself.
Ports with their provided implementations (Adapters).
|HTTP Server||Jetty, Servlet|
|Serialization Formats||JSON, YAML|