Bosca / Developers

Extending & automating

Extend it, automate it, script it

Reach past a single request. Run durable background jobs, publish and subscribe to events, cache what's hot, script the platform in Kotlin, and drive all of it from one native CLI.

Jobs & events

Fire work, publish an event

A background job is a definition; an event ties jobs to a name. Calling dispatch() does both — it enqueues the work on a durable, at-least-once queue and publishes the event to whoever's subscribed. And because enqueueing waits for your transaction to commit, a job never runs for a change that rolled back.

  • Durable, at-least-once job queue — NATS or Redis.
  • dispatch() enqueues jobs and publishes an event together.
  • Subscribers receive events as a Kotlin Flow.
  • Enqueue waits for the transaction to commit.
TaskPublished.kt
@JobEvent(jobs = [ReindexTask::class])
class TaskPublished(val id: UUID)

// one call: enqueue the job + publish
TaskPublished(id).dispatch()

Caching

Cache behind one interface

Reach the distributed cache through a single interface and let configuration choose the backend — Redis or a NATS key-value store. The same call works either way, so caching is a decision you make in config, not a dependency baked into your code.

  • One cache interface, Redis or NATS behind it.
  • Chosen by configuration, not by code.
  • The same call, whichever backend runs.
cache
val cache = provide<ServiceCache>()

val feed = cache.get("feed:home")
  ?: build().also { cache.put("feed:home", it) }

Scripting

Automate in Kotlin

For logic that shouldn't ship inside the server, write a Bosca Script — real Kotlin, with typed access to the same services, running inside the platform. Trigger it by hand, on an event, or behind an HTTP endpoint, and version it in Git.

  • Real Kotlin, with typed access to platform services.
  • Run by hand, on an event, or as an HTTP endpoint.
  • Edited, versioned, and compiled inside the platform.
on-publish.bosca.kts
val content = provide<MetadataService>()
val id = context.input.jsonObject["id"]
log.info("handling publish for $id")

The CLI

Drive it from your terminal

The bosca CLI is a single native binary. It talks to the server over a typed GraphQL client generated from the same schema your code uses, and it embeds an MCP server — so the platform is scriptable from your shell and operable by your AI agents through the very same commands.

  • One native binary — bosca.
  • A typed GraphQL client, generated from the schema.
  • Embeds an MCP server for AI agents.
bosca
$ bosca login
$ bosca metadata list
$ bosca mcp-server # embedded MCP server

Keep exploring

More for developers