Skip to content

App following MVVM, Clean Architecture, modularization, Koin for dependency injection, and Retrofit for API calls. It simulates a social media using the JSONPlaceholder API to manage posts, albums, and users, serving as a template for building scalable applications

License

Notifications You must be signed in to change notification settings

raphacosil/json-placeholder-app

Repository files navigation

Json-Placeholder-App

Project Overview

This is a mobile application built using Android with an emphasis on modular architecture, leveraging the MVVM (Model-View-ViewModel) design pattern.

The app simulates a social network, managing albums, posts, and user interactions using various endpoints from the JSONPlaceholder API.

The project serves as a model for applying architectural principles to more complex projects.

Key features include:

  • RecyclerViews
  • Retrofit for API interactions
  • ViewModels
  • State and Action Management
  • Dependency Injection with Koin
  • Clean Architecture
  • Modularization

Architecture

The project follows Clean Architecture, organized into three key layers:

1. Presentation Layer (app module)

This layer handles the UI components, including activities, fragments, views, adapters, and ViewModels.

It communicates with the Domain Layer to fetch and update data.

The ViewModel observes states and updates the UI accordingly.

  • UI (Activities & Fragments):

    Displays user-facing elements such as lists, forms, and navigation.

  • Views:

    Includes adapters for RecyclerView, click listeners, and custom UI components.

  • ViewModels:

    Manages UI state and interacts with UseCases from the Domain Layer.

    Includes action and state management.

  • Utilities:

    Helper classes for UI enhancements like RecyclerView decorations or utility functions.

2. Domain Layer (domain module)

This layer defines the business logic and use cases.

It abstracts the application rules and interacts with repositories in the Data Layer.

  • Entities:

    Business objects representing core data.

  • UseCases:

    Define application-specific operations (e.g., fetching posts, creating albums).

  • Repositories (Interfaces):

    Abstracts data sources, ensuring the Domain Layer doesn't depend directly on the Data Layer.

3. Data Layer (data module)

This layer is responsible for data management.

It connects with APIs and transforms data into domain entities.

  • DataSource:

    Contains the Retrofit service interface for API calls.

  • Models:

    Data Transfer Objects (DTOs) used for serialization, deserialization, and transformation of DTOs to Entities.

  • Repository Implementation:

    Implements the repository interfaces and handles data transformations.


Project Structure

data
│── manifests
│── java
│   └── com.example.data
│       ├── datasource
│       ├── model
│       ├── repository
│── com.example.data (androidTest)
│── com.example.data (test)

domain
│── main
│   │── java
│   │   └── com.example.domain
│   │       ├── entity
│   │       ├── repository
│   │       ├── usecase
│── test
│── manifests

java
│── com.example.json_placeholder_api
│   ├── presentation
│   │   ├── ui
│   │   │   ├── activity
│   │   │   ├── fragment
│   │   │   ├── view
│   │   │   │   ├── adapter
│   │   │   │   ├── click_listener
│   │   ├── utils
│   │   ├── viewmodel
│   │   │   ├── action
│   │   │   ├── state
│   ├── Application
│   ├── KoinApplication.kt
│── com.example.json_placeholder_api (generated)


Key Functionalities

User Interaction

  • FindUsersFragment: Lists all users and navigates to a specific user’s profile.
  • HomeFragment: Displays the main feed (e.g., posts, albums).

Albums Management

  • AlbumsOfUserFragment: Displays a list of albums for a user.
  • CreateAlbumFragment: Allows users to create albums with titles and up to two photos.

Post Management

  • CreatePostFragment: Enables users to create posts with a title and description.

Publication Management

  • CreatePublicationFragment: Manages switching between creating posts and albums.

Tech Stack

  • Programming Language: Kotlin
  • Architecture: MVVM with Clean Architecture
  • Networking: Retrofit + Gson
  • Dependency Injection: Koin
  • State Management: LiveData
  • UI Components: RecyclerView, Fragments, ViewBinding
  • API: JSONPlaceholder

About

App following MVVM, Clean Architecture, modularization, Koin for dependency injection, and Retrofit for API calls. It simulates a social media using the JSONPlaceholder API to manage posts, albums, and users, serving as a template for building scalable applications

Topics

Resources

License

Stars

Watchers

Forks

Languages