Email copiado — support@tuurt.com
Cargando experiencia
arquitectura · November 12, 2026 · 7 min

API Gateway as a BFF for mobile apps: aggregating responses from .NET and Node microservices into one app

The BFF pattern aggregates calls to several .NET and Node microservices into one response built for the mobile app. We cover when it's worth it, and the mistake of turning it into a second monolith of business rules.

By Tuurt Team

API Gateway as a BFF for mobile apps: aggregating responses from .NET and Node microservices into one app

When a mobile app needs to render a single screen with data that lives in three or four different microservices — a user profile in one .NET service, a catalog in another, recent orders in a Node service, notifications in a fourth — the same fork in the road always shows up: should the app make four network calls and assemble the screen on the client, or should something aggregate that data before it reaches the phone? The first option looks simpler to build, until you measure it in practice: four round trips over a mobile connection with variable latency, four different JSON contracts the app has to know about, and four independent points of failure for a single screen. The Backend for Frontend (BFF) pattern exists to solve exactly this, but applied poorly it turns into a new problem instead of a solution.

What a BFF does, and what it doesn't

A BFF is a thin layer, specific to one type of client, that aggregates calls to several internal services and shapes the response that client actually needs. It is not a generic routing API Gateway — that job already belongs to the infrastructure gateway, with rate limiting, authentication, and routing — and it is not a rewrite of the domain services. Its job is narrow: receive a request from the client, call whatever services are needed in parallel, combine the responses into the exact shape that screen needs, and return a single payload.

// bff-mobile/routes/home.js
router.get('/home', async (req, res) => {
  const userId = req.auth.userId;

  const [profile, recentOrders, notifications] = await Promise.all([
    profileClient.get(userId),
    ordersClient.getRecent(userId, { limit: 5 }),
    notificationsClient.getUnread(userId),
  ]);

  res.json({
    name: profile.shortName,
    avatarUrl: profile.avatarUrl,
    orders: recentOrders.map(o => ({
      id: o.id,
      status: o.status,
      total: o.formattedTotal,
    })),
    unreadNotifications: notifications.length,
  });
});

That response isn't a mirror of any of the three source services. It's the exact shape the app's home screen needs, computed from data that lives elsewhere. The mobile app makes one call, the BFF makes the three internal calls in parallel, and the time the user actually perceives is that of the slowest of the three, not the sum of all four.

When it's worth it versus calling each service directly

Not every client needs a BFF. If the app only consumes one service, or consumes several but each screen depends on just one at a time, adding an intermediate layer only adds a network hop with no real benefit. A BFF starts to earn its place once at least two of these conditions show up: a single screen needs data combined from more than one service, the contracts of those services change at different rates and the app can't afford to be coupled to all of them at once, or the mobile client has constraints — battery, mobile data, variable latency — that make any extra round trip genuinely costly.

The opposite case matters too: if the same set of services already exposes combined data through federated GraphQL, bolting a BFF on top is a redundant layer. The rule we use is simple: a BFF solves a data-shape and network-call-count problem for one specific type of client, not a business-rule or authorization problem, which keeps living in the domain services.

The mistake that turns a BFF into a second monolith

The biggest risk with a BFF isn't technical, it's a matter of team discipline. Since the BFF is already assembling the combined response, it's tempting to drop in a validation that should live in the domain service, or a business calculation that today only the mobile app needs but that actually belongs to a rule shared with the web version.

// What should NOT live in a BFF
router.post('/orders', async (req, res) => {
  const { items } = req.body;

  // Duplicated business rule: the orders service already
  // validates this, but someone copied it here "to move faster"
  const totalWithDiscount = items.reduce((acc, item) => {
    const discount = item.quantity > 10 ? 0.15 : 0;
    return acc + item.price * item.quantity * (1 - discount);
  }, 0);

  const order = await ordersClient.create({ items, totalWithDiscount });
  res.json(order);
});

That volume-discount line doesn't belong in the BFF. It belongs in the orders service, because that service is the one that must apply the same rule regardless of whether the order comes from the mobile app, the web, or a third-party integration. If the BFF computes the discount and sends it already resolved, the day the rule changes — the threshold moves from 10 to 15 units, or the percentage varies by category — someone has to find and update the logic in two places, and the BFF starts drifting from the domain service without anyone noticing until a customer reports a different total between the app and the web.

The fix is to let the BFF forward the raw request to the domain service and only adapt the shape of the response that service already computed:

router.post('/orders', async (req, res) => {
  const { items } = req.body;
  const order = await ordersClient.create({ items });
  res.json({
    id: order.id,
    formattedTotal: formatCurrency(order.total),
    status: order.status,
  });
});

The business rule lives in exactly one place. The BFF only decides how the number looks on that particular screen.

One BFF per client type, not one generic BFF for everyone

A related mistake is building a single BFF that serves the mobile app, the web, and an admin panel at once, with flags that change the response shape depending on who's calling. That reintroduces the same problem the BFF was supposed to solve: a contract several different clients now have to negotiate among themselves. When clients need genuinely different data shapes — the mobile app needs summarized fields, the admin panel needs the full record with audit metadata — it's better to run one BFF per client type, each aggregating the same domain services but returning a different shape.

What didn't work the first time

On a project with a Flutter app consuming three .NET microservices, the first BFF we built mostly forwarded requests almost untouched, and only aggregated for real on the home screen. It worked fine for several months. The problem showed up once the app team started requesting small formatting tweaks — dates in a different time zone, truncated text, distance calculations — and, instead of asking the corresponding domain service for those adjustments, the BFF team kept adding them directly there, because it was faster than coordinating with another team. Six months later, the BFF held formatting logic, price-rounding logic, and an order-visibility rule based on user role that existed nowhere else in the system. When a second client showed up — a support web panel — that panel couldn't rely on the domain services for the same information, because the real rule was hidden inside the mobile app's BFF.

Reversing that took more effort than doing it right from the start would have: every piece of logic that wasn't pure shape-adaptation had to be identified and moved to the right domain service. The lesson wasn't "don't use a BFF," it was that every time someone adds a line of logic to a BFF, the question has to be whether that rule should apply the same way regardless of which client is asking. If the answer is yes, it isn't BFF code.

What we check before signing off on a BFF

Before approving a BFF endpoint, we confirm that every field in the response is either data that already came resolved from a domain service, or a shape transformation — formatting, combining, summarizing — that wouldn't change the business outcome if it ran against a different client. We check that calls to internal services run in parallel when they're independent of each other, not chained, because chaining calls that don't depend on one another is the most common way to lose the exact latency advantage a BFF exists to provide. And when two different clients start asking for data shapes that look similar but aren't quite the same, we treat that as a signal they need separate BFFs, not a conditional branch inside the same one.

bff api-gateway microservices dotnet
← Back to blog