saas-api-gateway

Route and aggregate client requests to downstream microservices with Fastify reply.from.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/johnnystefan/test-saas-business --skill saas-api-gateway
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: saas-api-gateway
Source: https://github.com/johnnystefan/test-saas-business/tree/main/skills/saas-api-gateway
Command: npx skills add https://github.com/johnnystefan/test-saas-business --skill saas-api-gateway

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill documents and enforces the BFF API gateway pattern so each client request is authenticated, proxied, and error-handled consistently without duplicating business logic.

Core Features & Use Cases

  • Centralized routing rules: Shows how proxy constants, controllers, and services coordinate to strip and add prefixes while forwarding requests with Fastify reply.from.
  • Reusable HttpProxyService: Covers configuration validation, route transformation, and neverthrow results to guard against invalid URLs and proxy failures.
  • Use Case: When adding a new downstream service, copy the proxy module pattern, register the module in AppModule, and keep controllers at two lines so the gateway never touches Prisma or domain logic.

Quick Start

Activate the saas-api-gateway skill to outline proxy modules, controllers, and route transforms before extending any downstream service.

Frequently Asked Questions about saas-api-gateway

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a BFF API gateway pattern for microservices in NestJS?

A BFF API gateway pattern routes SaaS traffic securely through centralized proxy modules using Fastify reply.from. It forwards client requests to downstream microservices while keeping controllers thin and free of domain logic.

How do I use Fastify reply.from for proxy routing in an NX monorepo?

Fastify reply.from enables proxy routing by forwarding client requests to downstream services. In an NX monorepo, you register reply.from, copy the proxy module pattern, and use centralized proxy constants for prefix stripping and route transformation.

How does neverthrow handle proxy-result errors in a SaaS API gateway?

Neverthrow handles proxy-result errors by wrapping HttpProxyService operations in Result types. This guards against invalid URLs and proxy failures, providing uniform error handling for every proxied client request.

Can I use Fastify proxy routing with NestJS guards for authentication?

Yes, Fastify proxy routing works with NestJS guards for authentication. The SaaS API gateway requires uniform guard conventions for each controller, ensuring client requests are authenticated consistently before being forwarded to downstream services.

What is the best way to add a new downstream service to a BFF API gateway?

The best way to add a downstream service to a BFF API gateway is to copy the proxy module pattern, register it in AppModule, and configure centralized proxy constants. Controllers stay two lines to separate proxy routing from domain logic.

Why should my API gateway controllers avoid touching Prisma or domain logic?

API gateway controllers should avoid Prisma and domain logic to prevent duplicating business rules. The BFF pattern enforces thin controllers, ensuring the gateway only authenticates, proxies, and error-handles requests without mixing in domain concerns.