By Sivaji | SAP Commerce by Sivaji


In this post, we’ll explore the architecture of SAP Commerce (Hybris) — a powerful and flexible enterprise eCommerce platform used by major global brands.

🏗️ Overview

SAP Commerce follows a layered, modular architecture designed for scalability and clean separation of concerns. Each layer has its own responsibilities, ensuring easy customization, testing, and extension.

The architecture can be visualized as a flow from the frontend (storefront) to the database, with supporting APIs and integration layers.

(Insert Architecture Diagram Here — e.g., the image you generated earlier.)

🧩 SAP Commerce Code Architecture

SAP Commerce is built on top of Java and Spring Framework, providing both flexibility and enterprise-grade performance.

Layered Structure Overview
  1. Presentation Layer (Frontend / Storefront)
    • Handles user interaction through Accelerator templates or Spartacus (Angular).
    • Includes Controllers, JSPs, CMS Components.
    • Uses OCC REST APIs to communicate with the backend.
  2. Facade Layer
    • Acts as a bridge between controllers and business logic.
    • Provides simplified methods like ProductFacade, CartFacade.
  3. Service Layer
    • Implements the main business logic.
    • Handles transactions and orchestration between DAOs and Facades.
    • Examples: ProductService, CartService.
  4. DAO Layer (Data Access Object)
    • Responsible for querying the database.
    • Uses FlexibleSearch to perform CRUD operations.
    • Examples: ProductDao, OrderDao.
  5. Model Layer
    • Represents database entities (e.g., ProductModel, CartModel).
    • Models are defined in items.xml and managed by ModelService.
  6. Database Layer
    • Stores persistent data and indexes (e.g., product info, orders, users).
🔄 Data Flow Example

Let’s see how data moves across layers when a user views a product page:

  1. User requests /p/12345.
  2. ProductController calls ProductFacade.getProductForCode("12345").
  3. ProductFacade calls ProductService.
  4. ProductService invokes ProductDao.
  5. ProductDao fetches data via FlexibleSearch from the database.
  6. Response flows back: Model → Service → Facade → Controller → Frontend.
🧱 Extension-Based Development

SAP Commerce is structured around extensions.
Each extension encapsulates a specific feature or module.

Typical structure:

/hybris/bin/custom/myextension/
 ├── resources/
 ├── src/
 ├── web/
 ├── items.xml
 ├── spring/
 └── project.properties

Developers can add or override functionality by creating new extensions without modifying core ones — ensuring maintainability and upgrade safety.

🔗 Integration and OCC APIs

SAP Commerce provides OmniCommerce Connect (OCC) — a RESTful API layer enabling:

  • Integration with mobile apps or headless frontends.
  • Communication with external systems (ERP, Payment, Search, CRM).
  • Secure access using OAuth and role-based permissions.
🧠 Summary

SAP Commerce’s architecture is clean, layered, and extensible.
Each component has a clear responsibility, making it an ideal platform for complex enterprise eCommerce solutions.

In upcoming posts, I’ll dive deeper into:

  • How to create custom extensions
  • Building OCC APIs
  • Performance tuning tips

Stay tuned — and feel free to comment below if you have specific topics you’d like me to cover!

Leave a Reply