MerchantCore API

November 13, 2025
MerchantCore API
TypeScript
Fastify
Prisma
PostgreSQL

MerchantCore API is an open-source online shop backend API designed to support multiple online shops using a multi-schema architecture.

View Repository on GitHub

Unlike traditional setups that require separate backend deployments for each store, MerchantCore API enables a single API instance to serve many online shops. Each shop can maintain a different frontstore while sharing the same robust backend infrastructure. Crucially, data isolation is achieved by separating database schemas, ensuring that each shop's data remains distinct and secure.

Problem Statement

Managing multiple online shops often comes with significant challenges:

MerchantCore API solves these problems by consolidating backend logic into a single, multi-tenant service that significantly reduces operational overhead.

Multi-Schema Architecture

The API leverages PostgreSQL schemas to provide robust multi-tenancy:

+-------------------+
|     PostgreSQL    |
|      Database     |
|                   |
|  +-------------+  |
|  | Schema:     |  |
|  | Shop A      |  |
|  +-------------+  |
|                   |
|  +-------------+  |
|  | Schema:     |  |
|  | Shop B      |  |
|  +-------------+  |
|                   |
|  +-------------+  |
|  | Schema:     |  |
|  | Shop C      |  |
|  +-------------+  |
+-------------------+

Request Flow

Incoming requests are routed efficiently to the correct data source:

  1. Shop identification: The system identifies the target shop via the subdomain, a custom header, or a unique shop code.
  2. Dynamic schema resolution: The API determines which database schema corresponds to the identified shop.
  3. Queries executed: All database queries are executed within the context of the resolved schema.

Tech Stack

Benefits

Summary

MerchantCore API delivers a "one API, many shops" solution, combining the efficiency of a single backend with the security of isolated data schemas.