h alternatives and similar libraries
Based on the "Web" category.
Alternatively, view h alternatives based on common mentions on social networks and blogs.
-
javalin
DISCONTINUED. A simple and modern Java and Kotlin web framework [Moved to: https://github.com/javalin/javalin] -
apollo-android
:rocket: A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform. -
http4k
The Functional toolkit for Kotlin HTTP applications. http4k provides a simple and uniform way to serve, consume, and test HTTP services. -
skrape.it
A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. It aims to be a testing lib, but can also be used to scrape websites in a convenient fashion. -
hexagon
Hexagon is a microservices toolkit written in Kotlin. Its purpose is to ease the building of services (Web applications or APIs) that run inside a cloud platform. -
firefly
Firefly is an asynchronous web framework for rapid development of high-performance web application. -
tekniq
A framework designed around Kotlin providing Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, Validations, and more -
Pellet
An opinionated, Kotlin-first web framework that helps you write fast, concise, and correct backend services 🚀. -
bootique-kotlin
DISCONTINUED. RETIRED. Provides extension functions and features for smooth development with Bootique and Kotlin. -
Zeko-RestApi
Asynchronous web framework for Kotlin. Create REST APIs in Kotlin easily with automatic Swagger/OpenAPI doc generation -
komock
KoMock - Simple HTTP/Consul/SpringConfig http server framework written in Kotlin. Wiremock use cases -
voyager-server-spring-boot-starter
Easily create REST endpoints with permissions (access control level) and hooks includeded
CodeRabbit: AI Code Reviews for Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of h or a related project?
Popular Comparisons
README
h
Html templating library for kotlin.
Get started
Download
- Download the latest release. (View releases)
- Clone the repo for the source code
git clone https://github.com/phenax/h
. - Test it with
./gradlew test
. Generated test report ->build/reports/tests/test
.
Examples
Simple component examples in /examples
Create a component
import io.github.phenax.h.Component
import io.github.phenax.h.Layout
import io.github.phenax.h.node.DOMNode
import io.github.phenax.h.layouts.EmptyLayout
class CardComponent(val myTitle: String): Component() {
// Layout(EmptyLayout is no wrapper. You can use a custom layout)
override val layout = EmptyLayout()
// This renders a div card component
// <div class="card">
// <h1 class="card--title">Card title</h1>
// <p class="card--description">Card description</p>
// </div>
override fun render(): DOMNode {
return div( mapOf( "class" to "card" ),
listOf(
h1( mapOf( "class" to "card--title" ), myTitle),
p( mapOf( "class" to "card--description" ), "Card description" )
)
)
}
}
val helloWorldCard = CardComponent("Hello world")
OR
import io.github.phenax.h.*
fun createCard(myTitle: String) = component {
div( mapOf( "class" to "card" ),
listOf(
h1( mapOf( "class" to "card--title" ), myTitle),
p( mapOf( "class" to "card--description" ), "Card description")
)
)
}
val helloWorldCard = createCard("Hello world")
Create a layout
import io.github.phenax.h.Component
import io.github.phenax.h.Layout
import io.github.phenax.h.node.DOMNode
class HtmlLayout(val title: String = "Moosic"): Layout() {
override fun render(component: AbstractComponent): DOMNode {
return (
html(null, listOf(
head(null, listOf(
h("title", null, listOf( text(title) ) ),
style("/css/style.css"), // External stylesheet
style(null, "html, body { background-color: red; }") // Inline style
)),
body(null, listOf(
div(null, h(component)),
script("/js/script.js", mapOf( "defer" to "defer", "async" to "async" ))
))
))
)
}
}
Use components inside other components
class UserCardComponent(user: User): Component() {
override val layout = EmptyLayout()
override fun render(): DOMNode {
return div(null, listOf(
div(null, listOf( text(user.name) )),
div(null, listOf( text('@' + user.nickname) )),
))
}
}
class UserListComponent(usersList: List<User>): Component() {
override val layout = EmptyLayout()
override fun render(): DOMNode {
return div(null,
usersList.map { user ->
div(null, listOf( h(UserCardComponent(user)) ))
}
)
}
}
Render to html string
val component = CardComponent()
println(component.renderToHtml())
*Note that all licence references and agreements mentioned in the h README section above
are relevant to that project's source code only.