Tegral 0.0.4
A collection of reusable Kotlin libraries and frameworks, and a web framework that ties them together.
class AppController : KtorController() {
override fun Routing.install() {
get("/hello") {
call.respond("Hello World!")
}
}
}
fun main() {
tegral {
put(::AppController)
}
}
Tegral libraries
Integrable, reusable and documented. Everything you need to perfect your Kotlin app foundations.
Tegral DI
A powerful and testable dependency injection framework for building all kinds of apps.
class Controller
class Service(scope: InjectionScope) {
private val controller: Controller by scope()
}
tegralDi {
put(::Controller)
put(::Service)
}
Tegral OpenAPI
Create OpenAPI specs in Kotlin and serve Swagger UI. Can be used stand-alone, with Ktor or with Tegral Web.
data class Greeting {
val recipient: String
}
get("/hello") {
call.respond(Greeting("You"))
} describe {
summary = "Greet someone"
200 response {
json { schema<Greeting>(Greeting("Hi!")) }
}
}
Tegral Web
The Kotlin-est way to build back-end applications. Make use of the entire Tegral stack in a simple, cohesive experience.
// NOTE: this syntax is not available yet.
fun Routing.greeter() {
get("/hello") {
call.respond("Hello World!")
}
}
fun main() {
tegral {
put(Routing::greeter)
}
}
Tegral Niwen
Create simple lexers and parsers with Tegral Niwen's handy DSL. A good fit for prototyping, toy projects or simple languages.
enum class MyTokenTypes : LixyTokenType {
DOT, WORD, WHITESPACE
}
val lexer = niwenLexer {
state {
"." isToken DOT
anyOf(" ", "\n", "\t") isToken WHITESPACE
matches("[A-Za-z]+") isToken WORD
}
}
Tegral PrismaKTExperimental
Use Prisma in your Kotlin applications. Generate JetBrains Exposed bindings for your databases for an awesome Prisma + Kotlin experience.
// schema.prisma
model Person {
id Int
name String
}
// prismakt/generated/MyTable.kt
public object PersonTable : IdTable<Int>(name = "Person") {
public override val id = integer("id").entityId()
public val name = varchar("name")
}