0
0
HLDsystem_design~3 mins

Why API gateway concept in HLD? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if one simple door could open access to all your app's services without confusion or errors?

The Scenario

Imagine you have many different services in your app, each with its own address and rules. To use them, you must remember each address and how to talk to each one separately.

The Problem

This manual way is slow and confusing. You waste time switching between services, and if one changes, your app breaks. It's like calling many different phone numbers for one task, making mistakes easy and fixing problems hard.

The Solution

An API gateway acts like a friendly receptionist. It listens to your app's requests and sends them to the right service behind the scenes. Your app talks to just one place, making everything simpler, faster, and safer.

Before vs After
Before
fetch('http://service1/api/data')
fetch('http://service2/api/info')
After
fetch('http://api-gateway/api/data')
What It Enables

It makes your app easier to build and scale by hiding complex service details behind one simple entry point.

Real Life Example

Think of a busy hotel where guests only talk to the front desk, and the staff behind handle cleaning, food, and maintenance without bothering the guests.

Key Takeaways

Manual calls to many services are confusing and error-prone.

API gateway centralizes requests to one place.

This simplifies communication, improves security, and helps scale easily.