Questions about the Javascript API



I thinking of using Kotlin on a couple web app projects. Having a type safe language in place of Javascript is very appealing, but I have a few questions…

  1. Are the Javascript APIs documented somewhere?  The only thing I found is the “kotlin.browser” package listed here [1], but I can’t import that. I was able to import js.dom.html.document, and there appear to be some other packages available under “js”, but I can’t see what’s there.  

  2. Is there an explanation somewhere of how I might use a class on both the client and server side? This comes up in data transfer. In my current web apps, I send an AJAX request, query a relational database, get back a type-safe object representing the result rows, and then send that over the wire as JSON, where I can then get runtime errors in Javascript for trivial type errors like mispelled property names. It’s really annoying, and if there is a way in Kotlin to pass those data objects to the browser and use them there with type safety, I’d start using Kotlin now.

  3. If I need to write a “native” JS method to accomplish #2, I might do it, but again… I need documentation on how to do that. I don’t see any documentation on the Javascript stuff.

I can handle some early adopter pain, but I want to focus mostly on writing an application.




Hi, Robert.

Unfortunately right now we don’t have documentations for that, but You can see code here
And I collected some useful links, I hope this will help you:

We work on new API reference for both backends and big part of current stdlib will be available in the future for JS backend too.

2. I don't know about any project where Kotlin used in both side. In IDEA you can create two unrelated projects and set up a module in each of these using the same source directory, but different targets. Additionally You can try do it by ant or maven build by sharing source dirs between different ant/maven projects.

Anyway feel free to ask any question here or directly me(


Thanks, that will get me started.