|
| 1 | +--- |
| 2 | +title: Modules |
| 3 | +--- |
| 4 | + |
| 5 | +Apollo Kotlin is highly modular, making it easy to only include the features that you use and exclude the others, keeping your binary size and compile times small. |
| 6 | + |
| 7 | +All the modules are documented in the [KDoc API reference](https://apollographql.github.io/apollo-kotlin/kdoc/) |
| 8 | + |
| 9 | +## Main modules |
| 10 | + |
| 11 | +### apollo-annotations |
| 12 | + |
| 13 | +`apollo-annotations` is a very small module that contains `@ApolloExperimental` and other annotations mainly useful for handling API lifecycle. |
| 14 | + |
| 15 | +It is an API dependency of most of the other modules. |
| 16 | + |
| 17 | +### apollo-api |
| 18 | + |
| 19 | +`apollo-api` contains the bare minimum symbols to compile the generated code and parse responses. |
| 20 | + |
| 21 | +It does not contain any networking or caching code. For a more complete artifact, see `apollo-runtime`. |
| 22 | + |
| 23 | +See ["Using the models without apollo-runtime"](https://www.apollographql.com/docs/kotlin/advanced/no-runtime) for how to use `apollo-api`. |
| 24 | + |
| 25 | +### apollo-ast |
| 26 | + |
| 27 | +`apollo-ast` contains code to parse GraphQL documents and manipulate their Abstract Syntax Tree. |
| 28 | + |
| 29 | +See ["Apollo AST"](https://www.apollographql.com/docs/kotlin/advanced/apollo-ast) for how to use `apollo-ast`. |
| 30 | + |
| 31 | +### apollo-compiler |
| 32 | + |
| 33 | +`apollo-compiler` is the low level compiler API used by apollo-gradle-plugin. |
| 34 | + |
| 35 | +`apollo-compiler` uses [JavaPoet](https://github.com/square/javapoet) and [KotlinPoet](https://github.com/square/kotlinpoet) to generate Java and Kotlin models from GraphQL operations. |
| 36 | + |
| 37 | +`apollo-compiler` is usually consumed through Gradle or Maven plugins. It also contains `ApolloCompilerPlugin`. |
| 38 | + |
| 39 | +See ["Apollo Compiler plugins"](https://www.apollographql.com/docs/kotlin/advanced/compiler-plugins) for how to develop compiler plugins. |
| 40 | + |
| 41 | +### apollo-debug-server |
| 42 | + |
| 43 | +`apollo-debug-server` is a server that serves your normalized cache to the IntelliJ/Android Studio plugin. |
| 44 | + |
| 45 | +### apollo-gradle-plugin |
| 46 | + |
| 47 | +`apollo-gradle-plugin` contains the Apollo Gradle plugin. |
| 48 | + |
| 49 | +This module shadows and relocates its runtime dependencies to avoid classpath issues. This can make debugging harder in some cases. |
| 50 | + |
| 51 | +See `apollo-gradle-plugin-external` for a version of `apollo-gradle-plugin` that does not shadow its dependencies. |
| 52 | + |
| 53 | +See ["Gradle Plugin Configuration"](https://www.apollographql.com/docs/kotlin/advanced/plugin-configuration/) for how to use the Gradle plugin. |
| 54 | + |
| 55 | +### apollo-gradle-plugin-external |
| 56 | + |
| 57 | +`apollo-gradle-plugin-external` contains the Apollo Gradle plugin. |
| 58 | + |
| 59 | +This module does not shadow its runtime dependencies, making it more prone to Gradle classpath issues. |
| 60 | + |
| 61 | +See `apollo-gradle-plugin` for a version of `apollo-gradle-plugin-external` that shadow its dependencies. |
| 62 | + |
| 63 | +See ["Gradle Plugin Configuration"](https://www.apollographql.com/docs/kotlin/advanced/plugin-configuration/) for how to use the Gradle plugin. |
| 64 | + |
| 65 | +### apollo-http-cache |
| 66 | + |
| 67 | +apollo-http-cache is a HTTP cache for your GraphQL operations. Compared to a regular HTTP cache, it also caches POST requests. |
| 68 | + |
| 69 | +See ["HTTP cache"](https://www.apollographql.com/docs/kotlin/caching/http-cache) for how to use the HTTP cache |
| 70 | + |
| 71 | +### apollo-normalized-cache |
| 72 | + |
| 73 | +`apollo-normalized-cache contains` `ApolloStore` and `ApolloCacheInterceptor`. It bridges `ApolloClient` and `ApolloNormalizedCache`. |
| 74 | + |
| 75 | +See ["Normalized Caches"](https://www.apollographql.com/docs/kotlin/caching/normalized-cache#in-memory-cache) for how to use the normalized cache. |
| 76 | + |
| 77 | +### apollo-normalized-cache-api |
| 78 | + |
| 79 | +`apollo-normalized-cache-api` is the low-level cache. It knows nothing about coroutines and/or `apollo-runtime` and contains a memory implementation of `NormalizedCache`. |
| 80 | + |
| 81 | +Most of the time, use `apollo-normalized-cache` instead. |
| 82 | + |
| 83 | +See ["Normalized Caches"](https://www.apollographql.com/docs/kotlin/caching/normalized-cache#in-memory-cache) for how to use the normalized cache. |
| 84 | + |
| 85 | +### apollo-normalized-cache-sqlite |
| 86 | + |
| 87 | +`apollo-normalized-cache-sqlite` contains an implementation of `NormalizedCache` that uses SQLite to persist the data across app restarts. |
| 88 | + |
| 89 | +See ["Normalized Caches"](https://www.apollographql.com/docs/kotlin/caching/normalized-cache#in-memory-cache) for how to use the normalized cache. |
| 90 | + |
| 91 | +### apollo-runtime |
| 92 | + |
| 93 | +`apollo-runtime` contains `ApolloClient`, networking code to execute your queries and subscriptions. This is the main entry point. |
| 94 | + |
| 95 | +See ["Get Started"](https://www.apollographql.com/docs/kotlin/) for how to instantiate and use an `ApolloClient`. |
| 96 | + |
| 97 | +### apollo-testing-support |
| 98 | + |
| 99 | +`apollo-testing-support` contains: |
| 100 | + |
| 101 | +* `QueueTestNetworkTransport` and `MapTestNetworkTransport` for testing without a mock server. |
| 102 | +* a set of helper functions used for Apollo tests. They were never really intended to become public and will be removed in a future version. These symbols are marked as deprecated. If you are using them, copy paste them in your project. |
| 103 | + |
| 104 | +See ["Mocking GraphQL responses"](https://www.apollographql.com/docs/kotlin/testing/mocking-graphql-responses) for how to use test network transports. |
| 105 | + |
| 106 | +## Deprecated modules |
| 107 | + |
| 108 | +These modules are deprecated and will be removed in a future version. |
| 109 | + |
| 110 | +### apollo-adapters (DEPRECATED) |
| 111 | + |
| 112 | +`apollo-adapters` contains adapters for common date and big decimal GraphQL scalars. |
| 113 | + |
| 114 | +This module is deprecated and moved to the Apollo Galaxy. See the [Apollo Galaxy page](https://www.apollographql.com/docs/kotlin/advanced/galaxy) for more details. |
| 115 | + |
| 116 | +### apollo-api-java (DEPRECATED) |
| 117 | + |
| 118 | +`apollo-api-java` contains the symbols needed to compile the Java models. |
| 119 | + |
| 120 | +This module is deprecated and moved to the Apollo Galaxy. See the [Apollo Galaxy page](https://www.apollographql.com/docs/kotlin/advanced/galaxy) for more details. |
| 121 | + |
| 122 | +### apollo-engine-ktor (DEPRECATED) |
| 123 | + |
| 124 | +`apollo-engine-ktor` is an implementation of `HttpEngine` and `WebSocketEngine` that uses Ktor. |
| 125 | + |
| 126 | +This module is deprecated and moved to the Apollo Galaxy. See the [Apollo Galaxy page](https://www.apollographql.com/docs/kotlin/advanced/galaxy) for more details. |
| 127 | + |
| 128 | +### apollo-idling-resource (DEPRECATED) |
| 129 | + |
| 130 | +`apollo-idling-resource` contains an [Espresso `IdlingResource`](https://developer.android.com/training/testing/espresso/idling-resource) that monitors calls to your GraphQL API. |
| 131 | + |
| 132 | +This module is deprecated as we recommend you should wait for your UI to change instead. See [this article about ways to do so](https://medium.com/androiddevelopers/alternatives-to-idling-resources-in-compose-tests-8ae71f9fc473). |
| 133 | + |
| 134 | +### apollo-mockserver (DEPRECATED) |
| 135 | + |
| 136 | +`apollo-mockserver` is a HTTP server for your tests. It supports multiplatform and websockets. |
| 137 | + |
| 138 | +The API is minimal and performance is a non-goal. Do not use for production APIs. |
| 139 | + |
| 140 | +This module is deprecated and moved to the Apollo Galaxy. See the [Apollo Galaxy page](https://www.apollographql.com/docs/kotlin/advanced/galaxy) for more details. |
| 141 | + |
| 142 | +### apollo-runtime-java (DEPRECATED) |
| 143 | + |
| 144 | +`apollo-runtime-java` is an implementation of `ApolloClient` that doesn't use coroutines and more generally is more friendly for Java callers. |
| 145 | + |
| 146 | +This module is deprecated and moved to the Apollo Galaxy. See the [Apollo Galaxy page](https://www.apollographql.com/docs/kotlin/advanced/galaxy) for more details. |
| 147 | + |
| 148 | +### apollo-rx2-support (DEPRECATED) |
| 149 | + |
| 150 | +`apollo-rx2-support` provides thin wrappers around [`kotlinx-coroutines-rx2`](https://github.com/Kotlin/kotlinx.coroutines/tree/master/reactive/kotlinx-coroutines-rx2). |
| 151 | + |
| 152 | +This module is deprecated and will be removed in a future version. |
| 153 | + |
| 154 | +### apollo-rx3-support (DEPRECATED) |
| 155 | + |
| 156 | +`apollo-rx3-support` provides thin wrappers around [`kotlinx-coroutines-rx3`](https://github.com/Kotlin/kotlinx.coroutines/tree/master/reactive/kotlinx-coroutines-rx3). |
| 157 | + |
| 158 | +This module is deprecated and will be removed in a future version. |
| 159 | + |
| 160 | +### apollo-rx2-support-java (DEPRECATED) |
| 161 | + |
| 162 | +`apollo-rx2-support-java` provides adapter from `ApolloCall` to their RxJava3 equivalent. |
| 163 | + |
| 164 | +This module is deprecated and moved to the Apollo Galaxy. See the [Apollo Galaxy page](https://www.apollographql.com/docs/kotlin/advanced/galaxy) for more details. |
| 165 | + |
| 166 | +### apollo-rx3-support-java (DEPRECATED) |
| 167 | + |
| 168 | +`apollo-rx3-support-java` provides adapter from `ApolloCall` to their RxJava3 equivalent. |
| 169 | + |
| 170 | +This module is deprecated and moved to the Apollo Galaxy. See the [Apollo Galaxy page](https://www.apollographql.com/docs/kotlin/advanced/galaxy) for more details. |
| 171 | + |
| 172 | +## Internal modules |
| 173 | + |
| 174 | +These modules are published for technical reasons only. Most of their symbols are `@ApolloInternal` and they might be removed at any time. Avoid using them. |
| 175 | + |
| 176 | +### apollo-mockserver (INTERNAL) |
| 177 | + |
| 178 | +`apollo-mpp-utils` contains a few utilities for working with multiplatform projects. |
| 179 | + |
| 180 | +As of June 2024, it only contains `currentTimeMillis`. In most cases, we should replace that with `kotlin.time.TimeMark` but it's still used in `HttpInfo` as absolute timestamps, and we can't remove it just yet. |
| 181 | + |
| 182 | +This module is published for technical reasons only. Do not use directly. |
| 183 | + |
| 184 | +### apollo-tooling (INTERNAL) |
| 185 | + |
| 186 | +`apollo-tooling` contains APIs to work with GraphQL schemas and operations as well as the GraphOS API. It is used from the CLI and Gradle plugin |
| 187 | + |
| 188 | +This module is published for technical reasons only. Do not use directly. |
0 commit comments