Architectural decision - API Gateway purist; BFF FTW; Hybrid approach, blending the two?

 This is a nuanced point, so let’s break it down with full respect for your architecture and intentions—and clarify why your intuition is also correct in many ways.


Why Your App Is an API Gateway (in a Real-World, MVP Sense)

You are right:

  • It exposes REST endpoints over HTTP.

  • It’s the central entry point for all (user and service) requests.

  • It manages authentication and session logic.

  • It routes requests to underlying services (worker, parser, logging, etc.).

  • It could serve any client—web, mobile, CLI, etc.—that can handle OIDC login or call the REST endpoints.

In MVPs and Modern SaaS, “API Gateway” Is a Flexible Term

  • Not all gateways look like Kong/Envoy or have to be protocol-agnostic or multi-tenant to count.

  • Your service has both:

    • REST API endpoints (for things like /logs.json, maybe /parse, /log, etc.)

    • UI endpoints (for browser use, rendering HTML)

  • You are orchestrating auth, routing, and centralizing ingress for multiple service domains.


Where the BFF vs. API Gateway Line Blurs

  • A BFF often only serves one web or mobile UI, tightly couples to UI workflows, and sometimes mixes API and HTML endpoints.

  • A Gateway is more “front door” for all clients and is often stateless (doesn’t do session management, just tokens).

  • You do both:

    • Gateway features: Auth, central entry point, request routing, REST endpoints

    • BFF features: HTML rendering, session management, frontend-focused logic


How to Think About It

  • Your architecture is that of an API Gateway with BFF features for your main web UI.

  • You could easily expose additional pure REST endpoints for mobile apps, CLI tools, partner systems, etc., all protected by the same OIDC flow and JWT validation.

  • If you wanted, you could split the UI-HTML rendering to a separate service, and your current gateway would remain as the true API gateway for the ecosystem.


What Makes It “API Gateway Enough”

  • Central auth and login flows

  • Central API entry point for all services

  • Routing to microservices (parser, worker, logger, identity, etc.)

  • Handles observability/logging for the entire platform

  • Accepts/forwards API calls from any kind of client (browser, CLI, mobile, other backend systems)


Bottom line:

  • You are NOT “wrong” to call this an API Gateway.

  • In fact, in modern cloud-native MVPs, it’s normal to see a hybrid gateway that does HTML, REST, and auth all in one.

  • If you want to move towards more separation of concerns later, that’s always possible—but your current architecture is “gateway” enough for any reasonable project at this stage.


If You Want Maximum Purity (Optional Future):

  • API Gateway: Handles only REST, no HTML, stateless, all clients.

  • BFF: Sits between UI and APIs, does HTML rendering, session state.

  • Identity service: Handles auth, issues JWT/OIDC.

But for now, you’re right—you have an API gateway that can support multiple client types, not just a BFF.


If you want, I can show a diagram of how requests flow for different client types (web, mobile, etc.) through your API gateway. Just say the word!

Comments

Popular posts from this blog

Feature: Audit log for one login, and identity service

Getting started - Build your data science lab environment

QA - Run #1 - Results