Skip to content

Miva Merchant Architecture / Ecosystem#


Miva Merchant is a high-performance, scalable, and flexible e-commerce platform, implemented as a (mostly) single-tenant monolithic web application.

Server-side logic is implemented in MivaScript, which is a powerful proprietary scripting language developed by Miva. It serves as the backbone for implementing dynamic functionality and customizations within Miva stores. Script execution is supported through CGI or FastCGI invocation.

Configuration is stored primarily in an SQL database. Miva Merchant 10.00.00 and above support MySQL/MariaDB and PostgreSQL. MivaSQL may be used for storage of encryption keys.


Domain/Store#

Miva Merchant divides its configuration into two elements: Domain-level and Store-level.

Domain Configuration#

Domain configuration settings generally represent configuration that is global to a particular Miva Merchant installation, including:

  1. Available modules
  2. URL configuration specific to the MivaScript execution environment
  3. Administrative items, such as permitted users and their permissions
  4. Other settings that span multiple stores within a single Miva Merchant installation

Store Configuration#

Within a single installation of Miva Merchant, multiple Stores may be configured. Each store has its own, entirely isolated catalog, configuration, and shopping interface. This slightly blurs the “single-tenant” definition, and many years ago was used for rudimentary multi-tenant installations. In the modern era, multiple stores have become more of a logical configuration separation tool for single tenants. One Multi-Domain configuration, for example, uses separate stores within a single domain.

Store configuration is partitioned within the database schema by prefixing table names with g.Store_Table_Prefix. This prefix is in the form sNN_, where NN is the two-digit padded internal store ID. Each store thus has its own, isolated copy of the store-level database schema.

Some domain-level items, such as URIs and user permissions, are not isolated at the store level but are shared across the domain and cross-reference individual store data.


Modules#

Miva Merchant provides a server-side API that allows pluggable units of code called Modules. The module API is divided into different features. A single module implements one or more features, each of which has a set of required functions and behavior.

Modules must be written in MivaScript and are deployed as compiled files alongside the core Miva Merchant code.


Frontend/Backend#

Logically, Miva Merchant is divided into two separate behavioral units:

Frontend#

The frontend, or shopper interface, presents the catalog to shoppers and provides all of the expected e-commerce storefront functionality, such as:

  • Shopping basket
  • Customer accounts
  • Navigation
  • Search
  • Wishlists
  • Checkout process

Backend#

The backend, or administrative interface, allows one or more users to configure, design, maintain, and operate the store. Administrative access is controlled through a role-based access system.


merchant.mvc#

“merchant.mvc” serves as Miva’s equivalent of an index page, akin to “index.php” in WordPress or “index.html” in traditional web development. It operates as a controller page, responsible for processing incoming requests, executing corresponding functions, and orchestrating various operations within the Miva Merchant environment.

Functions:#

  1. Initialization and Configuration:

    • Establishes database connections.
    • Loads essential configurations required for store functionality.
    • Handles store selection in multi-store or mall setups.
  2. Request Processing:

    • Validates requests, ensuring the existence of the requested store and correct store codes.
    • Executes actions based on incoming requests, such as adding products to the cart, updating quantities, or managing user authentication.
  3. Screen Rendering:

    • Renders requested screens/pages (e.g., storefront) and delivers them to the browser for display.
  4. Maintenance Mode and UI Exceptions:

    • Manages maintenance mode settings to restrict access during maintenance periods.
    • Handles user interface errors and exceptions, ensuring seamless user experiences.

Source Code#

  • The complete source code of “merchant.mvc” is available in Miva Merchant’s limited source kit.
  • Key functions within the source code include:
    • Loading configurations from “config.mvc”.
    • Main processing in the “Merchant” function.
    • Action execution in the “Merchant Actions” function.
    • Screen rendering in the “Merchant Screens” function.
    • Maintenance mode handling and error management functions.

JSON API#

Miva Merchant exposes many operations through a procedural API. API input and output are in JSON format. The transport layer is typically HTTPS.

  • Authentication: Shared secret or SSH keypair, with optional IP address restrictions
  • Authorization: Can be assigned at the user, role, or individual function level