Backend Development 13 min read

Designing a Scalable Backend Architecture with API Layer and BFF for a Supply‑Chain System

This article analyzes common problems in a large‑scale supply‑chain backend—such as unclear service boundaries, tangled dependencies, and client‑specific adaptations—and proposes a layered solution using a dedicated API layer, BFF pattern, Spring Cloud components, and clear team division to improve modularity, reduce code duplication, and streamline development.

Top Architect
Top Architect
Top Architect
Designing a Scalable Backend Architecture with API Layer and BFF for a Supply‑Chain System

The author, a senior architect, presents a case study of a complex supply‑chain system that includes dozens of services (product, order, store, work‑order, etc.) and multiple client apps (customer app, employee/partner app).

Two main issues are identified: (1) uncertainty about which service should host a given API, leading to inefficient decision‑making, and (2) excessive inter‑service dependencies caused by many operations needing to modify data across several services.

To address these, an API layer is introduced, responsible for aggregation, distributed calls, and data decoration. The API layer has no own database and simply forwards requests to backend services via Feign.

Client‑specific adaptation problems are then discussed. Different front‑ends (App, H5, PC, mini‑program) have varying data needs, causing the API layer to become a compatibility bottleneck. The solution is to adopt the BFF (Backend for Front) pattern, creating separate API services per client, allowing tailored optimizations and independent release cycles.

The overall technical stack is based on Spring Cloud (Zuul gateway, Spring Web API services, and backend services with their own databases). The gateway handles routing, authentication, monitoring, and rate‑limiting, while the API services perform aggregation and orchestration.

Code duplication between API services is tackled in three ways: sharing common code via a JAR, extracting a CommonAPI service, or accepting duplication when the cost of abstraction outweighs benefits. The team ultimately keeps simple proxy APIs for low‑cost cases.

Team division is clarified: a dedicated API development team maintains the API services, while backend services are split into domain‑focused groups, ensuring clear responsibilities and better overall system understanding.

Images illustrating the architecture, API layer, BFF setup, and service dependencies are included throughout the article.

backendArchitectureMicroservicesBFFAPI designSpring Cloud
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.