{"id":17651144,"url":"https://github.com/jeziellago/multinavcompose","last_synced_at":"2025-08-10T12:21:29.336Z","repository":{"id":126467741,"uuid":"373542507","full_name":"jeziellago/multinavcompose","owner":"jeziellago","description":"Android multi-module navigation built on top of Jetpack Navigation Compose","archived":false,"fork":false,"pushed_at":"2021-06-04T14:12:48.000Z","size":118,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T07:09:40.048Z","etag":null,"topics":["jetpack-android","jetpack-compose","jetpack-navigation","kotlin","kotlin-android","kotlin-library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeziellago.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-03T14:47:24.000Z","updated_at":"2023-05-18T14:19:26.000Z","dependencies_parsed_at":"2023-06-16T22:15:06.846Z","dependency_job_id":null,"html_url":"https://github.com/jeziellago/multinavcompose","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jeziellago/multinavcompose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeziellago%2Fmultinavcompose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeziellago%2Fmultinavcompose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeziellago%2Fmultinavcompose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeziellago%2Fmultinavcompose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeziellago","download_url":"https://codeload.github.com/jeziellago/multinavcompose/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeziellago%2Fmultinavcompose/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269721683,"owners_count":24464542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jetpack-android","jetpack-compose","jetpack-navigation","kotlin","kotlin-android","kotlin-library"],"created_at":"2024-10-23T11:40:26.493Z","updated_at":"2025-08-10T12:21:29.327Z","avatar_url":"https://github.com/jeziellago.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MultiNavCompose \u003cimg src=\".github/static/navigation.png\" alt=\"logo\" width=\"50px\"/\u003e\n[![GitHub license](https://img.shields.io/github/license/jeziellago/compose-markdown?style=for-the-badge)](https://github.com/jeziellago/compose-markdown/blob/main/LICENSE) [![ktlint](https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg?style=for-the-badge)](https://ktlint.github.io/) [![Android API](https://img.shields.io/badge/api-21%2B-brightgreen.svg?style=for-the-badge)](https://android-arsenal.com/api?level=21) ![JitPack](https://img.shields.io/jitpack/v/github/jeziellago/multinavcompose?color=blue\u0026style=for-the-badge)\n\nAndroid library for multi-module navigation built on top of Jetpack Navigation Compose.\n\u003e The goal of this library is to simplify the setup for multi-module navigation with [Jetpack Navigation Compose](https://developer.android.com/jetpack/compose/navigation).\n\n## Setup\nAdd `jitpack.io` url as maven repository:\n```  \nrepositories {  \n\t...  \n\tmaven { url 'https://jitpack.io' }  \n}    \n```  \nAdd dependency into `build.gradle`:\n```groovy  \ndependencies {  \n    implementation 'com.github.jeziellago:multinavcompose:TAG'  \n}  \n```\n\n## 1. Create a NavComposableModule\nMake your composables internal and expose only a `NavComposableModule` for each module.\n```kotlin  \n// module :posts  \nval postsNavModule = NavComposableModule { graph, navController -\u003e  \n    graph.composable(POSTS_ROUTE) {  \n        PostsScreen(onClick = { postId -\u003e  \n            navController.navigate(\"$POST_DETAIL_ROUTE/$postId\")  \n        })  \n    }  \n}  \n```\n#### You also can have nested graphs:\n```kotlin  \n// module :posts  \nval postsNavModule = NavComposableModule { graph, navController -\u003e  \n\tgraph.navigation(startDestination = POSTS_ROUTE, route = POSTS) { \n\t    composable(POSTS_ROUTE) {  \n\t        PostsScreen(onClick = { postId -\u003e  \n\t            navController.navigate(\"$POST_DETAIL_ROUTE/$postId\")  \n\t        })  \n\t     }\n\t     ...\n    }\n}  \n```\n\n## 2. Register the NavComposeModule`s\n### Single NavHost\nCall `multiNavModules` and put all the NavComposeModule's.\n\u003e For single activity applications (and only a `NavHost`) you should register the NavComposeModule  in `onCreate` on Application.\n```kotlin  \nclass MyApplication : Application() {  \n  \n    override fun onCreate() {  \n        super.onCreate()  \n        // Register all NavComposeModules  \n        multiNavModules(homeNavModule, postsNavModule, postDetailNavModule)  \n    }  \n}  \n```\n### Multiple NavHost's\nIf you have multiple `NavHost`'s, a `key` is required on registering each of them:\n```kotlin\n// feed nav graph\nmultiNavModules(feedNavModule) { FEED_GRAPH }\n\n// posts nav graph\nmultiNavModules(postsNavModule, postDetailNavModule) { POST_GRAPH }\n```\n## 3. Setup on NavHost\nThe `loadMultiNavComposables` loads the composables into `NavHost`.\n### Single NavHost\n```kotlin\nNavHost(navController = navController, startDestination = HOME) {  \n  loadMultiNavComposables(navController)  \n}\n```\n### Multiple NavHost\nIf you have multiple `NavHost`'s, a `key` is required too (see `POSTS_GRAPH`).\n```kotlin\nNavHost(navController = navController, startDestination = POSTS_ROUTE) {  \n  loadMultiNavComposables(navController, POSTS_GRAPH)  \n}\n```\n# License\n```  \nCopyright (c) 2021 Jeziel Lago  \n  \nPermission is hereby granted, free of charge, to any person obtaining  \na copy of this software and associated documentation files (the  \n\"Software\"), to deal in the Software without restriction, including  \nwithout limitation the rights to use, copy, modify, merge, publish,  \ndistribute, sublicense, and/or sell copies of the Software, and to  \npermit persons to whom the Software is furnished to do so, subject to  \nthe following conditions:  \n  \nThe above copyright notice and this permission notice shall be  \nincluded in all copies or substantial portions of the Software.  \n  \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,  \nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  \nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  \nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE  \nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION  \nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  \nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeziellago%2Fmultinavcompose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeziellago%2Fmultinavcompose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeziellago%2Fmultinavcompose/lists"}