How, and where, can we use Kotlin to develop backend services? To answer this, we could examine where can we use Java to write backend services. Java has long since been a popular choice for building backend applications, and because Kotlin targets the same JVM, we can deploy Kotlin services using similar frameworks and deployment methods.
Perhaps most popular is Spring, which has long been a go-to choice for Java developers when building enterprise applications. Today, this also includes Spring Boot and Spring Cloud, which aim to make it even easier to build individual services, or even an entire microservices architecture. When building with Spring, we can take advantage of Kotlin's popular language features while leveraging the tooling and architecture principles Spring provides. Starting with Spring 5.0, it's possible to generate a Spring project with Kotlin support by default.
Another framework that can enable us to build backend services with Java, Kotlin, and several other languages is Vert.x. Vert.x helps developers build scalable, reactive services around non-blocking, event-driven programming. Using Vert.x with Kotlin feels very natural as it provides idiomatic APIs for all supported languages.
To host our Kotlin services, we can generally turn to any service that hosts JVM applications. This includes popular options such as Amazon Web Services, Google Cloud Platform, and Heroku. The actual deployment process will vary based on which frameworks you're using to build your service and the platform to which you're deploying.
With existing frameworks such as Spring and Vert.x that support multiple languages, why would we want to choose Kotlin to develop our backend services? We're going to explore this question in the following section.