← Back to blog
Next.jsSupabasePostgreSQLMulti-tenancyE-commerce

Building Algeria's First Multi-Vendor Marketplace: Lessons from FleetDZ

1 November 2025

How we architected FleetDZ to handle thousands of merchants across 58 wilayas — the technical decisions, the tradeoffs, and what we learned along the way.

When we started FleetDZ, the goal was straightforward: give any Algerian merchant the ability to launch their own digital storefront in minutes. The reality of building that infrastructure was anything but simple.

The first major challenge was multi-tenancy. Every merchant needs isolated data — their own catalog, orders, customers, and analytics — while sharing the same underlying infrastructure. We solved this with a carefully designed PostgreSQL schema using row-level security policies in Supabase, which gave us tenant isolation without the overhead of separate databases.

The second challenge was the logistics layer. Algeria has 58 wilayas with very different delivery realities — Algiers moves fast, but remote wilayas require different carrier partnerships and timelines. We built an abstraction layer that routes each order to the appropriate delivery provider based on origin and destination, keeping this logic entirely server-side so merchants never have to think about it.

On the frontend, we chose Next.js with the App Router for its ability to render merchant storefronts statically while keeping the dashboard fully dynamic. Each merchant gets a subdomain-style routing experience, handled by Next.js middleware that resolves the store context before any page renders.

The biggest lesson? Build for the network conditions your users actually have, not the ones you wish they had. Algeria has fast mobile connections in cities but variable quality elsewhere. We obsessed over Core Web Vitals early and it paid off.

Enjoyed this article?

Let's build something together.

Get in touch