How gurupreet/composecookbook works
This project is a multi-module Android repository built to showcase the power and variety of Jetpack Compose. Essentially, it is a cookbook of composable UI elements, layouts, widgets, animations, themes, and complete demo applications (such as cryptoapp, datingapp, moviesapp, etc.) that can be used as references or building blocks for modern Android UI development with Compose.
Main Components
• Core UI Modules – These modules house the reusable UI components, layouts, widgets, animations, themes, and utility functions. You have dedicated directories such as “components” (with submodules like carousel, charts, colorpicker, etc.), “theme” (for styling), “templates” (for various sample screens like onboarding, login, etc.), and “animations”.
• Data Layer – The “data” module provides data sources, models, and data providers (e.g., DemoDataProvider, AlbumsDataProvider) that power many of the composables’ dynamic content.
• App Module – This is the main application “app” module where the ComposeCookBook host app is created, containing the main activity and orchestrating the display of various UI screens.
• Build & Dependency Management – “buildSrc” contains Kotlin DSL scripts and Gradle configurations (dependency and configuration scripts), which streamline module builds and dependency management.
• Demo Applications – A series of demo subprojects (under the “demos” directory) such as “cryptoapp”, “datingapp”, “spotify”, “instagram”, “twitter”, etc. Each of these stands as a complete app that leverages components from the core modules to demonstrate real-world usage and integrations (for example, MVVM, MVI patterns, Retrofit, Room integration).
• Animations & Assets – The “animations” directory is split into parts such as “canvas” and “lottie”, each demonstrating different animation techniques using Jetpack Compose.
Relationships and Interactions
• The core UI modules (components, theme, templates) are designed as independent Gradle modules. They interact with the “app” module, which acts as the container and navigation hub.
• Modules in “data” provide models and data providers that are usually consumed by UI components in both the “app” and the demo applications.
• Demos are loosely coupled standalone apps that rely on the core modules. They help illustrate how the building blocks can be integrated together to build fully-functional applications.
• The “buildSrc” module provides centralized dependency and configuration management for all modules, ensuring consistency across the project.
• CI/CD workflows (in the “.github” folder) act on corresponding modules to build, test, and package the applications (including the creation of APKs).
Architectural Patterns & Design Principles
• Modularization – The project is architected as a multi-module Gradle project, promoting separation of concerns (UI, data, theming, configuration, demos, etc.).
• Reusability – Independent, well-defined UI components and templates ensure that every demo or app can reuse the same building blocks.
• Declarative UI – The use of Jetpack Compose means that the entire UI is built with a declarative approach.
• Layers – Although not a strict MVVM or Clean Architecture implementation across every module, typical demos may demonstrate patterns like MVVM or MVI (especially in demo apps like CryptoApp, MovieApp, DatingApp).
• Build Automation – Usage of Gradle’s Kotlin DSL and custom scripts via “buildSrc” demonstrates an emphasis on maintainability and scalable dependency management.