Project Overview
Rahva Raamat is Estonia’s largest bookstore, operating both physical stores and a large-scale e-commerce platform. This project focused on building a scalable backend capable of handling complex retail operations, including real-time inventory sync, multi-tier pricing, digital content delivery, and ERP integration. The system combines a modular Yii2 architecture, high-performance search, secure payment processing, and event-driven workflows to deliver a seamless omnichannel experience. It serves as a blueprint for building enterprise-grade e-commerce systems that integrate deeply with legacy business infrastructure.
Overview
Key Challenges
Rahva Raamat needed to unify physical retail operations across 17+ stores with a high-traffic e-commerce platform while maintaining real-time inventory accuracy, complex multi-tier pricing, ERP synchronization with Microsoft Dynamics NAV, and seamless delivery of both physical and digital products. Ensuring consistency across systems, handling multilingual content, and scaling search and payment infrastructure added significant complexity.
Our Solution
We engineered a modular Yii2-based enterprise backend using a multi-application architecture with a shared domain layer. The system integrates tightly with Microsoft Dynamics NAV for real-time inventory and order synchronization, implements a strategy-based pricing engine for multiple customer types, leverages Elasticsearch for high-performance search, and uses event-driven background processing with queues and cron jobs. Secure payment handling, digital content delivery, and API-first architecture enable scalable omnichannel commerce.
E-commerce Performance Metrics
Technical Details
Technical Architecture
Technical Features
Security Measures
- JWT-based authentication for API access
- OAuth2 / OpenID Connect for federated identity
- RBAC-based admin access control
- Secure payment handling with 3D Secure compliance
Scalability Features
- Redis caching layer for high-performance queries
- Elasticsearch for fast search and filtering
- Queue-based background job processing
- Event-driven architecture with Kafka
Testing Coverage
Detailed Solution
An enterprise-grade omnichannel commerce backend combining ERP synchronization, scalable search, multi-tier pricing, and event-driven architecture for high-volume retail operations.
Enterprise ERP-Driven Commerce Core
- •Deep integration with Microsoft Dynamics NAV for real-time data synchronization
- •Unified backend handling physical stores and online commerce seamlessly
- •Bidirectional sync for products, inventory, pricing, and orders
- •Consistency layer ensuring data integrity across ERP and e-commerce systems
- •Designed for high-volume retail with strict transactional accuracy
Modular Multi-Application Architecture
- •Yii2 multi-app structure (API, Admin, Console, OIDC)
- •Shared domain layer for unified business logic
- •API-first backend serving web, mobile, and POS systems
- •Monorepo architecture for maintainability and scalability
Event-Driven Processing & Scalability
- •Queue-based background jobs for heavy operations
- •Kafka-based event streaming for decoupled workflows
- •Cron jobs with concurrency guards and retry logic
- •Redis caching layer for high-performance queries
Multi-Channel Inventory System
- •Real-time stock synchronization across 17+ physical stores
- •Temporary table pipeline ensuring safe data processing
- •Per-store and aggregated availability tracking
- •Strict validation rules preventing overselling
Strategy-Based Pricing Engine
- •Dedicated pricing logic for retail, business, and wholesale customers
- •Supports VAT, discount stacking, and campaign overrides
- •Calculator-based architecture for extensibility
- •Consistent pricing across API, admin, and frontend layers
High-Performance Search System
- •Elasticsearch-powered product discovery
- •Sub-100ms autocomplete with multilingual support
- •Faceted filtering for categories, authors, publishers
- •Optimized indexing for 100,000+ products
Digital Content Delivery
- •Tokenized audiobook streaming using Wowza
- •DRM-aware e-book distribution system
- •Separate fulfillment pipeline for digital products
- •Instant secure access via entitlement validation
Order Processing Pipeline
- •Multi-stage order lifecycle with async processing
- •Retry-safe pipelines for payments and ERP sync
- •Handles edge cases like preorders and partial fulfillment
Implementation & Infrastructure
A robust enterprise e-commerce backend built on Yii2 multi-application architecture, enabling real-time ERP synchronization, high-performance search, and scalable omnichannel operations.
Enterprise E-Commerce Architecture (Yii2 Multi-App)
Rahva Raamat is built on a Yii2 Advanced Application architecture with multiple entry points including API, Admin, Console, and OAuth server. A shared domain layer ensures consistent business logic across all applications, enabling a scalable, enterprise-grade backend powering both online and physical retail operations.
Core Technical Decisions
- Monorepo multi-application architecture instead of microservices
- Strategy-based pricing engine supporting multiple customer types
- Temporary table pipeline for safe ERP data synchronization
- Event-driven processing using queues and cron jobs
- Redis caching and Elasticsearch for high-performance queries
- Bloom filter-based URL redirect system for fast routing
Layered System Architecture
The platform follows a layered architecture combining API-driven commerce, shared business logic, and enterprise-grade infrastructure integrations.
Presentation Layer
- SPA frontend consuming REST API
- Multi-language support (Estonian, English, Russian)
- Mobile and POS integrations
- SEO-optimized product and content pages
Application Layer
- Yii2 REST API controllers (60+ endpoints)
- Pricing engine and business logic services
- ERP sync handlers and order processing jobs
- OAuth2/OIDC authentication services
Data & Search Layer
- MySQL/MariaDB with 500+ migrations
- Redis caching layer with high hit ratio
- Elasticsearch for search and filtering
- NAV ERP integration via MSSQL
Performance & Scalability Infrastructure
- Redis caching achieving 90%+ cache hit ratio
- Elasticsearch enabling sub-100ms search responses
- Queue-based background jobs for consistent performance
- Horizontal scalability via stateless API architecture
Security & Transaction Integrity
- JWT-based authentication with OAuth2/OpenID Connect support
- Secure payment processing with EveryPay and 3D Secure
- Idempotent order processing with retry-safe pipelines
- Data consistency ensured via staged ERP synchronization flows
Gallery
Visual transformation showcasing the dramatic improvements across all interfaces




"Rahva Raamat’s platform demonstrates how enterprise e-commerce systems can scale efficiently while maintaining performance, flexibility, and seamless integration with legacy ERP systems."
Project Stakeholders
Enterprise Retail Team
Project Details
Duration
Multi-phase (Ongoing Evolution)
Industry
E-Commerce / Retail / Digital Content
Team
Backend Architect, Senior PHP Developer, DevOps Engineer, Database Administrator, Frontend Developer, QA Engineer
Technologies Used
Project Goals
- API-First Architecture — Design the backend as a RESTful API that can serve any frontend (web SPA, mobile app, POS system) without modification.
- Scalable Search — Implement Elasticsearch-powered product discovery with multilingual support, dynamic faceted filters, and sub-100ms autocomplete responses.
- Extensible Pricing Engine — Build a calculator pattern that supports arbitrary client types, discount stacking rules, campaign overrides, and per-product VAT handling without code duplication.
- Resilient Background Processing — Implement queue-based job processing with concurrency guards, failure handling, retry logic, and operational monitoring.
- Developer Productivity — Maintain a well-structured monorepo with clear separation of concerns, comprehensive documentation, Docker-based local development, and automated testing.


