Skip to main content

Architecture & Design

This page outlines the technical foundation of the POS application. The project is built with a focus on speed, offline-first reliability, and a modern developer experience.

Feature-Based MVVM

We utilize a Feature-based MVVM (Model-View-ViewModel) structure. By grouping code by functionality rather than technical layers, we ensure that the codebase remains scalable and easy to navigate.

Core Pillars

  1. The Composable View

    • Built entirely with Jetpack Compose.
    • Uses State Hoisting for modularity.
    • Observes StateFlow from the ViewModel for real-time UI updates.
  2. The Feature ViewModel

    • Manages UI state for specific features (e.g., Payments, History).
    • Communicates directly with Room DAOs and Ktor to reduce boilerplate.
    • Handles asynchronous tasks via Kotlin Coroutines.
  3. Data Sources

    • Room Database: Local persistence for transactions and settings.
    • Ktor: High-performance networking for terminal communication.

Technical Stack

LayerTechnology
UIJetpack Compose (Material 3)
LogicKotlin Coroutines & Flow
DIDagger 2 (via KSP)
DatabaseRoom SQLite
NetworkingKtor Client
AnimationsLottie Compose

Project Structure

com.example.pos_app
├── features # Functional modules (UI + Logic)
│ ├── payment # Checkout UI & Transaction ViewModels
│ └── history # Transaction logs & History ViewModels
├── data # Global Data Engine
│ ├── dao # Room Data Access Objects (SQL Queries)
│ ├── entity # Database Tables / Data Models
│ ├── repository # Data coordination (Local vs Remote)
│ └── utils # Data-related helpers & formatters
├── di # Dependency Injection (Dagger/Hilt)
└── ui.theme # Design System (Color, Type, Theme)