Freelance DevRole
Client WorkType
1.5 MonthsTimeline
+30%Revenue Lift

THE PROBLEM

Every tool covered part of the problem. Nothing connected.

An electronics retailer needed to sell online. Not just a storefront — the full operation. Import thousands of products from a B2B distributor. Set prices with margin rules. List on Poland's biggest marketplace. Watch competitor prices. Auto-delist anything unprofitable. Forward orders for fulfillment. The owner was doing most of it manually across multiple tabs, recalculating margins by hand, hoping nothing fell through the gaps. Off-the-shelf solutions covered maybe 30% of that workflow. I built the system that connects everything.

THE PROCESS

How I approached it

I started by mapping every manual step the owner was doing and asking which could be fully eliminated versus merely accelerated. The answer was almost all of them. The architecture decision followed directly from that: each manual workflow became an isolated module, connected through events, so a failure in one part wouldn't take down the rest.

Engineering Perspective

"The marketplace doesn't give you competitor pricing through their API. Scraping is the only way to get it. But raw scraping returns garbage — you'd get listings for the same search term that have nothing to do with your product. I built Levenshtein-distance title matching on top of Scrapfly's proxy layer to verify that a scraped result actually matches the product before the price goes into the profitability calculation. Scrapfly handles anti-bot bypass. I handle the matching logic. Without both, the margin analysis would be wrong half the time."

AUTOMATION LIFECYCLE

1. Product Seeding (SOAP API)

Custom Medusa workflow bulk-imports products, technical specs, and imagery from the distributor CDN using exponential backoff.

2. Competitor Scraping & Margin Analysis

Scrapfly fetches marketplace prices. System calculates Levenshtein title-similarity, runs margin rules, and automatically flags unprofitable offers for delisting.

3. Live Indexing & Edge Delivery

Changes trigger an Event Bus subscriber. Meilisearch is updated instantly. Next.js storefront serves rapid data globally via App Router.

4. Zero-Touch Fulfillment

Customer placed orders fire a webhook. System maps courier rules and automatically back-orders the hardware directly with the B2B supplier.

KEY DECISIONS

Why I built it this way

What we gainedWhy Medusa.js v2 instead of Shopify

The business logic here doesn't exist as a plugin anywhere. Category-scoped markup rules with price-range constraints. Automated profitability-gated marketplace listing management. SOAP API integration with a B2B distributor. There's no Shopify app for that combination. I needed full control over every module.

What we gainedWhy 15 separate modules

Medusa v2's architecture lets each concern live in isolation. The marketplace margin analyzer doesn't know the product seeder exists. The markup engine doesn't know about the scraper. They talk through events. One module catches fire, the rest keep running.

What we gainedWhy Scrapfly for competitor scraping

The marketplace doesn't expose competitor pricing through their API. Scraping is the only option. Scrapfly handles proxy rotation and anti-bot detection. The harder problem was matching — a search term returns dozens of results, most wrong. I built Levenshtein-distance title matching on top to verify that a scraped listing actually corresponds to the right product.

What we gainedWhy psychological price rounding

After markup and VAT, a laptop comes out to 4,847.32 PLN. Nobody buys a laptop priced at 4,847.32 PLN — not because they can't afford it, but because it looks like a machine spat it out. The pricing engine rounds to psychologically clean numbers as the last step.

THE SOLUTION

One dashboard. Every part of the operation, automated.

The platform runs on Medusa.js v2 with 15 custom modules. Each one handles a distinct piece of the business. Product import pulls the full catalog from the distributor's SOAP API — descriptions, specs, images, wholesale prices. Markup rules set consumer prices automatically with psychological rounding and VAT baked in. The marketplace integration scrapes competitor prices, calculates commissions, runs profitability analysis, and manages listings — creating, updating, pausing, and delisting based on margin thresholds. All automated. One operator runs the entire product lifecycle from a single screen.

TECHNICAL ARCHITECTURE

DATA SOURCES
B2B SOAP API
+ Scrapfly OAuth
STOREFRONT
Next.js 16
App Router + React 19
HEADLESS COMMERCE ENGINE
Medusa.js v2 Core
15x Custom ModulesEvent Bus SubscribersBackground Job Engine
PRIMARY DATABASE
PostgreSQL + Redis
State, Queues & Distributed Locks
SEARCH INFRASTRUCTURE
Meilisearch
Live Product Indexing

RESULTS

+30%Revenue in 3 Months
0Manual Price Updates
100%Fulfillment Automated
15Custom Modules

The operator went from manually syncing products across tabs to running the full product lifecycle from one screen. The time savings alone justified the build in the first month.

LEARNINGS

What Worked

  • — Medusa's event-driven module isolation meant that when the scraper had issues, the storefront kept running. Modules had no idea the others existed.
  • — Psychological price rounding was a small detail that mattered — machine-generated prices look wrong to buyers even when the number is correct.

What I'd Do Differently

  • — Scraper reliability is inherently fragile. A fallback pricing strategy — manual override or conservative default margin — should have been day-one infrastructure, not an afterthought.
  • — 15 modules was the right call architecturally, but a phased rollout starting with the 3 highest-impact modules would have delivered value faster.
Medusa.js v2Next.js 16PostgreSQLRedisMeilisearch