Skip to main content

Command Palette

Search for a command to run...

Naslo — SewTec E-commerce Platform

Rebuilding SewTec's Shopify storefront into a custom Arabic-first e-commerce platform for industrial sewing machines and spare parts. Backend architecture, DDD domain modeling, and the dual-pricing domain problem.

Naslo — SewTec E-commerce Platform

Naslo is the internal codename for SewTec's next-generation e-commerce platform — a full rebuild of their Shopify storefront (sewtecstore.com) into a custom Arabic-first system for industrial sewing machines and spare parts. I'm the backend architect and full-time software engineer on it.

Info

The platform serves three distinct purchase journeys: retail guest checkout with fixed prices, dealer quote requests (no fixed prices — negotiated per order), and production-line requests. This three-way split drives every backend design decision.

Business Analysis: Three Journeys, One Platform

Before writing a line of backend code, the business domain had to be mapped. SewTec doesn't sell like a normal store — the same catalog behaves completely differently depending on who's buying:

Loading diagram...
The three purchase journeys driving the backend design

The 8 Open Questions

The backend analysis doc (PR #4) identified 8 business questions that must be answered before data/API design can begin. They're business questions, not technical ones — the answers live with SewTec's sales and warehouse teams:

  • Q-01: First-release scope — which journeys ship in v1?

  • Q-02: How is stock managed today? (No real-time stock in v1 — manual confirmation)

  • Q-03: Who approves dealer eligibility, and on what basis?

  • Q-04: After a quote request — converted to order, or negotiated offline?

  • Q-05: Who sets prices? How is shipping computed per region?

  • Q-06: Payment providers (COD + bank transfer at launch)

  • Q-07: Multi-brand catalog ownership and spare-part compatibility

  • Q-08: Production-line request workflow

▶Why these questions block the backend

Every one of these maps to a bounded context or aggregate boundary. Q-04 (quote-to-order flow) decides whether Quote and Order are one aggregate or two. Q-02 (stock) decides whether Inventory is a real-time aggregate or a manual process. Getting these wrong means rebuilding the domain model later.

The doc's advice: answer Q-01 first (scope), then Q-02 and Q-04 (current process). The rest get easier.

System Architecture

The system is split into two deployables: a Next.js frontend (client-rendered, Arabic RTL) and a .NET backend (planned: .NET Aspire, Clean Architecture, CQRS with MediatR). The frontend currently runs on mock data + localStorage — the backend contract is being designed to replace it without frontend rewrites.

Loading diagram...
Planned system architecture: typed frontend data layer maps to backend API contract

Frontend Layering (built)

The frontend follows strict layering — domain/ owns types and never imports from other layers. The storefront section system is a textbook example:

Loading diagram...
The 7-step section system: adding a section type touches all layers in order
Tip

The section registry uses an exhaustive switch with a never guard — the compiler rejects a new section type until every layer handles it. The type system enforces the architecture.

Backend Design (in progress)

The backend follows Clean Architecture with CQRS. Here's the pattern for the dealer quote flow — the most complex journey:

csharp

Key design decision: a Quote is NOT an Order. It's a separate aggregate with its own lifecycle (Requested → UnderReview → Approved/Rejected → ConvertedToOrder). Merging them would have been simpler short-term but wrong — the business treats them as different things with different actors (dealer vs sales team).

Domain-Driven Design: The Catalog Problem

SewTec sells machines AND spare parts across multiple brands (ZOJE, Jack, Siruba...). A spare part isn't just a product — it's compatible with specific machine models. This is a classic DDD aggregate design problem:

Loading diagram...
Catalog aggregates: spare-part compatibility is a first-class concept, not a tag
Warning

The naive approach — a flat product table with a 'compatible_with' text field — breaks the moment you need to answer 'which parts fit this machine?' at scale. The compatibility relationship deserves its own model.

Dual Pricing: The Hardest Domain Problem

Guests and retail accounts see fixed prices. Dealers see NO prices — they request quotes. This isn't a UI toggle; it's a domain invariant:

csharp

Returning null for dealers (not zero, not hidden in the UI) makes the invariant explicit in the domain layer. The frontend can't accidentally show a dealer a price — there's no price to show.

Current Status

  • Frontend: Next.js 16, 7 section types, studio editor with undo/redo, draft/published workflow — live in preview

  • Backend analysis: 8-phase doc complete, 8 business questions identified, awaiting operational validation

  • Backend implementation: Clean Architecture + CQRS design in progress, starting with the quote aggregate

  • Next: answer Q-01 through Q-04 with the sales team, then data model + API contract

Info

This page grows with the project. As phases complete — data model, API contract, first deploy — they'll be documented here with the same depth.