The recommended way to use Kotlin/JS is via the
Use cases for Kotlin/JS
There are numerous ways that Kotlin/JS can be used. To provide you some inspiration, here's a non-exhaustive list of scenarios in which you can use Kotlin/JS.
Write frontend web applications using Kotlin/JS
Kotlin/JS allows you to leverage powerful browser and web APIs in a type-safe fashion. Create, modify and interact with elements in the Document Object Model (DOM), use Kotlin code to control the rendering of
canvasor WebGL components, and enjoy access to many more of the features supported in modern browsers.
Write full, type-safe React applications with Kotlin/JS using the
kotlin-wrappersalso provides support for a select number of adjacent technologies like
Write server-side and serverless applications using Kotlin/JS
kotlinx-nodejs, you have typesafe access to the Node.js API directly from your Kotlin code.
Use Kotlin's multiplatform projects to share code with other Kotlin targets
All Kotlin/JS functionality can also be accessed when using the Kotlin
If you have a backend written in Kotlin, you can share common code such as data models or validation logic with a frontend written in Kotlin/JS, allowing you to write and maintain full-stack web applications.
You could also share business logic between your web interface and mobile apps for Android and iOS, and avoid duplicating commonly used functionality like providing abstractions around REST API endpoints, user authentication, or your domain models.
Of course, this is not a complete list of how you can use Kotlin/JS to your advantage, but merely a selection of cherry-picked cases. We invite you to experiment with combinations of these use cases, and find out what works best for your project.
Kotlin/JS, Today and Tomorrow
Want to know more about Kotlin/JS?
In this video, Kotlin Developer Advocate Sebastian Aigner will explain the main Kotlin/JS benefits to you, share some tips and use cases, and also tell you about the plans and upcoming features for Kotlin/JS.
Get started with Kotlin/JS
If you're new to Kotlin, a good first step would be to familiarize yourself with the basic syntax of the language.
Hands-on labs for Kotlin/JS
Hands-on labs are long-form tutorials that help you get to know a technology by guiding you through a self-contained project related to a specific topic.
They include sample projects, which can serve as jumping-off points for your own projects, and contain useful snippets and patterns.
For Kotlin/JS, the following hands-on labs are currently available:
Building Web Applications with React and Kotlin/JS guides you through the process of building a simple web application using the React framework, shows how a typesafe Kotlin DSL for HTML makes it convenient to build reactive DOM elements, and illustrates how to use third-party React components, and how to obtain information from APIs, while writing the whole application logic in pure Kotlin/JS.
Building a Full Stack Web App with Kotlin Multiplatform teaches the concepts behind building an application that targets Kotlin/JVM and Kotlin/JS by building a client-server application that makes use of common code, serialization, and other multiplatform paradigms. It also provides a brief introduction into working with Ktor both as a server- and client-side framework.
New Kotlin/JS IR compiler
To learn more about the available features in the new Kotlin/JS IR compiler and how to try it for your project, visit the documentation.