Skip to content

Dacoband/stream-cart-mobile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

400 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stream Cart Mobile

Stream Cart Logo

A production‑ready microservices-based live commerce & e‑commerce Flutter application

Flutter Dart License


πŸ“– Table of Contents


🎯 Overview

Stream Cart Mobile is a production‑oriented live commerce + e‑commerce super‑app built with Flutter and powered by a microservices backend. It implements Domain-Driven Design (DDD) + Clean Architecture, enabling clear separation of concerns, scalability, testability, and rapid feature evolution.

πŸ‡»πŸ‡³ TΓ³m tαΊ―t: Ứng dα»₯ng thΖ°Ζ‘ng mαΊ‘i Δ‘iện tα»­ & livestream vα»›i kiαΊΏn trΓΊc sαΊ‘ch (DDD, Clean Architecture) hα»— trợ giỏ hΓ ng, Δ‘Ζ‘n hΓ ng, voucher, chat realtime, thΓ΄ng bΓ‘o Δ‘αΊ©y, livestream (LiveKit), SignalR, tΓ¬m kiαΊΏm, quαΊ£n lΓ½ Δ‘α»‹a chỉ, biαΊΏn thể sαΊ£n phαΊ©m, cα»­a hΓ ng.

🎯 Core Value

  • πŸ›’ Unified Commerce: Catalog, variants, vouchers, cart, checkout, orders
  • πŸŽ₯ Interactive Live Streaming: LiveKit + realtime chat + pinned products
  • πŸ’¬ Real-time Chat & Notifications: SignalR + Firebase Cloud Messaging
  • ⚑ Reactive UX: BLoC state management & granular loading states
  • πŸ” Secure: JWT auth, secure token storage, guarded APIs
  • 🧩 Extensible Domain Model: Modular feature packages & use cases

βœ… Current Status (Aug 2025)

  • βœ… Home / Explore (products, categories, shops, banners)
  • βœ… Authentication & Profile (JWT, secure storage)
  • βœ… Product Variants, Cheapest Variant Resolution
  • βœ… Cart (add / update / bulk select / preview / clear)
  • βœ… Checkout Preview & Order Creation Flow (price breakdown)
  • βœ… Order Management (status tabs, detail, timeline, reviews scaffold)
  • βœ… Live Streaming (join, active streams, products, pinned items, messages)
  • βœ… Real-time Chat (rooms, unread count, typing indicators)
  • βœ… Notifications (list, mark read, unread counter, SignalR + FCM + local)
  • βœ… Address Book (CRUD, default selection)
  • βœ… Vouchers (shop vouchers apply / list)
  • βœ… Search (products + search history service)
  • βœ… Theming & Responsive Layout (Material 3 + Google Fonts)
  • βœ… Push Notifications (foreground / background handlers)
  • βœ… Dependency Injection (GetIt) & modular use cases
  • 🚧 Payment Gateway Integration (stubbed payment method selection)
  • 🚧 Stream Analytics / Insights
  • 🚧 Advanced Recommendation Engine

✨ Feature Matrix

πŸ›οΈ Commerce Core

  • Products & Categories (filter, search, variants, cheapest variant resolver)
  • Shops (listing, product count per shop)
  • Vouchers (list + apply at checkout preview)
  • Cart (add/update/remove, multi‑select, preview order, bulk deletion)
  • Checkout Preview (price breakdown, shipping, voucher, payment method select)
  • Orders (tabbed status lists, detail, status timeline, price breakdown, review scaffold)
  • Addresses (CRUD + default selection)

πŸŽ₯ Live Streaming & Engagement

  • Join active live streams (LiveKit join token connect)
  • Products & pinned products per stream (debounced reload)
  • Live stream chat (separate from standard chat domain)
  • Viewer stats & real-time events pipeline

πŸ’¬ Real-time Communication

  • SignalR abstraction (chat + notifications + typing indicators)
  • Chat Rooms (user/shop, load messages, search, unread counts)
  • Typing indicators, join/leave events, reconnection strategy

πŸ”” Notifications

  • FCM + local notifications (foreground / background / terminated)
  • SignalR real-time push (new + updated notification merging)
  • Pagination & filtering (type, read state), unread counter

πŸ‘€ User & Auth

  • JWT Login / Me endpoint, secure storage, automatic token hydration
  • Role awareness (user / shop contexts prepared)
  • Profile display & avatar

🧱 Architecture & Quality

  • DDD Layers (Entities, Repositories, UseCases)
  • Clean separation (data / domain / presentation)
  • GetIt DI (ready for Injectable codegen)
  • Consistent error & loading state modeling
  • Modular BLoC per feature (auth, cart, chat, order items, notification, livestream, address, voucher, variants, etc.)

πŸ” Security & Reliability

  • Secure token storage (flutter_secure_storage)
  • Graceful reconnection routines (SignalR, LiveKit probes)
  • Defensive parsing & failure surfaces (Either / Failures)

πŸ›  Developer Experience

  • Build runner ready (retrofit, json_serializable, hive, injectable)
  • Search history service persisted locally
  • Clear feature folder conventions

πŸš€ Backlog / Planned

  • Payment gateway integration (online methods)
  • Advanced analytics (viewer retention, conversion funnels)
  • Recommendation / personalization engine
  • In‑stream purchase overlay & scheduled pinning
  • Moderation tools & reporting flows
  • Multi-language i18n expansion

πŸš€ Current Development Status (August 2025)

βœ… Recently Completed (Highlights)

  1. Full cart lifecycle (bulk selection + preview + voucher application)
  2. Order listing, detail, status timeline & price breakdown
  3. Live streaming join/connect flow (LiveKit + join token handshake)
  4. Real-time chat (typing, unread counts, reconnection, search)
  5. Unified notifications (SignalR + FCM + local)
  6. Product variants + cheapest variant / availability use cases
  7. Shop vouchers & shop listing components
  8. Address management & checkout integration

πŸ”„ Active Work

  • Payment gateway integration layer
  • Stream analytics & engagement metrics

πŸ“‹ Next (Planned)

  1. Recommendation & personalization services
  2. Advanced moderation & reporting in streams
  3. Multi-language i18n expansion
  4. Full test coverage ramp-up (unit + widget + integration)

πŸ› οΈ Recent Updates (Aug 2025)

πŸ”§ Fixes

  • Reconnection improvements (SignalR & LiveKit lifecycle aware)
  • Debounced product reload in live streams (API efficiency)
  • Notification pagination + unread counter sync issues resolved
  • Variant price resolution & null safety hardening

πŸ†• Additions

  • Order domain (detail, status timeline, review scaffold)
  • Live stream chat + pinned products + viewer stats events
  • Vouchers (list + apply) & address integration in checkout preview
  • Bulk cart operations & selected items preview order path
  • Search history persistence service
  • Local + push notification orchestration service

🎨 UX Enhancements

  • Consistent skeleton shimmer loading states
  • Payment + status badge components
  • Improved empty / error / retry states across lists
  • Unified typography (Be Vietnam Pro via Google Fonts)

πŸ—οΈ Architecture

Stream Cart Mobile follows Clean Architecture + DDD with feature‑oriented modularity:

lib/
β”œβ”€β”€ 🎯 core/                    # Config, constants, env, DI, routing, network, services
β”œβ”€β”€ πŸ“Š data/                    # Datasources (remote/local), models, repos impl
β”œβ”€β”€ 🏒 domain/                  # Entities, repositories (contracts), use cases
└── 🎨 presentation/            # BLoCs, pages, widgets, themes

Additional Feature Domains Present:

  • cart/, order_item/, notification/, chat/, livestream/, address/, voucher/, product_variants/, shop/, search/

🧩 Key Services

  • SignalRService – unified hub connection & callbacks (chat, notifications)
  • LiveKitService – media session, room events, probing & metrics
  • FirebaseNotificationService – FCM + local notification orchestration
  • SearchHistoryService – persistent recent searches

πŸ”„ Real-time Flow

SignalR events β†’ Bloc events β†’ UI state updates (chat, notifications, typing, viewer stats) LiveKit room events β†’ LiveStreamBloc (participants, probing, pinned products sync)

πŸ”— API Integration Status (Live)

  • βœ… Auth: /api/auth/login, /api/auth/me
  • βœ… Categories: /api/categorys
  • βœ… Products: /api/products, /api/products/search
  • βœ… Product Variants: /api/product-variants/*
  • βœ… Cart: /api/cart/*
  • βœ… Orders: /api/orders/*
  • βœ… Vouchers: /api/vouchers/*, /api/shop-vouchers/*
  • βœ… Live Streams: /api/livestreams/* + LiveKit signaling
  • βœ… Notifications: /api/notifications/* + SignalR hub
  • βœ… Chat: /api/chat/* + SignalR hub
  • βœ… Addresses: /api/addresses/*
  • 🚧 Payments: (gateway integration pending)

πŸ”§ Tech Stack

🎨 Framework

  • Flutter 3.7.2+, Dart 3.7.2+

πŸ›οΈ State Management

  • flutter_bloc (feature BLoCs) + equatable

🌐 Networking & Realtime

  • dio, retrofit, json_serializable, signalr_core, livekit_client

πŸ’Ύ Storage

  • flutter_secure_storage, shared_preferences, hive / hive_flutter

πŸ”§ Dependency Injection

  • get_it (ready for injectable code generation)

πŸ›  Codegen & Dev

  • build_runner, retrofit_generator, json_serializable, hive_generator, injectable_generator

πŸ”’ Security & Utils

  • crypto, flutter_dotenv, dartz, intl

🎨 UI & Navigation

  • Material 3, Google Fonts (Be Vietnam Pro), cached_network_image, shimmer, flutter_svg, flutter_slidable
  • Custom routing (AppRouter + observer)

πŸ”” Notifications & Messaging

  • firebase_core, firebase_messaging, flutter_local_notifications

πŸ“± Screenshots

Screenshots (updated set incoming). The app currently features:

🏠 Home - Catalog + categories + banners + search
πŸ‘€ Profile - Authenticated user info
πŸ›’ Cart & Checkout Preview - Voucher + price breakdown
πŸ“¦ Orders - Status tabs & detail timeline
πŸŽ₯ Live Stream - Realtime video + chat + pinned products
πŸ’¬ Chat - Realtime rooms & typing indicators
πŸ”” Notifications - Realtime + push hybrid

Run on Web: flutter run -d web


πŸš€ Getting Started

πŸ“‹ Prerequisites

Ensure you have:

  • βœ… Flutter SDK 3.7.2+ (includes Dart)
  • βœ… Android Studio or VS Code with Flutter extension
  • βœ… Git
  • βœ… Firebase project (for push notifications) – optional for core features

πŸ”§ Installation

  1. Clone repository
    git clone https://github.com/yourusername/stream-cart-mobile.git
    cd stream-cart-mobile/stream_cart_mobile
  2. Install dependencies
    flutter pub get
  3. (Optional) Create .env
    echo "API_BASE_URL=https://brightpa.me" > .env
    echo "ENVIRONMENT=development" >> .env
  4. Run the app
    flutter run -d web
    # or
    flutter run

Default API base points to production: https://brightpa.me.

βš™οΈ Environment (Optional)

API_BASE_URL=https://brightpa.me
API_TIMEOUT=30000
ENVIRONMENT=development
ENABLE_DEBUG_LOGGING=true

Core API (subset):

  • Auth: /api/auth/login, /api/auth/me
  • Catalog: /api/products, /api/products/search, /api/categorys
  • Cart: /api/cart/* | Orders: /api/orders/* | Vouchers: /api/vouchers/*
  • Live Streams, Chat & Notifications: REST + SignalR hubs + LiveKit server

Auth Flow: Provide valid backend credentials (no demo account bundled).


πŸ”¨ Development

Run

flutter run -d web
flutter run            # auto device detection
flutter run -d android # specify platform

Debug Options

flutter run --dart-define=ENVIRONMENT=development

Code Generation

Run when adding retrofit APIs / json models / hive adapters / injectable config:

flutter pub run build_runner build --delete-conflicting-outputs
flutter pub run build_runner watch

Code Quality

flutter format .
flutter analyze
dart fix --apply

πŸ§ͺ Testing

Run Tests

flutter test
flutter test --coverage

Structure (Planned Expansion)

test/
β”œβ”€β”€ unit/          # Domain, use cases, blocs
β”œβ”€β”€ widget/        # Widget tests (goldens planned)
└── integration/   # End-to-end flows

Current: Core flows manually tested; automated coverage ramp-up in progress.


πŸ“¦ Build & Deploy

Android

flutter build apk --release
flutter build appbundle --release
flutter build apk --release --obfuscate --split-debug-info=build/debug-info/

iOS (macOS only)

flutter build ios --release
flutter build ipa --release

Web

flutter build web --release

Desktop (Dev)

flutter run -d windows

Deployment (High Level)

  • Android: Sign, upload AAB to Play Console
  • iOS: Archive in Xcode, distribute via App Store Connect
  • Web: Host /build/web on static hosting / CDN

🀝 Contributing

  1. Fork repository
  2. Create feature branch:
    git checkout -b feature/amazing-feature
  3. Implement & test
  4. Ensure quality:
    flutter analyze
    flutter test
    flutter format .
  5. Commit & push:
    git commit -m "feat: add amazing feature"
    git push origin feature/amazing-feature
  6. Open Pull Request

Standards

  • Effective Dart style
  • Tests for new logic (where reasonable)
  • Clear commit messages (conventional preferred)

πŸ“ž Support & Contact

🎯 Project Status

  • Stage: Active Development (Core Feature‑Complete)
  • API: Production microservices connected
  • Real-time Stack: SignalR + LiveKit + FCM operational
  • Platforms: βœ… Web βœ… Android βœ… iOS βœ… Windows (dev)
  • Last Updated: Aug 2025

πŸ“„ License

Licensed under the MIT License – see LICENSE.


Made with ❀️ using Flutter

πŸ”₯ Core Features Production‑Ready

⭐ Star this repo if it helps you!


Quick Start: git clone β†’ cd stream_cart_mobile β†’ flutter pub get β†’ flutter run -d web

About

Stream Cart Mobile is a cutting-edge e-commerce mobile application built with Flutter, designed specifically for live streaming commerce. The application follows Domain-Driven Design (DDD) principles with Clean Architecture patterns, ensuring scalability, maintainability, and testability.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors