Skip to content

馃殌 Template Request: Kotlin/JS + Ktor starter template with D1聽#1160

Description

@mole828

Describe the stack

Hi! Would a Kotlin/JS + Ktor starter be a good fit for this repository?

I've built an initial prototype:
https://github.com/mole828/ktor-cloudflare-worker

I'd also like to thank my friend for their earlier work on ktor-cloudflare-worker, which was a helpful reference while exploring Ktor on Workers.

The goal is to let Kotlin developers build applications on Workers using familiar Ktor routing and coroutines, with access to Cloudflare bindings. Kotlin compiles to JavaScript; no JVM is required at runtime.

The prototype includes:

A custom adapter between Ktor and the Workers Fetch API.
Server-rendered HTML using kotlinx.html.
Typed environment access and a small suspending D1 query wrapper.
npm commands for building, local development, tests, and Wrangler dry runs.

Application routes use ordinary Kotlin types, while JavaScript interop and Promise handling stay in the platform adapter.

Current status

Local workerd tests and Wrangler dry runs pass. The recorded minified bundle is approximately 402 KiB, or 125 KiB gzipped. The project remains experimental: it requires nodejs_compat, does not implement WebSockets, and has not yet been validated as a deployed Worker or through Workers Builds. It is not an official Ktor engine.

Before preparing a template PR, I'd appreciate feedback on:

Is a Kotlin/JS starter within scope for this collection?
Are there constraints on using the Kotlin Toolchain wrapper during builds, particularly in Workers Builds and template CI?
Would you prefer the custom Ktor adapter to be maintained as a separate dependency, or could it initially live in the template?

If this direction fits, I can prepare a contribution with a deployed preview, English documentation, the required metadata, and Playwright smoke tests.

Thanks!

(translate by ai)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions