Introduction: Small code generating library for safe Jetpack Compose navigation with no boilerplate.
More: Author   ReportBugs   

Maven Central

A KSP library to improve Compose Navigation. It uses KSP to generate some code which uses Compose Navigation under the hood to make everything happen. For a deeper look into all the features, check our wiki(🚧).

Table of contents


  1. Annotate your screen Composables with @Destination:
fun ProfileScreen() { /*...*/ }
  1. Simply add navigation arguments to the function declarations:
fun ProfileScreen(
    id: Int
) { /*...*/ }

Default values are also allowed. They will become optional to navigate to this destination.

  1. Use the generated [ComposableName]Destination.withArgs method to navigate to them:
fun SomeOtherScreen(
    navigator: DestinationsNavigator
) {
    navigator.navigate(ProfileScreenDestination.withArgs(id = 7))

You may need to build the project so that you can import the generated Destinations (like the above ProfileScreenDestination)

  1. Finally, add the NavHost somewhere:

This call will automatically add all annotated Composable functions as destinations of the Navigation Graph. Destinations.Scaffold is also available if you're using Compose Material. It will also include all destinations in its builder block.

That's it! No need to worry about routes, NavType, bundles and strings. All that redundant and error-prone code gets generated for you.


Compose destinations is available via maven central.

  1. Add the ksp plugin:

    plugins {
     id("") version "1.5.31-1.0.0"
  2. Add the dependencies: ```gradle implementation 'io.github.raamcosta.compose-destinations:core:0.8.4-alpha05' ksp 'io.github.raamcosta.compose-destinations:ksp:0.8.4-alpha05'

// official compose navigation implementation 'androidx.navigation:navigation-compose:$compose_navigation_version'

Official Compose Navigation is required.
If you're using Compose Material, Accompanist Navigation-Animation and/or
Accompanist Material (aka BottomSheet, currently), Compose Destinations has you covered. <br/>
Check our [wiki]( to know more. <br/>
Each [release]( contains a list of versions known to be compatible.

3. And finally, you need to make sure the IDE looks at the generated folder.
See KSP related [issue](
An example for the debug variant would be:
sourceSets {
    main {

Current state

This lib is still in its alpha stage, APIs can change. I'm looking for all kinds of feedback, issues, feature requests and help in improving the code. So please, if you find this interesting, try it out in some sample projects and let me know how it goes!


Copyright 2021 Rafael Costa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
About Me
GitHub: Trinea
Facebook: Dev Tools