{"id":20823209,"url":"https://github.com/pink-room/kotlin-multiplatform-template","last_synced_at":"2025-08-01T08:41:52.039Z","repository":{"id":74521810,"uuid":"143859230","full_name":"pink-room/kotlin-multiplatform-template","owner":"pink-room","description":"Kotlin Multiplatform Template","archived":false,"fork":false,"pushed_at":"2019-10-27T16:30:18.000Z","size":1921,"stargazers_count":197,"open_issues_count":2,"forks_count":26,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-31T12:03:05.254Z","etag":null,"topics":["android","backend","gradle","ios","js","kotlin","multiplatform","swift","web"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pink-room.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":"2018-08-07T10:43:20.000Z","updated_at":"2025-01-22T07:29:35.000Z","dependencies_parsed_at":"2023-02-26T04:18:24.718Z","dependency_job_id":null,"html_url":"https://github.com/pink-room/kotlin-multiplatform-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pink-room%2Fkotlin-multiplatform-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pink-room%2Fkotlin-multiplatform-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pink-room%2Fkotlin-multiplatform-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pink-room%2Fkotlin-multiplatform-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pink-room","download_url":"https://codeload.github.com/pink-room/kotlin-multiplatform-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252918514,"owners_count":21825123,"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","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":["android","backend","gradle","ios","js","kotlin","multiplatform","swift","web"],"created_at":"2024-11-17T22:17:40.066Z","updated_at":"2025-05-07T16:48:35.182Z","avatar_url":"https://github.com/pink-room.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003e\n  \u003cimg src=\"multiplatform_template.png\" alt=\"Kotlin Multiplatform Template\" /\u003e\n\u003c/h3\u003e\n\n\u003e This is a **Kotlin Multiplatform** starter template inspired by **Clean Architecture** and the\n**MVP** pattern.\n\nCurrently we are using [IntellijIDEA](https://www.jetbrains.com/idea/) as the **main IDE**. However,\nthe **Android client** was developed in [Android Studio](https://developer.android.com/studio/)\nand the **iOS client** with [Xcode](https://developer.apple.com/xcode/).\n\n[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20this%20Kotlin%20Multiplatform%20starter%20template!\u0026url=https%3A%2F%2Fgithub.com%2Fpink-room%2Fkotlin-multiplatform-template\u0026via=apinkroom\u0026hashtags=kotlin,multiplatform,android,ios,web,developers)\n\n-------\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#architecture\"\u003eArchitecture\u003c/a\u003e \u0026bull;\n    \u003ca href=\"#backend\"\u003eBackend\u003c/a\u003e \u0026bull;\n    \u003ca href=\"#web\"\u003eWeb\u003c/a\u003e \u0026bull;\n    \u003ca href=\"#android\"\u003eAndroid\u003c/a\u003e \u0026bull;\n    \u003ca href=\"#ios\"\u003eiOS\u003c/a\u003e\n\u003c/p\u003e\n\n-------\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/pink-room/kotlin-multiplatform-template/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/pink-room/kotlin-multiplatform-template.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Why?\n\nThis project started because we wanted to test the power of Kotlin Multiplatform. As opposed to\nother cross-platform approaches, Kotlin **doesn't want you to write your code once** and **compile**\nit to **multiple platforms**. Instead, it focus on **sharing** the part of the code that\ncontains **logic** and **left** the **platform specific** part to be implemented **natively**\nusing its **specific SDK's**.\n\nAlthough this may look like a dream, Kotlin Multiplatform is still on the **early days** and we\nquickly realised how difficult is to find concise documentation to setup and build such a project.\n\nWith this in mind, we decided to write this \"easy\" and small template that we think that might be\nuseful if you want to start a multiplatform project. Please **note** that this project will\n**evolve** according to the **maturity** of the Kotlin multiplatform **support**, **tools** and\n**libraries**. 🙂\n\n## Architecture\n\nThe **architecture** of this project is composed by one **common module** and its **platform specific** implementations\n(jvm, js and ios). A **common-client** module and the **platform specific** modules. One **backend** and three\n**clients** (android, ios and web).\n\n\u003ch3 align=\"center\"\u003e\n  \u003cimg src=\"architecture.png\" alt=\"Project Architecture\" /\u003e\n\u003c/h3\u003e\n\n- **common**: Contains all the **common code** shared between the modules. In this case are only the **data** models.\n- **common-jvm/js/ios**: Where the **common platform specific** implementations are placed.\n- **common-client**: Where the **clients common** code is implemented. Such as the **business** and **presentation**\nlogic.\n- **common-client-jvm/js/ios**: Responsible for the **common client specific** implementations.\n- **backend**: Contains the **server** logic and a REST API.\n- **android**: Responsible for the **android** clients. Contains a **mobile** module but you can add\nothers (e.g.: **wear**).\n- **ios**: The **iOS** client!\n- **web**: The **web client** that runs in the browser.\n\nHow everything is connected?\n\nThis project uses [Gradle](https://gradle.org/) that is responsible to **build** and **connect** all the modules.\n\nThe **common** module contains only the data models since it's the only code that we want to share between the\n**backend** and the **client** modules.\n\nBut, what if this **common** module needs specific implementations for each platform? This's why we have the\n**common-jvm**, **common-js** and **common-ios** platform modules. They are connected with the **common** module by an\n**expectedBy** dependency and implement the **actual** classes that are **expected** in the **common** module\n(e.g.: date, etc...).\n\nThe **common-client** module is responsible to implement the repositories, use cases and presenters. This is the code\nthat we want to share only between clients. And, again, if we want to implement platform specific parts\n(e.g.: coroutines dispatcher, etc...) we have the **common-client-jvm**, **common-client-js** and **common-client-ios**\nplatform modules.\n\nThe other modules **(android, ios, and web)** use the **common-client** modules by **compiling** the platform specific\nmodule. And, since we are using the MVP pattern, clients only need to implement the **View** part that is specific for\neach platform.\n\nFinally, the **backend** module is connected with the common code by **compiling** the **common-jvm** module.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\u003ci\u003e\u003cb\u003eNote:\u003c/b\u003e This architecture was designed to work with both \u003cb\u003ebackend\u003c/b\u003e and \u003cb\u003eclients\u003c/b\u003e. If you \u003cb\u003eonly\u003c/b\u003e\nwant to implement a \u003cb\u003emultiplatform\u003c/b\u003e project with \u003cb\u003eclients\u003c/b\u003e (probably the most common use case), you can\n\u003cb\u003emerge\u003c/b\u003e the \u003cb\u003ecommon\u003c/b\u003e modules with the \u003cb\u003ecommon-client\u003c/b\u003e modules. Moreover, don't forget to \u003cb\u003eremove\u003c/b\u003e\nthe \u003cb\u003eplatform\u003c/b\u003e specific modules if you will not implement modules which use that \u003cb\u003eplatform\u003c/b\u003e.\u003c/i\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Backend\n\nThe backend is implemented using the [ktor](http://ktor.io/) framework.\n\nTo run it, simply execute `./gradlew :backend:run` in the root of the project and the server will \nstart listening at [localhost:8080](http://localhost:8080).\n\nYou can test it by opening the [memes route](http://localhost:8080/memes) in your browser.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\u003ci\u003eSince the server will run in your localhost, I suggest you to use \u003ca href=\"https://ngrok.com/\"\u003engrok\u003c/a\u003e to\nexpose your local server to a public URL. \u003cb\u003eDon't forget to change the server host in the ApiUtils.kt.\u003c/b\u003e\u003c/i\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Android\n\n\u003ch3 align=\"center\"\u003e\n  \u003cimg src=\"android.png\" alt=\"Android Screens\" /\u003e\n\u003c/h3\u003e\n\nIf you are used to **Android Studio** you can open the project on it and run the **mobile** module.\n\nOtherwise, use **gradle** to assemble the app: `./gradlew :android:mobile:assembleDebug`.\n\nAnd install it via **adb**: `adb install android/mobile/build/outputs/apk/debug/mobile-debug.apk`.\n\n## iOS\n\n\u003ch3 align=\"center\"\u003e\n  \u003cimg src=\"ios.png\" alt=\"iOS Screens\" /\u003e\n\u003c/h3\u003e\n\nTo run the iOS module you need to have the [Xcode](https://developer.apple.com/xcode/) and the\n[CocoaPods](https://guides.cocoapods.org/) installed.\n\nTo install [CocoaPods](https://guides.cocoapods.org/) simply run: `sudo gem install cocoapods`.\n\nThen, install the dependencies: `pod install`.\n\nAfter that, double click on the **ios.xcworkspace** file to open the project.\n\nNow, before running the project you also need to build the **common-client-ios** module:\n`./gradlew :common-client-ios:build`.\n\nThen, build the project by clicking in the **run** button. This will build and run the iOS project in an emulator.\n\n## Web\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\u003ci\u003e\u003cb\u003eNote:\u003c/b\u003e Currently the web module is not working since we are waiting for \u003ca href=\"http://ktor.io/\"\u003ektor\u003c/a\u003e to\nrelease the JS client.\u003c/i\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003ch3 align=\"center\"\u003e\n  \u003cimg src=\"web.png\" alt=\"Web Screen\" /\u003e\n\u003c/h3\u003e\n\nTo build the web client we use the [Kotlin Frontend Plugin](https://github.com/Kotlin/kotlin-frontend-plugin).\n\nCurrently, we are only using **Kotlin/JS** in order to manipulate the DOM. However, you can easily\nuse this plugin to write your UI in [React](https://reactjs.org/).\n\nRun it with `./gradlew :web:run` and then open it on your [browser](http://localhost:8088).\n\n## Credits\n\nThis project wouldn't be possible without the help of the community and other amazing open source\nprojects. Here are some really good examples that you can also look at:\n\n- https://github.com/MarcinMoskala/KotlinAcademyApp\n- https://github.com/ktorio/ktor-samples\n- https://github.com/jetbrains/kotlinconf-app\n- https://github.com/damboscolo/kotlin-native-multiplatform\n- https://github.com/Albert-Gao/kotlin-native-mobile-multiplatform-example\n- https://github.com/jetbrains/kotlinconf-spinner\n\n## To Do\n\n- Dependency Injection\n- Tests\n- JS Http Client ([ktor](http://ktor.io/) will publish a client soon...)\n- Add a DB\n- Share Images / Resources\n- Improve gradle configurations\n- More...\n\n## License\n\n    Copyright 2018 Pink Room, Lda.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpink-room%2Fkotlin-multiplatform-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpink-room%2Fkotlin-multiplatform-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpink-room%2Fkotlin-multiplatform-template/lists"}