Skip to content

ferPrieto/SpaceX-prepare-for-Clean-Architecture-liftoff

Repository files navigation

SpaceX Prepare for Clean Architecture Liftoff 🚀

JetpackCompose Platform License Build Status

A modern Android application demonstrating Feature-First Clean Architecture principles with Kotlin 2.1.0 and Jetpack Compose.

Unlike traditional centralized-module approaches (separate data, domain, presentation layers), this project uses a feature-first modular architecture where each feature is self-contained with its own domain, data, and presentation layers, promoting true modularity and independence.

Built with: Kotlin Coroutines, Kotlin Flow, Hilt, MVVM, Compose Navigation 3, and Multi-Module Architecture.

Modules 📑

This project follows a feature-first modular architecture where each feature is self-contained:

Feature Modules

  • feature-dashboard - Company information feature with its own domain, data, and presentation layers. Displays SpaceX company details.
  • feature-launches - Rocket launches feature. Includes launch listing, filtering, and details with full domain/data/presentation separation.
  • feature-navigation - Navigation orchestration using custom Navigation 3 implementation. Manages app-wide navigation and bottom navigation UI.

Core/Shared Modules

  • core-network - Network infrastructure module. Provides Retrofit setup, API service definitions, and response models. Used by all feature data layers.
  • shared-ui - Shared UI components and theme. Contains Material Design theme, Lottie animations, common composables, and design system.
  • shared-testing - Test utilities and helpers. Provides coroutine test rules, MockK extensions, and test builders for all modules.

App Module

  • app - Application entry point. Minimal module that wires together feature modules with Hilt and initializes the application.

Each feature module contains:

  • domain/ - Use cases, domain models, and repository interfaces
  • data/ - Repository implementations, data models, and mappers
  • presentation/vm/ - ViewModels, contracts, and presentation logic
  • presentation/ui/ - Composable screens and UI models
  • di/ - Hilt dependency injection modules

Testing 🔍

Unit Testing

There are some highlights:

  • Every layer in the architecture has been tested.
  • MockK has been used for mocking | stubbing.
  • Given | When | Then code presentation order, in order to give a more structured style.
  • Code Coverage (WORK IN PROGRESS).

UI Testing (Compose)

I opted to use three types of approaches:

  • MockWebserver, where real connection scenarios are setup. More information in my MockWebServer Medium Article!
  • Tests in Isolation, where it's possible to mock and set any content, UI state, etc. Which allows to emulate very specific edge cases.
  • Screenshot Testing 📸

In the two first types of tests I used Robot Pattern to improve cleanliness and ease of readability. More information in my RobotPattern Medium Article!

License 🚔

Copyright 2026 Fernando Prieto Moyano

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.