Animation App is a full Boruto/anime character app with two parts: a Jetpack Compose Android frontend and a Ktor backend. The backend serves paginated hero data, search results, and character images. The Android app consumes that API with Retrofit, caches data with Room and Paging 3, stores onboarding state with DataStore, and presents a polished Compose UI with splash, onboarding, home, search, and details screens.
Despite the repository name, the project is more than an animation demo; it is a complete client/server sample for an anime character catalog.
- Jetpack Compose Android frontend
- Ktor backend with Netty engine
- Koin dependency injection on the backend
- Hilt dependency injection on Android
- Retrofit client with Kotlinx Serialization converter
- Room database cache for heroes and remote keys
- Paging 3 with
RemoteMediator - DataStore onboarding persistence
- Compose Navigation
- Accompanist pager, swipe refresh, and system UI controller
- Coil image loading
- Palette-based detail screen colors
- Splash screen with logo rotation animation
- Three-page onboarding flow
- Home screen with paginated hero list
- Search screen backed by API query
- Hero detail screen with bottom sheet, stats, family, abilities, and nature types
- Backend static image resources for characters
- Unit and instrumented test files for paging, search, and UI pieces
.
+-- README.md
+-- Frontend/ # Android Jetpack Compose app
+| +-- build.gradle
+| +-- settings.gradle
+| +-- app/
+| +-- build.gradle
+| +-- src/main/java/com/alirahimi/borutoapp/
+| +-- data/
+| +-- di/
+| +-- domain/
+| +-- navigation/
+| +-- presentation/
+| +-- ui/theme/
+| +-- util/
+| +-- MainActivity.kt
+| +-- MyApplication.kt
+-- Backend/
+ +-- ktor-sample/ # Ktor API server
+ +-- build.gradle.kts
+ +-- src/main/kotlin/com/example/
+ | +-- routes/
+ | +-- models/
+ | +-- plugins/
+ | +-- repository/
+ | +-- di/
+ | +-- Application.kt
+ +-- src/main/resources/images/
+```
## Frontend Screens
| Screen | Route | Purpose |
| --- | --- | --- |
| Splash | `splash_screen` | Rotates the logo, reads onboarding state, and routes to welcome or home. |
| Welcome | `welcome_screen` | Three onboarding pages using Accompanist horizontal pager. |
| Home | `home_screen` | Paginated hero list with top bar and search action. |
| Details | `details_screen/{heroId}` | Hero image, color palette, bottom sheet, stats, family, abilities, and nature types. |
| Search | `search_screen` | Search text field and paginated search results. |
## Backend API
The backend runs on Ktor and exposes Boruto hero endpoints.
| Method | Endpoint | Query | Description |
| --- | --- | --- | --- |
| `GET` | `/` | none | Root route. |
| `GET` | `/boruto/heroes` | `page` | Returns a paginated hero response. Valid pages are `1` to `5`. |
| `GET` | `/boruto/heroes/search` | `name` | Returns heroes matching the search query. |
| `GET` | `/images/{file}` | none | Static hero images from backend resources. |
The backend listens on port `8080` by default, or the `PORT` environment variable when provided.
## Data Flow
```text
Compose screen
-> Hilt ViewModel
-> UseCases
-> Repository
-> RemoteDataSource / LocalDataSource / DataStoreOperations
-> Retrofit API / Room database / DataStore
-> Ktor backend
The home list uses Paging 3 and HeroRemoteMediator:
- The app requests a page from
/boruto/heroes?page=n. - Heroes are stored in Room.
- Remote keys are stored in
hero_remote_keys_table. - Cached data is reused for up to 1440 minutes.
- UI collects paging data with
collectAsLazyPagingItems().
| File | Purpose |
|---|---|
MainActivity.kt |
Starts BorutoAppTheme and the navigation graph. |
MyApplication.kt |
Hilt application class. |
navigation/NavGraph.kt |
Compose navigation graph. |
presentation/screens/splash/ |
Splash route and onboarding-state routing. |
presentation/screens/welcome/ |
Onboarding pager and finish button. |
presentation/screens/Home/ |
Home top bar, ViewModel, and paged hero list. |
presentation/screens/search/ |
Search top bar, query state, and search results. |
presentation/screens/details/ |
Detail screen, bottom sheet, palette generation, and hero info. |
presentation/common/ListContent.kt |
Shared paged-list rendering. |
data/paging_source/HeroRemoteMediator.kt |
RemoteMediator for API + Room pagination. |
data/local/BorutoAppDatabase.kt |
Room database with hero and remote-key entities. |
data/remote/BorutoApi.kt |
Retrofit endpoint definitions. |
di/*.kt |
Hilt modules for database, network, and repositories. |
domain/use_cases/UseCases.kt |
Use case container for app actions. |
| File | Purpose |
|---|---|
Application.kt |
Ktor entry point and plugin configuration. |
plugins/Routing.kt |
Registers API routes. |
routes/AllHeroes.kt |
Handles paginated hero requests. |
routes/SearchHeroes.kt |
Handles search requests. |
routes/Root.kt |
Root route. |
models/Hero.kt |
Serializable hero model. |
models/ApiResponse.kt |
Serializable API response model. |
repository/HeroRepository.kt |
Backend repository contract. |
repository/HeroRepositoryImplementation.kt |
In-memory hero data and search/page logic. |
di/KoinModule.kt |
Backend dependency injection module. |
resources/images/ |
Hero image files served by the backend. |
The backend stores hero data in memory across five pages. Each hero contains:
idnameimageaboutratingpowermonthdayfamilyabilitiesnatureTypes
The Android frontend displays the same fields across list and detail screens.
Frontend API base URL:
const val BASE_URL = "http://10.0.2.2:8080"This points an Android emulator to a backend running on the host machine. For a physical device or deployed backend, this value should be changed.
Important frontend constants:
| Constant | Value |
|---|---|
BORUTO_DATABASE |
boruto_database |
HERO_DATABASE_TABLE |
hero_table |
HERO_REMOTE_KEYS_DATABASE_TABLE |
hero_remote_keys_table |
ITEMS_PER_PAGE |
3 |
NUMBER_OF_BOARDING_PAGES |
3 |
PREFERENCES_NAME |
boruto_preferences |
- Kotlin
- Jetpack Compose
- Compose Navigation
- Hilt
- Retrofit
- Kotlinx Serialization
- Room
- Paging 3
- DataStore Preferences
- Coil
- Accompanist Pager, SwipeRefresh, and System UI Controller
- Palette API
- Kotlin JVM
- Ktor Server Core
- Ktor Netty
- Kotlinx Serialization
- Koin
- Logback
Start the backend from the Ktor project:
cd Backend/ktor-sample
./gradlew runThen open the Android project in Android Studio:
Frontend/
Run the Android app on an emulator. The default frontend URL http://10.0.2.2:8080 expects the backend to be running locally on the development machine.
- This is a learning/sample project for Compose, Ktor, Paging, Room, and clean-ish layering.
- The backend data is in memory and hard-coded in
HeroRepositoryImplementation. - The frontend has a tracked
local.properties, which is machine-specific and usually should not be committed in reusable projects. - The Room database builder uses
test_database.dbeven for non-test local storage. - Search and pagination are implemented against the Ktor backend, not a public external API.
- The project includes tests, but this README update did not run Gradle or test commands.
- Move machine-specific
local.propertiesout of version control - Rename the app/repository to better reflect the Boruto character catalog
- Add a backend README or OpenAPI-style endpoint documentation
- Replace hard-coded backend data with a database or JSON fixture
- Add loading/error UI documentation and screenshots
- Make
BASE_URLenvironment/flavor-based - Rename
test_database.dbto a production-friendly database name - Add CI checks for backend and frontend tests