Skip to content
rocketramanPublic

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

350 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bootable

Maven Central GitHub license

A simple, unopinionated framework for booting Kotlin applications. It handles starting, stopping, lifecycle management, logging, configuration, and other basic reusable components, and then gets out of your way.

Key points

  • No DI framework in the core. Bootable runs two sets, your application’s services and its lifecycle controllers, and how you assemble them is your choice: by hand, with Bootable’s optional bindings for Kodein, Metro, or, experimentally, Inara, or with any other DI.

  • Explicit, not discovered. No classpath scanning, no auto-configuration, and no annotations that change what code does: a module does nothing until you wire it.

  • A lifecycle on coroutines. Services start and stop in suspending functions, in phases and after the milestones they declare, and their background work runs in scopes of their own, so nothing outlives the application.

  • Libraries, used directly. Optional modules set up well-chosen libraries for the common case, and expose their own types rather than wrapping them: Hoplite for configuration, Log4j2 for logging, HikariCP, Flyway, and Exposed for databases, Ktor for HTTP servers and clients, db-scheduler for persistent tasks, and OpenTelemetry for traces and metrics. Liveness and readiness probes, periodic work, and leader election through a Kubernetes Lease come with them.

  • Testing without booting. Helpers for a test clock, captured logs, the start plan, and in-memory telemetry, for fast unit tests with no application booted.

The documentation covers Bootable’s philosophy, and how it compares with Spring Boot.

Quick start

Add the core module:

dependencies {
  implementation("com.github.rocketraman.bootable:boot:<version>")
}

Implement your services, and boot them:

class Greeter : AppService {
  override suspend fun start() = println("hello")
}

fun main() = boot {
  Bootable(setOf(Greeter()))
}

boot initializes logging, starts the services, runs until the process is signalled to stop, and then stops them cleanly. Add modules for what your application uses; the documentation covers each, with its code in each wiring style.

Examples

The examples directory has runnable applications, from the smallest, one service wired each of the four ways, to a Ktor server with a database, telemetry, health probes, and background work.

TODOs

  • ❏ Multiple logging implementations for different scenarios, loggingInit via ServiceLoader?

  • ❏ Create a boot-server-http-ktor-cohort module using Cohort

  • ❏ Update the ktor example to integrate Kompendium — this is outside the scope of Bootable, but it would be a good example of how to integrate Bootable with other libraries

  • ❏ Make multiplatform — some modules are backend only e.g. Hoplite, Log4j2, but others could easily be adapted for multiplatform usage

  • ❏ Integrate more useful modules

Author

Raman Gupta <rocketraman@gmail.com>

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages