Principal architecture package

Production blueprint for ShopNear at national scale.

This frontend includes the product-facing slice while documenting the Java 21, Spring Boot 3, PostGIS, Redis, WebSocket, Docker, Kubernetes, AWS, Terraform, and CI/CD architecture.

Security

Spring Security, JWT access tokens, refresh token rotation, OAuth2 Google login, RBAC, rate limiting, audit logging, XSS and CSRF hardening.

GenMB auth integrated in prototype

Data platform

PostgreSQL with PostGIS geography columns, Flyway migrations, Hibernate, MapStruct DTO mapping, Redis caching, and connection pooling.

Distance-based sorting

DevOps

Docker Compose for local infrastructure, Kubernetes manifests, Nginx ingress, GitHub Actions, Terraform AWS modules, and blue-green deployments.

Horizontal scaling

High-level architecture diagram

Event-driven microservices with CQRS where search, recommendations, chat, analytics, and notifications need independent scale.

Identity Service: GenMB auth in this prototype, Spring Security JWT and OAuth2 in the production backend.
Catalog Service: shops, products, categories, inventory, offers, image metadata, and moderation status.
Geo Search Service: PostGIS geography columns, GIST indexes, ST_DWithin filtering, and distance ranking.
Chat Service: WebSocket rooms, typing events, read receipts, media messages, Redis presence, and FCM notifications.
Recommendation Service: distance, ratings, search history, purchase intent, and popularity blended with AI semantic search.
Admin Service: business verification, review moderation, fraud signals, audit logs, and platform analytics.

ER diagram entities

usersrolesshopsproductscategoriesreviewschat_roomsmessagesoffersnotificationsfavoritesdelivery_partnersordersorder_itemsaudit_logs

Indexing strategy

GIST shops.location geography(Point,4326)
BTREE products(shop_id, category_id)
GIN products.tags
BTREE reviews(shop_id, rating)
BTREE messages(chat_room_id, created_at)
BTREE audit_logs(actor_id, created_at)

Testing and production readiness

JUnit 5 unit tests for domain policies, pricing, offers, and recommendation scoring.
Mockito service tests plus Spring Boot integration tests with Testcontainers PostgreSQL, Redis, and Kafka-compatible event streams.
API tests generated from OpenAPI contracts with role-based authorization coverage.
Gatling load tests for 1M users, 100k shops, p95 under 200ms, and bursty offer notifications.
Built with GenMB
Built with GenMB