Hackernews at your finger tips
Click here to install latest release
- Features
- Tech Stack & Libraries
- Setup Instructions
- Building the APK
- Project Structure (Brief Overview)
- Displays a list of Hackernews.
- Allows users to read complete article.
- Allows users to favorite articles and view them later.
- "About" screen with app information, developer details, and links to portfolio, LinkedIn, and GitHub.
- Modern UI built with Jetpack Compose.
- Language: Kotlin (100%)
- UI Toolkit: Jetpack Compose - Android's modern toolkit for building native UI.
- Architecture: MVVM (Model-View-ViewModel) utilizing Jetpack ViewModel and StateFlow to manage UI state for Composable functions.
- Core Jetpack Libraries:
androidx.activity:activity-compose- For Compose integration in Activities.androidx.compose.material3:material3- Material Design 3 components.androidx.compose.ui:ui-tooling-preview- For Composable previews in Android Studio.androidx.compose.runtime:runtime- Core Compose runtime.androidx.lifecycle:lifecycle-runtime-compose- For observing Lifecycle-aware state.
- Serialization:
org.jetbrains.kotlinx:kotlinx-serialization-json- For parsing json response from Hackernews api.
- Navigation: Intent-based navigation between Activities
- Build Tool: Gradle
- Android Studio (Latest stable version recommended)
- Android SDK installed (ensure you have the necessary SDK Platforms and Build Tools).
- Kotlin plugin installed in Android Studio (usually comes bundled).
- An Android device or Emulator (API level 24+ recommended).
git clone https://github.com/vpk11/HackerFeed.git
cd HackerFeed- Open Android Studio.
- Select File > New > Import Project... (or Open an existing Android Studio project from the welcome screen).
- Navigate to the directory where you cloned or extracted the project (
HackerFeedfolder). - Select the root
build.gradlefile or the project directory itself. - Click OK.
- Android Studio will then sync the project with Gradle. This might take a few minutes, especially on the first import, as it downloads necessary dependencies.
A debug APK is useful for testing and development.
- In Android Studio, select Build > Build Bundle(s) / APK(s) > Build APK(s).
- Once the build is complete, a notification will appear in the bottom-right corner of Android Studio.
- Click on the locate link in the notification.
- This will open the
app/build/outputs/apk/debug/directory, where you'll findapp-debug.apk. - You can install this APK directly onto an Android device or emulator.
Alternatively, running the app directly on a connected device or emulator from Android Studio (by clicking the "Run" button) will also build and install a debug version.
A release APK is a signed version of your app, ready for distribution (e.g., on the Google Play Store or other platforms).
Important: Before building a release APK, you need to set up signing configurations.
- Generate an Upload Key and Keystore:
- If you don't have one, follow the official Android documentation: Sign your app
- Configure Signing in
build.gradle:- Open your module-level
build.gradle(e.g.,app/build.gradleorapp/build.gradle.kts). - Add a
signingConfigsblock and configure your release build type to use it. - Security Note: It's highly recommended to store your keystore passwords securely (e.g., in
keystore.propertiesand add that file to.gitignore, or use environment variables in a CI/CD system) rather than hardcoding them inbuild.gradle. See the "Secure your keys" section in the official docs.
- Open your module-level
- Build the Release APK:
- In Android Studio, select Build > Generate Signed Bundle / APK....
- Choose APK and click Next.
- Select your keystore, enter passwords, and choose your key alias. Click Next.
- Choose the destination folder for the signed APK.
- Select the build variant (e.g.,
release). - Click Finish (or Create).
- The signed APK will be generated in the specified destination folder (usually
app/release/app-release.apk).
The project follows Clean Architecture principles with clear separation of concerns across three main layers:
- Activities: Main UI screens including news feed, favourites, settings, and about pages
- ViewModels:
presentation/- State management and business logic coordination - UI Components:
components/- Reusable Compose components for consistent UI
- Models:
domain/model/- Core business entities and data models - Use Cases:
domain/usecase/- Single-responsibility business operations - Repository Interfaces:
domain/repository/- Data access contracts
- API Service:
data/- Retrofit service for Hacker News API integration - Data Sources:
data/datasource/- Remote API and local database data sources - Repository Implementations:
data/repository/- Concrete data access with caching - Cache Management:
data/cache/- Intelligent caching with automatic expiration - Database:
database/- Room database for offline storage and favourites
- Dependency Injection:
di/- Manual DI container and ViewModel factory - UI Theming:
ui/theme/- Material Design 3 theme system - Resources:
app/src/main/res/- App resources (drawables, strings, etc.)
- MVVM Pattern: Clear separation between UI and business logic
- Clean Architecture: Domain-driven design with dependency inversion
- Repository Pattern: Abstracted data access with local caching
- Use Case Pattern: Single-responsibility business operations
- Manual Dependency Injection: Lightweight DI without external frameworks
- Offline-First: Local caching with automatic expiration
- Material Design 3: Modern UI following Google's design guidelines