API Gateway
Think of the reception desk in a big hotel. Guests do not walk to the kitchen, the laundry, and the accounts office one by one. They go to one desk. The desk checks who they are, sends each request to the right team, and gives back one answer. An API gateway is that reception desk for the backend services of an app.
6 min read6 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 6 sources6টি সোর্স · updated Oct 2026আপডেট: Oct 2026
One call, four servicesএকটা কল, চারটা সার্ভিস
Load the dashboard through a gateway and see one client call become four service calls, then slow one down.গেটওয়ে দিয়ে ড্যাশবোর্ড লোড করুন, দেখুন একটা ক্লায়েন্ট কল চারটা সার্ভিস কল হয়, তারপর একটাকে ধীর করুন।
You’ll learnআপনি শিখবেন
- Why one call beats fourচারটার চেয়ে একটা কল কেন ভালো✓
- What the gateway does at the doorদরজায় গেটওয়ে কী করে
- How aggregation joins the answersaggregation কীভাবে উত্তর জোড়ে
- Why a timeout keeps the page usableটাইমআউট কেন পেজ ব্যবহারযোগ্য রাখে
In plain words
An API (application programming interface) is the set of addresses, or endpoints, that an app calls to get or change data. An API gateway is one central entry point between the clients (the web app and the mobile app) and the backend services Source 1সোর্স 1. It works as a reverse proxy: it takes each request and sends it on to the correct service Source 1সোর্স 1. AWS calls its gateway a "front door" to backend services Source 4সোর্স 4.
The gateway can also do jobs that every service needs, so each service does not do them again. Microsoft calls these jobs cross-cutting tasks. Examples are authentication (checking who the caller is), SSL termination (ending the encrypted HTTPS connection), and rate limiting (a cap on how many requests a client can send) Source 1সোর্স 1. Other jobs that a gateway can take over are logging, monitoring, and response caching Source 1সোর্স 1. If the caller sends too many requests, AWS API Gateway can answer with 429 Too Many Requests Source 6সোর্স 6.
A gateway can also combine answers. This is called aggregation. The client sends one request. The gateway calls the services that it needs, joins the results, and sends back one response Source 1সোর্স 1.
Open the image in full sizeছবিটি পূর্ণ আকারে খুলুনGateway or load balancer?
People often mix these up. A load balancer spreads incoming traffic across many copies of a server. It also checks their health and sends traffic only to healthy copies Source 5সোর্স 5. Its main job is to share the load.
An API gateway works at the API level. It decides which service gets a request, and it applies rules such as authentication and rate limits Source 1সোর্স 1. The two often work together. For example, Azure API Management does no load balancing, so Microsoft says to put a load balancer or a reverse proxy next to it Source 1সোর্স 1.
সহজ English
An API gateway is one central entry point between the clients (the web app and the mobile app) and the backend services Source 1সোর্স 1. It takes each request and sends it on to the correct service, so it works as a reverse proxy Source 1সোর্স 1. AWS calls its gateway a "front door" to backend services Source 4সোর্স 4.
The gateway can also do jobs that every service needs, such as authentication (a check of the caller), SSL termination, and rate limiting Source 1সোর্স 1. A gateway can also take over logging, monitoring, and response caching Source 1সোর্স 1. If a caller sends too many requests, AWS API Gateway can answer with 429 Too Many Requests Source 6সোর্স 6.
With aggregation, the client sends one request. The gateway calls the services that it needs and sends back one response Source 1সোর্স 1.
A load balancer spreads traffic across many copies of a server and sends traffic only to healthy copies Source 5সোর্স 5. A gateway decides which service gets a request and applies rules such as rate limits Source 1সোর্স 1. Azure API Management does no load balancing, so Microsoft says to put a load balancer or a reverse proxy next to it Source 1সোর্স 1.
বাংলা ব্যাখ্যা
API (application programming interface) হলো কিছু address বা endpoint-এর set, যেগুলো একটি app data পেতে বা বদলাতে call করে। API gateway হলো client (web app ও mobile app) আর backend service-গুলোর মাঝখানে একটি central entry point Source 1সোর্স 1। এটি reverse proxy হিসেবে কাজ করে: প্রতিটি request গ্রহণ করে সঠিক service-এ পাঠিয়ে দেয় Source 1সোর্স 1। AWS তাদের gateway-কে backend service-এর "front door" বলে Source 4সোর্স 4।
যে কাজগুলো প্রতিটি service-এর দরকার, gateway সেগুলোও করতে পারে, যাতে প্রতিটি service-কে আলাদা করে সেগুলো করতে না হয়। Microsoft এগুলোকে cross-cutting task বলে। যেমন authentication (caller কে, তা যাচাই করা), SSL termination (encrypted HTTPS connection শেষ করা), আর rate limiting (একজন client কতগুলো request পাঠাতে পারবে, তার সীমা) Source 1সোর্স 1। Logging, monitoring আর response caching-ও gateway নিতে পারে Source 1সোর্স 1। Caller খুব বেশি request পাঠালে AWS API Gateway 429 Too Many Requests দিয়ে উত্তর দিতে পারে Source 6সোর্স 6।
Gateway একাধিক উত্তর একসাথে জুড়তেও পারে, একে aggregation বলে। Client একটি request পাঠায়; gateway দরকারি service-গুলোকে call করে, ফলগুলো জুড়ে একটি response ফেরত দেয় Source 1সোর্স 1।
অনেকে gateway আর load balancer গুলিয়ে ফেলেন। Load balancer একটি server-এর অনেক copy-র মধ্যে traffic ভাগ করে এবং শুধু healthy copy-তে traffic পাঠায় Source 5সোর্স 5। API gateway API level-এ কাজ করে: কোন service request পাবে, তা ঠিক করে এবং authentication ও rate limit-এর মতো নিয়ম প্রয়োগ করে Source 1সোর্স 1। যেমন, Azure API Management load balancing করে না, তাই Azure API Management-এর পাশে একটি load balancer বা reverse proxy রাখতে Microsoft বলে Source 1সোর্স 1।
When you need it
Without a gateway, each client calls each service directly. Microsoft lists the problems: the client code gets complex, the client must know how the backend is split, each public service must repeat authentication and rate limiting, and each public endpoint is one more door for an attacker Source 1সোর্স 1.
Think about a gateway when:
- The backend has more than one service.
- The web app and the mobile app need the same entry point.
- Authentication, rate limits, and logging must be in one place.
- You want simpler clients and you want to hide the backend structure from them.
সহজ English
Without a gateway, each client calls each service directly. Microsoft lists these problems Source 1সোর্স 1:
- The client code gets complex.
- The client must know how the backend is split.
- Each public service must do authentication and rate limiting again.
- Each public endpoint is one more door for an attacker.
Think about a gateway when:
- The backend has more than one service.
- The web app and the mobile app need the same entry point.
- Authentication, rate limits, and logging must be in one place.
- You want simpler clients, and you want to hide the backend structure from them.
বাংলা ব্যাখ্যা
Gateway না থাকলে প্রতিটি client প্রতিটি service-কে সরাসরি call করে। Microsoft সমস্যাগুলো তুলে ধরে: client-এর code জটিল হয়ে যায়, backend কীভাবে ভাগ করা তা client-কে জানতে হয়, প্রতিটি public service-কে authentication আর rate limiting আবার করতে হয়, আর প্রতিটি public endpoint একজন attacker-এর জন্য আরেকটি দরজা Source 1সোর্স 1।
এই অবস্থাগুলোতে gateway-এর কথা ভাবুন:
- Backend-এ একটির বেশি service আছে।
- Web app আর mobile app-এর একই entry point দরকার।
- Authentication, rate limit আর logging এক জায়গায় থাকতে হবে।
- আপনি client-গুলো সহজ রাখতে চান এবং backend-এর গঠন তাদের কাছ থেকে লুকাতে চান।
A real-life example
A student opens the dashboard of the LMS (learning management system). The dashboard shows four things: the profile, the enrolled courses, the payment status, and the upcoming classes. Each comes from a different service.
Without a gateway, the mobile app makes four calls to four services. With a gateway, the app makes one call to /student/dashboard. The gateway checks the login token one time. Then it calls the four services, joins their answers, and returns one response.
Now the payment service becomes slow. A good gateway has a timeout for each call. It can still return the profile, courses, and classes, and mark the payment part as "not available right now". The student sees most of the dashboard and does not stare at a spinner.
সহজ English
A student opens the dashboard of the LMS (learning management system). The dashboard shows four things: the profile, the enrolled courses, the payment status, and the upcoming classes. A different service gives each one.
Without a gateway, the mobile app makes four calls to four services. With a gateway, the app makes one call to /student/dashboard. The gateway checks the login token one time. Then it calls the four services, joins their answers, and returns one response.
Now the payment service becomes slow. A good gateway has a timeout for each call. It can still return the profile, the courses, and the classes. It marks the payment part as "not available right now". The student sees most of the dashboard and does not wait at a spinner.
বাংলা ব্যাখ্যা
একজন student LMS (learning management system)-এর dashboard খোলেন। Dashboard-এ চারটি জিনিস দেখায়: profile, enrolled course, payment status আর আসন্ন class। প্রতিটি আসে আলাদা একটি service থেকে।
Gateway না থাকলে mobile app চারটি service-এ চারটি call করে। Gateway থাকলে app শুধু /student/dashboard-এ একটি call করে। Gateway login token একবার যাচাই করে। তারপর চারটি service-কে call করে, তাদের উত্তর জুড়ে একটি response ফেরত দেয়।
এখন ধরুন payment service ধীর হয়ে গেল। একটি ভালো gateway-এর প্রতিটি call-এর জন্য timeout থাকে। তখনও এটি profile, course আর class ফেরত দিতে পারে, আর payment অংশটিকে "এখন পাওয়া যাচ্ছে না" হিসেবে চিহ্নিত করতে পারে। Student dashboard-এর বেশিরভাগ অংশ দেখতে পান, spinner-এর দিকে তাকিয়ে বসে থাকতে হয় না।
Common mistakes
- Business logic in the gateway. Rules such as "who can enroll" belong in the services. Microsoft says never to move business logic into the gateway Source 3সোর্স 3. Logic in the gateway couples all services to it.
- One gateway, no backup. All traffic passes through the gateway, so it can become a single point of failure Source 2সোর্স 2. Run more than one gateway instance Source 3সোর্স 3. The gateway can also become a bottleneck, so load test it Source 2সোর্স 2.
- Auth bypass routes. A route that skips the auth check, or a service that is also reachable directly, lets callers go around the front door.
- One slow service fails the full page. Without timeouts, the whole dashboard waits for the slowest service. Microsoft says that a partial response can be acceptable when one call takes too long Source 2সোর্স 2.
- No request ID. Without a correlation ID (one ID that follows a request through every service), nobody can link the gateway log to the service logs. Microsoft advises correlation IDs to track each call Source 2সোর্স 2.
সহজ English
- Business logic in the gateway. Rules such as "who can enroll" belong in the services. Microsoft says never to move business logic into the gateway Source 3সোর্স 3. Logic in the gateway ties all services to it.
- One gateway, no backup. All traffic passes through the gateway, so it can become a single point of failure Source 2সোর্স 2. Run more than one gateway instance Source 3সোর্স 3. The gateway can also become a bottleneck, so do a load test on it Source 2সোর্স 2.
- Routes that skip auth. A route that skips the auth check lets callers go around the front door. A service that callers can also reach directly does the same.
- One slow service fails the full page. Without timeouts, the whole dashboard waits for the slowest service. Microsoft says that a partial response can be acceptable when one call takes too long Source 2সোর্স 2.
- No request ID. A correlation ID follows a request through every service. Without it, nobody can link the gateway log to the service logs. Microsoft advises correlation IDs to track each call Source 2সোর্স 2.
বাংলা ব্যাখ্যা
- Gateway-এ business logic। "কে enroll করতে পারবে"-এর মতো নিয়ম service-গুলোর ভেতরে থাকা উচিত। Microsoft বলে, business logic কখনো gateway-এ সরাবেন না Source 3সোর্স 3। Gateway-এ logic থাকলে সব service তার সাথে বাঁধা পড়ে যায়।
- একটি gateway, কোনো backup নেই। সব traffic gateway দিয়ে যায়, তাই এটি single point of failure হয়ে উঠতে পারে Source 2সোর্স 2। একাধিক gateway instance চালান Source 3সোর্স 3। Gateway bottleneck-ও হতে পারে, তাই এর load test করুন Source 2সোর্স 2।
- Auth এড়িয়ে যাওয়া route। যে route auth check এড়িয়ে যায়, অথবা যে service সরাসরিও reach করা যায়, তা দিয়ে caller-রা front door ঘুরে ঢুকে পড়তে পারে।
- একটি ধীর service পুরো page নষ্ট করে। Timeout না থাকলে পুরো dashboard সবচেয়ে ধীর service-এর জন্য অপেক্ষা করে। Microsoft বলে, একটি call খুব বেশি সময় নিলে partial response গ্রহণযোগ্য হতে পারে Source 2সোর্স 2।
- Request ID নেই। Correlation ID হলো এমন একটি ID, যা একটি request-এর সাথে প্রতিটি service-এ যায়। এটি না থাকলে কেউ gateway log-কে service log-এর সাথে মেলাতে পারে না। প্রতিটি call track করতে Microsoft correlation ID ব্যবহারের পরামর্শ দেয় Source 2সোর্স 2।
What a tester can check
Tutorial advice
These test ideas are the tutorial's own advice.
- Auth at the door. Call each route through the gateway with no token, an expired token, and a token of the wrong role. Then try to call each backend service directly. Every call must fail.
- Rate limit. Send requests faster than the limit. Check for
429, a clear error body, and aRetry-Aftervalue if the API promises one. - Partial failure. Slow down or stop one service behind an aggregated endpoint. Check that the response comes back in time and that the missing part is marked clearly.
- Request ID. Send a request and find the same request ID in the gateway log and in each service log.
- Routing table. After a new service or a new version goes live, check that each old route still reaches the right service.
- Gateway failover. Stop one gateway instance under load. Check that clients still get answers.
সহজ English
These test ideas are the tutorial's own advice.
- Auth at the door. Call each route through the gateway with no token, with an expired token, and with a token of the wrong role. Then try to call each backend service directly. Every call must fail.
- Rate limit. Send requests faster than the limit. Look for
429, a clear error body, and aRetry-Aftervalue if the API promises one. - Partial failure. Make one service behind an aggregated endpoint slow, or stop it. Make sure that the response comes back in time and that the missing part has a clear mark.
- Request ID. Send a request. Find the same request ID in the gateway log and in each service log.
- Routing table. After a new service or a new version goes live, make sure that each old route still gets to the right service.
- Gateway failover. Stop one gateway instance under load. Make sure that clients still get answers.
বাংলা ব্যাখ্যা
নিচের test ধারণাগুলো এই tutorial-এর নিজস্ব পরামর্শ।
- দরজায় auth। Gateway দিয়ে প্রতিটি route call করুন: token ছাড়া, expired token দিয়ে, আর ভুল role-এর token দিয়ে। তারপর প্রতিটি backend service সরাসরি call করার চেষ্টা করুন। প্রতিটি call fail করতে হবে।
- Rate limit। Limit-এর চেয়ে দ্রুত request পাঠান। দেখুন
429আসে কি না, error body পরিষ্কার কি না, আর API কথা দিলেRetry-Aftervalue আছে কি না। - Partial failure। একটি aggregated endpoint-এর পেছনের একটি service ধীর করুন বা বন্ধ করুন। দেখুন response সময়মতো আসে কি না এবং অনুপস্থিত অংশটি পরিষ্কারভাবে চিহ্নিত কি না।
- Request ID। একটি request পাঠান। একই request ID gateway log-এ এবং প্রতিটি service log-এ খুঁজে বের করুন।
- Routing table। নতুন service বা নতুন version live হওয়ার পর দেখুন, প্রতিটি পুরোনো route এখনও সঠিক service-এ পৌঁছায় কি না।
- Gateway failover। Load চলার সময় একটি gateway instance বন্ধ করুন। দেখুন client-রা তখনও উত্তর পায় কি না।
Key words
| Word | Meaning |
|---|---|
| API gateway | One entry point that receives client requests and sends each to the right backend service |
| Endpoint | One address of an API, such as /student/dashboard |
| Reverse proxy | A server that takes requests for other servers and passes them on |
| Cross-cutting task | A job that every service needs, such as authentication or logging |
| Aggregation | The gateway calls many services and joins the answers into one response |
| Load balancer | A component that spreads traffic across many copies of a server |
| Rate limiting | A cap on how many requests a client can send in a time window |
| Single point of failure | One part that stops the whole system when it fails |
| Correlation ID | One ID that follows a request through every service, so logs can be linked |