Here's a quick summary of everything we released in Q1 2024.

Headless CMS for Kotlin

Hygraph is the ideal Headless CMS for Kotlin applications. Read further to learn how our API-first CMS allows you to add components to your Kotlin apps in minutes and enable your mobile app's content to be managed from a powerful CMS.

Step #1 - Construct your query and fetch the data from Hygraph

In Kotlin, you can use a library like Apollo Android for GraphQL queries, which allows you to fetch and use data efficiently. Below are examples of how you would fetch data from a GraphQL API and then use that data to display it.

Firstly, you will need to define your query in a separate file named FetchProductsQuery.graphql.

// Define your query in FetchProductsQuery.graphql
query FetchProducts {
products {
name
description
slug
availability
imageUrl
}
}
// Then in your Kotlin code, you would run this query:
val apolloClient = ApolloClient.builder()
.serverUrl("https://your-api-endpoint.com/graphql")
.build()
apolloClient.query(FetchProductsQuery())
.enqueue(object : ApolloCall.Callback<FetchProductsQuery.Data>() {
override fun onFailure(e: ApolloException) {
// Handle error
}
override fun onResponse(response: Response<FetchProductsQuery.Data>) {
// Handle response
val products = response.data?.products
// Use this data to display in your UI
}
})

Step #2 - Work with data within Kotlin

Now, to display the fetched data, you would typically use it to update your UI. The example on the left is by using a UI framework Kotlin's Jetpack Compose.

Each product from the provided list is rendered within a Card composable, which gives it a card-like appearance with elevation for depth. Inside each card, a Column composable holds other composables that display the product's name, description, and image.

@Composable
fun DisplayProducts(products: List<Product>?) {
LazyColumn {
items(products ?: emptyList()) { product ->
ProductItem(product)
}
}
}
@Composable
fun ProductItem(product: Product) {
Card(elevation = 4.dp) {
Column(modifier = Modifier.padding(16.dp)) {
Text(text = product.name)
Text(text = product.description)
Image(
painter = rememberImagePainter(product.imageUrl),
contentDescription = product.name
)
Text(text = if (product.availability) "Available" else "Not Available")
}
}
}

Start building with Kotlin

We made it really easy to set up your project in Hygraph and use our GraphQL API within your Kotlin project.

Quickstart

Check out our docs to see how you can quickly set up your Hygraph project and enable the content API for your Kotlin app.

Learn GraphQL

Hygraph is GraphQL-native Headless CMS offers precise data retrieval, minimizing over-fetching and optimizing efficiency.

Examples

Look at some of the example projects to see Hygraph in action.

Why Hygraph

Choosing Hygraph for your Kotlin project

A GraphQL-native headless CMS complements a Kotlin app by offering developers precise data fetching, improving performance, and code maintenance. Content editors benefit from a flexible system allowing real-time updates that seamlessly integrate with the Kotlin app, ensuring efficient content management and focused roles for both developers and editors.

They can update content in real-time, and it will be reflected immediately across all platforms where the Kotlin application is deployed. This separation of concerns ensures that content editors can focus on quality content production while developers concentrate on creating robust Kotlin applications.

kotlin cms

Developer Experience

We try to be the most un-opinionated CMS on the market with a wide collection of open source example projects to get you started.

Headless CMS

As a headless CMS (i.e. API based content management), you can be as modular and flexible as you need. We even support multiplatform content management.

Management API

Hygraph boasts a flexible and powerful management API to manage your content and schema, as well as a blazing fast content API.

Get started for free, or request a demo to discuss larger projects