matthieucoisne/YelpExplorer-CMP

GitHub: matthieucoisne/YelpExplorer-CMP

这是一个基于 Compose Multiplatform 的 Yelp 商家探索应用,旨在演示 Clean Architecture 下 REST 与 GraphQL 数据源的灵活切换及现代 Android 开发最佳实践。

Stars: 11 | Forks: 2

# YelpExplorer-CMP [![build](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/cccbbd7c3a222222.svg)](https://github.com/matthieucoisne/YelpExplorer-CMP/blob/main/.github/workflows/build.yml) [![Kotlin Version](https://img.shields.io/badge/Kotlin-2.3.0-blue.svg)](https://kotlinlang.org) [![API](https://img.shields.io/badge/API-36%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=36) ## 项目描述 YelpExplorer-CMP 是一个 Compose MultiPlatform 项目,它展示商家列表、商家详情以及最新评论,使用的是 [Yelp](https://www.yelp.com/) 的 API。 我最初创建这个项目是为了学习 GraphQL,但由于 Yelp 也通过 REST API 提供数据, 我认为这是一个展示 Clean Architecture 强大功能的绝佳机会,即能够在不修改领域层和展示层的情况下 轻松替换一个数据层。 随后,我认为将这个 Compose MultiPlatform 项目移植到 Flutter 和 ReactNative 将是一次很棒的体验,以便更多地 了解用于构建多平台应用程序的各种不同技术。 该项目目前提供以下版本:
[Compose Multiplatform/Kotlin](https://github.com/matthieucoisne/YelpExplorer-CMP)
[Flutter/Dart](https://github.com/matthieucoisne/YelpExplorer-Flutter)
[ReactNative/TypeScript](https://github.com/matthieucoisne/YelpExplorer-ReactNative)
### 截图 | 商家列表 | 商家详情 | |:-------------:|:----------------:| |![YelpExplorer - Business List](https://github.com/matthieucoisne/YelpExplorer/blob/main/media/YelpExplorer-KMP-BusinessList.png) | ![YelpExplorer - Business Details](https://github.com/matthieucoisne/YelpExplorer/blob/main/media/YelpExplorer-KMP-BusinessDetails.png)| ## 项目特性 * 100% [Kotlin](https://kotlinlang.org/) * 现代化架构(Clean Architecture、Model-View-Intent、依赖注入) * 使用 [Jetpack Compose](https://developer.android.com/jetpack/compose) 的声明式 UI 框架 * 基于 Coroutine Flows 的响应式流 * 测试 * Material Design * 使用 GitHub [Actions](https://github.com/matthieucoisne/YelpExplorer-CMP/actions) 进行持续集成 * 使用 GitHub [Project Board](https://github.com/matthieucoisne/YelpExplorer-CMP/projects/1) 进行项目管理 ## 技术栈 * 技术栈 * [Kotlin](https://kotlinlang.org) * [Coroutines](https://kotlinlang.org/docs/coroutines-overview.html) * [Flow](https://kotlinlang.org/docs/flow.html) * [Koin](https://github.com/InsertKoinIO/koin) * [Ktor](https://ktor.io) * [ApolloGraphQL](https://github.com/apollographql/apollo-android) * [Jetpack](https://developer.android.com/jetpack) * [Navigation](https://developer.android.com/guide/navigation) * [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel) * [Compose](https://developer.android.com/jetpack/compose) * [Coil](https://github.com/coil-kt/coil) * [以及更多...](https://github.com/matthieucoisne/YelpExplorer-CMP/blob/main/composeApp/build.gradle.kts) * 架构 * Clean Architecture * MVI * [Modern Android Architecture](https://developer.android.com/topic/architecture#recommended-app-arch) ## 开发环境设置 ### Yelp API Key 如果你想在设备或模拟器上运行此项目,你需要从 Yelp 获取你自己的 API 密钥并将其 提供给应用程序。 1. 申请你的 API 密钥:[https://www.yelp.com/developers/documentation/v3/authentication](https://www.yelp.com/developers/documentation/v3/authentication)
2. 使用你的密钥更新 [Const.kt](https://github.com/matthieucoisne/YelpExplorer-CMP/blob/main/composeApp/src/commonMain/kotlin/cmp/yelpexplorer/core/utils/Const.kt) ### REST vs GraphQL 该项目允许你使用 GraphQL API 或 REST API 来获取数据。
要在两者之间切换,你可以更改 [Const.kt](https://github.com/matthieucoisne/YelpExplorer-CMP/blob/main/composeApp/src/commonMain/kotlin/cmp/yelpexplorer/core/utils/Const.kt) 中 `DATASOURCE` 的值。 ## 作者 [![Follow me](https://img.shields.io/twitter/follow/matthieucoisne?style=social)](https://x.com/matthieucoisne) ## 许可证 ``` Copyright 2019-Present Matthieu Coisne 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 http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```
标签:Android, API集成, Clean Architecture, Compose Multiplatform, Coroutines, DNS解析, DSL, Flow, GraphQL, iOS, Jetpack Compose, Kotlin, Kotlin Multiplatform, Model-View-Intent, MVI, REST API, Syscall, Web开发, Yelp API, 依赖注入, 单元测试, 可观测性, 开源项目, 数据层对比, 整洁架构, 桌面应用, 移动应用, 跨平台开发