BiTi E-Commerce Platform is a robust, production-ready, full-stack e-commerce solution built with a monorepo. It encompasses a highly secure Spring Boot backend API, two Next.js web applications (an Admin Console and a Customer Storefront), and a cross-platform Flutter mobile app. The platform covers the full commerce lifecycle — from product catalog and multi-gateway payments, through marketing automation and CMS, to analytics and customer support — designed following Clean Architecture and Domain-Driven Design principles.

The system operates across four deeply integrated applications using RESTful APIs, real-time WebSocket/STOMP, and Server-Sent Events. All core business logic, security, and persistence are centralized in the backend.
Admin Console ─┐
Storefront ├─ REST / WebSocket / SSE ──► Spring Boot Backend ──► PostgreSQL (Flyway through V098)
Mobile App ─┘ │
├─ Redis OTP, token revocation, rate limiting, Spring Cache
├─ WebSocket/STOMP Real-time admin notifications (/ws)
├─ SSE Live order status push (/api/orders/stream)
├─ Storage Local / Google Cloud Storage / Supabase
├─ Stripe Card payments + webhooks
├─ PayPal Redirect + capture + webhooks
├─ Bakong KHQR Cambodia QR payments (NBC)
├─ ABA PayWay Cambodia QR payments
└─ SMTP Transactional email + PDF invoices + outbound webhooks
ROLE_* + PERM_* authority model and @PreAuthorize method security.ROLE_SYSTEM_ADMIN > ROLE_ADMIN — super admin bypasses all role and permission checks./api/auth/refresh) — old JTI revoked in Redis on refresh.EncryptionService) for all sensitive credentials stored in the database (payment gateway API keys, SMTP password) — zero plaintext secrets at rest.isNew/isFeatured/isSale).metaTitle, metaDescription) on products and blog posts; generateMetadata server layouts for Next.js SSR SEO.bundlesEnabled feature flag in store settings./api/cart) and guests (localStorage + /api/orders/guest).StoreSettings./api/customers/me/addresses): auto-default on first save, default promotion on delete, per-customer isolation; checkout prefills the default address./api/webhooks/stripe./api/webhooks/paypal./api/payments/{id}/khqr/status./api/payments/{id}/aba-payway/status./api/payments/guest/**.secretKey, webhookSecret, apiKey, token) masked in the UI.isCurrentlyActive() enforced at checkout.createAppTheme() factory without redeploy.--brand-primary and --brand-primary-rgb CSS variables via BrandColorInjector.StoreSettings.icon_options table), title, description, and individual enable/disable toggle.DRAFT/PUBLISHED status, published date, view count./api/blog/content-image; stored via pluggable storage./api/blog/categories; admin can add new categories inline.metaTitle, metaDescription) on every post./api/blog/public/**; full CRUD requires admin auth.CONTACT or SUPPORT); stored in contact_messages table./dashboard/contact-messages — read/unread management, reply via mailto, delete; unread count badge in header.LOW/MEDIUM/HIGH/CRITICAL).OPEN → IN_PROGRESS → RESOLVED → CLOSED.TawkToWidget component).emailNotifications, pushNotifications, and orderUpdates flags in StoreSettings guard all email dispatch and in-app notification creation./api/orders/stream?token=..../ws with /topic broker; admin panel subscribes for real-time bell notifications, and per-user notifications are pushed to /topic/notifications/{userId} (consumed by the admin bell and the mobile app).Notification records per user; surfaced in the admin header bell and the mobile notifications screen, delivered live over STOMP.StoreSettings.BEFORE/AFTER) configurable per store; exchange rates managed in the database; storefront CurrencyContext converts prices client-side.LanguageContext groundwork in storefront for full i18n.*Test); Failsafe runs Docker-backed integration tests (*IT) on Testcontainers PostgreSQL, validating Flyway migrations from an empty database. Shared infrastructure provides MockMvc auth helpers, DB cleanup, reusable test data, and deterministic fakes for storage, mail, Redis token/OTP paths, websocket notifications, and payment gateways. JaCoCo enforces a coverage ratchet gate that cannot regress.flutter_test + mocktail cover fromJson parsing, domain services, and ChangeNotifier controller state transitions; an integration_test smoke harness validates on-device boot.backend, admin, storefront, mobile), each gating its app and uploading coverage/test-report artifacts. Strategy documented in docs/testing-strategy.md.Store domain; products and data are scoped per store./api/menus/tree/my filtered per user's roles.PERM_* authorities across catalog, orders, payments, reports, settings, and more; roles are fully configurable from the admin UI./backend)| Layer | Technology |
|---|---|
| Core | Java 21, Spring Boot 3.5.6, Spring Security, Spring Data JPA |
| Database | PostgreSQL 16, Flyway migrations through V098, Hibernate + vladmihalcea JSONB |
| Cache | Redis (OTP, token revocation, Bucket4j rate-limit buckets, Spring Cache) |
| Security | JWT (jjwt 0.12.6), Bucket4j 8.10.1, AES-256-GCM (EncryptionService), BCrypt |
| Real-time | Spring WebSocket/STOMP (SockJS), Server-Sent Events |
| Payments | Stripe SDK 26, PayPal SDK 2.0, Bakong KHQR, ABA PayWay |
| Storage | Google Cloud Storage 2.42, Supabase, Local FS (pluggable via StorageService) |
| Spring Mail (SMTP, runtime-configurable) | |
| iText 7.2.5 (invoices + report exports) | |
| API Docs | Springdoc OpenAPI 2.6 (Swagger UI at /swagger) |
| Testing | JUnit 5, Mockito, Spring Security Test, Testcontainers PostgreSQL, Surefire/Failsafe, JaCoCo ratchet |
| CI | GitHub Actions backend workflow with JUnit and JaCoCo artifacts |
| DX | MapStruct 1.6.3, Lombok 1.18.34, Sentry, Spring Actuator |
/admin)| Layer | Technology |
|---|---|
| Framework | Next.js 16.0.10 (App Router), React 19, TypeScript |
| UI | Material UI v7, Emotion |
| Charts | Recharts 2 |
| Editor | TipTap v3 (rich text: blog content with image upload) |
| State & Data | TanStack Query 5, Zustand 5, Axios |
| Forms | React Hook Form 7, Zod 4 |
| Real-time | STOMP.js 7, SockJS |
| Error Tracking | Sentry (@sentry/nextjs) |
| Testing | Vitest + React Testing Library (unit/component), Playwright (E2E) |
/storefront)| Layer | Technology |
|---|---|
| Framework | Next.js 16.0.10 (App Router), React 19, TypeScript |
| UI | Tailwind CSS v4, Framer Motion 12, Lucide React |
| Carousels | Swiper 12 |
| State & Data | TanStack Query 5, Axios |
| Payments | Stripe React JS + Stripe.js |
| Brand Theming | BrandColorInjector injects --brand-primary CSS vars from store settings |
| Live Chat | Tawk.to widget (TawkToWidget) |
| Error Tracking | Sentry (@sentry/nextjs) |
| Testing | Vitest + React Testing Library (unit/component), Playwright (E2E) |
/mobile)| Layer | Technology |
|---|---|
| Framework | Flutter SDK >=3.3.4, Dart |
| State | Provider + ChangeNotifier controllers (flutter_bloc also available) |
| Architecture | Clean Architecture, get_it, injectable, dartz |
| Networking | Dio 5 |
| Storage | flutter_secure_storage, shared_preferences |
| Payments | flutter_stripe 9 |
| Navigation | go_router 14 |
| Media | cached_network_image, image_picker, webview_flutter |
| Models | freezed, json_serializable |
| QR & Real-time | qr_flutter (KHQR/ABA QR), stomp_dart_client (STOMP), SSE order stream |
| Error Tracking | Sentry (sentry_flutter) |
| Testing | flutter_test + mocktail (unit/controller), integration_test (smoke) |
Mobile feature parity: full checkout across all gateways — Stripe, PayPal, Bakong KHQR & ABA PayWay (in-app QR sheet with live status polling), and Cash on Delivery; backend-backed saved address book; live order tracking via SSE; real-time notifications via STOMP (/topic/notifications/{userId}); FAQ + Contact Us; secure token storage with automatic 401 refresh; build-time API base URL via --dart-define.
Default admin login (seeded): [email protected] / sysadmin@2026
Mobile: Open /mobile in an IDE with Flutter configured. Point the API base URL to your machine's LAN IP (e.g., http://192.168.x.x:1221) and run flutter run.
The platform is containerised end-to-end and ships with first-class self-hosting:
docs/DEPLOY_VPS.md.deploy.sh pulls the latest code,
rebuilds the images, waits on the backend healthcheck, and prunes dangling layers without
ever touching the Postgres or uploads volumes. Production overlay:
docker-compose.prod.yml./api/orders/stream) and the WebSocket/STOMP endpoint (/ws) unbuffered, so live order
status and the admin notification bell work through TLS.v*) or manual dispatch, a GitHub Actions
matrix builds and pushes the three images to GitHub Container Registry; the server then
runs prebuilt, SHA-tagged images (docker-compose.deploy.yml)
for zero-build, instant-rollback releases. Documented in
docs/DEPLOY_CICD.md.render.yaml / GUIDE.md, and a Cloudflare-fronted variant.The BiTi E-Commerce Platform is feature-complete and production-ready. Identified areas for future enterprise growth:
LanguageContext groundwork is already in place in the storefront) and live exchange rate API integration for dynamic currency switching.