Skip to content
Back to Articles
Architecture & Technology7 min readAugust 16, 2026

How ecommercetool.io Works: A Deep Look Under the Hood

An architectural deep dive into Next.js 14 App Router, deterministic TypeScript engines, and browser storage persistence.

EC
Engineering & Product Team
ecommercetool.io Core Architects

1. The Zero-Backend Architecture Paradigm

Most modern web applications follow a client-server paradigm: user input → network payload → API gateway → application server → relational database → network response. While standard, this architecture introduces network latency (100ms–800ms per action), cold starts, database hosting costs, and security attack vectors.

ecommercetool.io inverts this model completely. The entire application runs as a static, pre-compiled Single Page Application (SPA) executed directly inside the user’s browser JavaScript runtime engine.

Sub-5ms Execution Time

Because state mutations happen directly in browser memory without HTTP round-trips, calculations complete in under 5 milliseconds.

2. Pure Domain Calculation Engines

A fundamental flaw in spreadsheet-driven workflows is calculation fragmentation. For example, if a seller updates their return rate in one sheet, that adjustment rarely propagates correctly to inventory stock, net sales, and GST tax liability.

In ecommercetool.io, all business logic is organized into Pure Domain Services written in strictly-typed TypeScript:

Calculations Engine (calculations.ts): Pure math functions computing Gross Revenue, Net Units, Marketplace Commission, Shipping Fees, and Net Payouts.
Return Discrepancy Engine (returnsService.ts): Tracks Expected Return Rates vs Physically Received Stock to isolate courier leakage.
Inventory Ledger (inventoryService.ts): Calculates Physical Stock = Opening - Dispatches + Actual Returns.
Tax Breakdown Engine (taxBreakup.ts): Computes exact taxable base value, CGST, SGST, IGST, and INR amount in words.
Settlement Reconciler (settlementService.ts): Reconciles marketplace remittances with custom tolerance thresholds.

3. Browser LocalStorage Persistence Layer

To ensure your data persists across browser reloads without requiring a backend database, ecommercetool.io utilizes a Schema-Validated LocalStorage Abstraction Layer (`storageService.ts`).

Every record (Product, Dispatch, Order, Return, Settlement) is validated against strict TypeScript interfaces before writing to disk. To prevent data corruption during imports or updates, the storage engine takes an in-memory snapshot before writing and automatically rolls back if an anomaly is detected.

Safe Transaction & Rollback Pattern in storageService.ts
// Atomic snapshot & safe write pattern
const snapshot = localStorage.getItem(STORAGE_KEY);
try {
  validateSchema(newPayload);
  localStorage.setItem(STORAGE_KEY, JSON.stringify(newPayload));
} catch (error) {
  // Automatic rollback to restore safety
  if (snapshot) localStorage.setItem(STORAGE_KEY, snapshot);
  throw new Error("Write failed: Storage rolled back to prior consistent state.");
}

4. Static Export & High-Performance Delivery

The entire application is compiled using Next.js 14 App Router into optimized, static HTML/CSS/JS bundles. There is no application server holding your business data, pages paint quickly, and the workspace keeps working offline after the first load.

Free tools for this guide

Try it with your own numbers

Open the free seller dashboard: no signup, no fees, and your data stays in your browser.

Open the free dashboard