Grapla is a modern Android app template showcasing best practices for multi-module architecture with a dedicated design system library. Perfect for jumpstarting your next Android project with convention plugins and a scalable structure.
- β Multi-module architecture with clear separation of concerns
- β Design System (Gruid) - Reusable UI components library
- β Convention Plugins - Build logic sharing across modules
- β Jetpack Compose - Modern declarative UI toolkit
- β Material 3 - Latest Material Design components
- β Gradle Version Catalogs - Centralized dependency management
- β Hilt - Dependency injection
- β Detekt - Static code analysis and formatting
- β CI/CD - Automated workflows with GitHub Actions
Grapla/
βββ app/ # Main application module
βββ gruid/ # Design system library (Grapla UI Design)
βββ gruiddemo/ # Design system showcase module
βββ buildLogic/ # Convention plugins for build logic
β βββ convention/ # Shared build configuration
βββ data/ # Data layer modules
βββ datasources/ # Data source implementations
βββ scripts/ # Git hooks and automation scripts
Grapla uses convention plugins to share build configuration across modules. This approach:
- β Reduces build script duplication
- β Ensures consistency across modules
- β Makes build logic testable and maintainable
- β Simplifies module setup
Available Convention Plugins:
grapla.android.application- Android app modulesgrapla.android.library- Android library modulesgrapla.android.library.compose- Compose library modulesgrapla.android.application.compose- Compose app modulesgrapla.hilt- Hilt dependency injectiongrapla.android.lint- Lint configurationgrapla.android.room- Room database setup
See the buildLogic README for more details.
The Gruid module contains reusable UI components following atomic design principles:
- Atoms - Basic building blocks (colors, typography)
- Molecules - Simple component combinations
- Components - Complex, reusable UI elements
- Theme - App-wide theming configuration
- Android Studio - Latest stable version
- Java 21 - Required for Gradle and Kotlin compilation
- Gradle 8.7+ - Project uses Gradle wrapper
-
Clone the repository
git clone https://github.com/tamzi/Grapla.git cd Grapla -
Set Java 21 in Android Studio
- Go to:
Settings > Build, Execution, Deployment > Build Tools > Gradle - Set
Gradle JDKto21
- Go to:
-
Install Git Hooks β‘ AUTO-INSTALLED!
Git hooks are automatically installed during the first Gradle sync.
Manual installation (if needed):
./scripts/install-git-hooks.sh
Verify installation:
./scripts/verify-hooks.sh
These hooks enforce code quality and commit rules automatically.
-
Sync Gradle
./gradlew sync
-
Build the project
./gradlew build
-
Run the app
- Select the
apprun configuration - Choose your device/emulator
- Click Run
βΆοΈ
- Select the
# Run all tests
./gradlew test
# Run tests for specific module
./gradlew :app:test
./gradlew :gruid:test# Build all modules
./gradlew build
# Build specific module
./gradlew :app:build
./gradlew :gruid:build
# Clean build
./gradlew clean
# Run tests
./gradlew test
# Code quality checks
./gradlew detekt
./gradlew lint
# Auto-format code
./gradlew detekt --auto-correct
# Install app on device
./gradlew installDebug
# View all available tasks
./gradlew tasksTo use Gruid components in your modules:
-
Add dependency in your module's
build.gradle.kts:dependencies { implementation(project(":gruid")) } -
Use components:
@Composable fun MyScreen() { GraplaTheme { // Your UI here } }
-
Explore the catalog
- Check out the
gruiddemomodule for component examples - Run the gruiddemo app to see all components in action
- Check out the
The project uses Detekt for code analysis and formatting:
# Run code analysis and formatting checks
./gradlew detekt
# Auto-format code (fixes formatting issues)
./gradlew detekt --auto-correctGit hooks automatically validate your code before commits and pushes, catching issues early.
Good news! Git hooks are automatically installed when you first sync the project in Gradle.
No manual setup needed - just clone and build!
If for some reason hooks aren't auto-installed, run:
./scripts/install-git-hooks.shThat's it! All hooks are now installed and active.
./scripts/verify-hooks.shExpected output:
β
All git hooks are properly installed
Pre-Commit Hook (runs when you commit)
- β Validates build succeeds
- β Runs tests
- β Checks code quality (detekt, lint)
- β Enforces commit rules (file count, naming, etc.)
- β±οΈ Takes ~30-60 seconds
Pre-Push Hook (runs when you push)
- β Validates all commits in push
- β Ensures no mixed code/doc changes
- β Runs detekt and tests
- β±οΈ Takes ~15-30 seconds
β Successful commit:
git add MyFile.kt
git commit -m "feat: add new feature"
# Hooks run automatically, checks pass β
# Commit succeedsβ Blocked commit (too many files):
git add file1.kt file2.kt file3.kt file4.kt file5.kt file6.kt
git commit -m "feat: big change"
# β VIOLATION: 6 files staged (maximum: 5)
# Fix: Split into smaller commitsπ§ How to fix:
# Split your changes into smaller commits
git reset HEAD~1
git add file1.kt file2.kt
git commit -m "feat: add feature part 1"
git add file3.kt file4.kt
git commit -m "feat: add feature part 2"In rare emergencies, you can skip hooks:
git commit --no-verify # Skip pre-commit
git push --no-verify # Skip pre-push- CI/CD checks (slower feedback)
- Server-side hooks (cannot be bypassed)
- Code review
Hooks not running?
# Check status
./scripts/verify-hooks.sh
# Reinstall if needed
./scripts/install-git-hooks.shHooks too slow?
- They run build and tests to prevent broken commits
- This saves time by catching issues before they enter git history
- Commit less frequently, or push more often (pre-push is faster)
Need more details?
- Quick guide:
docs/quickStartHooks.md - Full documentation:
scripts/README.md - Enforcement strategy:
docs/gitHookEnforcement.md
Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
./gradlew test - Format code:
./gradlew detekt --auto-correct - Commit:
git commit -m 'feat(module): add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by Now in Android best practices
- Design system patterns from Dashiki
- Images in samples from Pexels:
- lilartsy
- Tirachard Kumtanom
- Quang Anh Ha Nguyen
β If you find this template helpful, consider giving it a star!