Skip to content

Baker0o7/MiniMart-Pos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

185 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MiniMart POS

πŸ›’ MiniMart POS

Fast Β· Offline Β· Secure Android Point-of-Sale for Kenyan mini-markets

Built with Kotlin + Jetpack Compose πŸ‡°πŸ‡ͺ

Release Build Android Kotlin Room DB


πŸ“± Screenshots

Login Dashboard New Sale
Login Dashboard New Sale
Checkout Credit Payment Customer Search
Checkout Credit Customer

✨ Features

πŸ›οΈ New Sale

  • Camera barcode scanner (ML Kit β€” EAN-13, UPC, QR, Code-128, Code-39, Data Matrix)
  • Bluetooth / USB HID barcode scanner support
  • Weighing scale support (PLU) β€” decodes variable-weight EAN-13 barcodes, auto-calculates price from weight Γ— price/kg, weight persisted in sale records
  • Continuous scan mode with animated laser overlay, corner brackets, green flash confirmation, and live scan counter badge
  • Product search by name or barcode with live dropdown
  • Cart with quantity stepper, per-item discounts
  • Inclusive VAT β€” tax extracted from price, not added on top
  • Cart badge on bottom nav shows pending item count when navigating away

πŸ’³ Checkout & Payments

  • Cash β€” quick-amount buttons, real change calculation
  • M-Pesa β€” ref number field
  • Credit β€” customer wallet or buy-on-account (negative balance allowed)
  • Split payment β€” combine credit + cash in one transaction
  • Customer selector with search + contacts import
  • Cash drawer auto-opens on cash payment (configurable)
  • Haptic feedback confirms every completed sale

πŸ‘€ Customer Credit System

  • Register customers with name, phone, email
  • Credit wallet β€” deposits, deductions on purchases
  • Buy on account β€” negative balance allowed
  • Full transaction history per customer
  • Credit Ledger β€” all non-zero balances at a glance
    • πŸ”΄ Debtors (negative, owe money) shown first with "OWES KES X" in red
    • 🟒 Wallet balances shown in green
    • Two summary stats: "Owed to Shop" + "Wallet Credit"

🌐 Multi-Device LAN Sync

  • No internet, no cloud β€” pure local WiFi sync
  • Pairing code authentication β€” 6-digit code shown on server device, required on client device β€” any WiFi visitor cannot read or inject data
  • Server device: toggle "Act as Sync Server", share the displayed code
  • Client device: enter server IP + pairing code β†’ Sync Now
  • Pending-changes amber badge + progress spinner during sync

πŸ—ƒοΈ Cash Drawer

  • ESC/POS kick via thermal printer RJ11 port
  • Direct Bluetooth cash drawer support
  • Auto-opens on cash payment (toggle) Β· Test button in Settings

πŸ“¦ Inventory & Products

  • Add/edit: price, cost, stock, category, SKU, unit, tax rate
  • Supplier info + reorder quantity Β· Batch number + expiry date
  • Color-coded expiry urgency badges Β· Low-stock background alerts (WorkManager)
  • Stock adjustments with reason log
  • PLU / Weighing scale toggle per product (PLU code + price/kg)

πŸ“Š Reports & Analytics

  • Revenue vs yesterday (real % comparison, flips red when down)
  • Dashboard auto-refreshes at midnight β€” "today" always means today
  • Transaction count, average basket, top-selling items
  • Reports & Expenses use proper calendar week (Mon–Sun) and calendar month, not rolling 7/30-day windows
  • Sales History: color-coded payment method chips (πŸ’΅ Cash / πŸ“± M-Pesa / 🀝 Credit / πŸ”€ Split)
  • Quick Void on COMPLETED sales from the history list (Manager+)

πŸ‘₯ Role-Based Access Control

Permission Owner Manager Cashier
Process sales βœ… βœ… βœ…
Apply discounts βœ… βœ… ❌
View reports βœ… βœ… ❌
Edit products βœ… βœ… ❌
Void sales βœ… βœ… ❌
Multi-device sync βœ… βœ… ❌
User management βœ… ❌ ❌

Route-level AccessGuard bounces unauthorized users automatically. Cannot remove the last active Owner account (permanent lockout protection).

πŸ” Security

  • Argon2id PIN hashing (t=3, m=64MB, p=4), auto-upgrades legacy SHA-256 on login
  • Biometric login β€” bound to one explicitly opted-in user per device (Settings β†’ Account). Any fingerprint on the device cannot authenticate as an arbitrary username.
  • Persisted 3-strike lockout β€” survives force-close, task-kill, and device reboot (stored via DataStore, not in-memory state)
  • 15-minute inactivity auto-logout
  • Persistent audit log at files/audit.log:
    • LOGIN_SUCCESS / LOGIN_FAILED (with attempt count + lockout flag)
    • LOGOUT
    • SALE_COMPLETED (receipt number, amount, payment method)
    • DISCOUNT_APPLIED
    • CREDIT_USED
    • SESSION_EXPIRED
  • Sync pairing code β€” LAN sync server requires a 6-digit code, preventing unauthorized WiFi devices from reading or injecting data

πŸ’Ύ Backup & Data

  • One-tap backup to Downloads/MiniMartPOS/backups/
  • Restore automatically closes and restarts the app (WAL/SHM files handled correctly)
  • 100% offline β€” Room SQLite v12, no internet required for core operation

🎨 UI / UX

  • Deep dark teal theme β€” readable in bright retail lighting
  • Time-of-day Swahili greeting: Habari ya asubuhi / mchana / jioni
  • Consistent gradient top bar across all screens
  • Press-scale animation on dashboard action cards
  • Color-coded payment method chips throughout
  • Animated scanner overlay: pulsing border, sweeping laser, corner brackets
  • Pull-to-refresh on dashboard (updates today + yesterday revenue)

πŸ—οΈ Tech Stack

Layer Technology
Language Kotlin 2.0
UI Jetpack Compose + Material 3
Architecture MVVM Β· Clean Architecture Β· Repository
DI Hilt
Database Room 2.6 (SQLite v12)
PIN Security Argon2id (argon2-kt 1.4.0)
Camera CameraX + ML Kit Barcode
Sync Custom HTTP server/client over LAN WiFi
Background WorkManager (low-stock + expiry alerts)
Preferences DataStore + SharedPreferences
Printing Bluetooth ESC/POS
Navigation Navigation Compose + SafeArgs
State SavedStateHandle for process-death recovery

πŸš€ Getting Started

git clone https://github.com/Baker0o7/MiniMart-Pos.git
cd MiniMart-Pos
./gradlew assembleDebug

First-launch credentials

Field Value
Username admin
PIN 1234

πŸ“ Project Structure

app/src/main/kotlin/com/minimart/pos/
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ dao/          ProductDao Β· SaleDao Β· UserDao Β· ExpenseDao
β”‚   β”‚                 ShiftDao Β· CustomerDao Β· SyncDao
β”‚   β”œβ”€β”€ db/           AppDatabase (v12) Β· DatabaseCallback (seed)
β”‚   β”‚                 AppMigrations (v8β†’v9β†’v10β†’v11β†’v12)
β”‚   β”œβ”€β”€ entity/       Product Β· Sale Β· SaleItem Β· User Β· Expense
β”‚   β”‚                 Shift Β· Customer Β· CreditTransaction Β· SyncLog
β”‚   └── repository/   (one per entity + SettingsRepository)
β”œβ”€β”€ di/               DatabaseModule
β”œβ”€β”€ printer/          ThermalPrinter Β· CashDrawerManager
β”œβ”€β”€ scanner/          MLKitScanner Β· KeyboardScanner Β· BluetoothScannerManager
β”œβ”€β”€ sync/             SyncServer Β· SyncClient
β”œβ”€β”€ ui/
β”‚   β”œβ”€β”€ screen/       16 screens (Login β†’ CreditOverview)
β”‚   β”œβ”€β”€ viewmodel/    Per-screen ViewModels + SessionViewModel Β· SyncViewModel
β”‚   β”œβ”€β”€ theme/        DT color tokens
β”‚   └── NavGraph.kt   Routes + BottomNavBar (cart badge) + AccessGuard
β”œβ”€β”€ util/             BackupManager Β· PdfReceiptGenerator Β· PinHasher
β”‚                     RoleManager Β· SessionManager Β· AuditLogger Β· PluDecoder
β”‚                     UiResult
└── worker/           LowStockWorker Β· ExpiryAlertWorker

βš™οΈ CI/CD Signing Secrets

SIGNING_KEY_ALIAS      = minimart
SIGNING_KEY_PASSWORD   = android
SIGNING_STORE_PASSWORD = android

Built with ❀️ for Kenyan mini-markets πŸ‡°πŸ‡ͺ

Download APK

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages