# Api Gateway

> API Gateway pattern for routing. Use for microservices entry.

- **Type:** Skill
- **Install:** `agentstack add skill-g1joshi-agent-skills-api-gateway`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [G1Joshi](https://agentstack.voostack.com/s/g1joshi)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [G1Joshi](https://github.com/G1Joshi)
- **Source:** https://github.com/G1Joshi/Agent-Skills/tree/main/skills/architecture/api-gateway
- **Website:** https://skills.sh/g1joshi/agent-skills

## Install

```sh
agentstack add skill-g1joshi-agent-skills-api-gateway
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# API Gateway

An API Gateway sits between clients (Mobile, Web) and services. It acts as a reverse proxy, accepting all API calls, aggregating the various services required to fulfill them, and returning the appropriate result.

## When to Use

- **Microservices**: Essential to hide the complexity of backend services (Service Discovery).
- **Cross-Cutting Concerns**: Centralizing Authentication, SSL Termination, Rate Limiting, and Logging.
- **Protocol Translation**: Converting HTTP (Client) to gRPC (Internal).

## Core Functionality

### Routing

`GET /users` -> User Service
`GET /orders` -> Order Service

### Aggregation (BFF - Backend for Frontend)

Combining results. One request to Gateway -> Calls User Service + Order Service -> Returns combined JSON.

### Offloading

- **Auth**: Validating JWT tokens at the edge.
- **Cache**: Serving static or cached responses.

## Common Patterns

### Backend for Frontend (BFF)

Creating specific gateways for different clients (e.g., one for Mobile with small payloads, one for Web with rich payloads).

## Best Practices

**Do**:

- Use mature tools: **Kong**, **Traefik**, **AWS API Gateway**, **Nginx**.
- Implement **Rate Limiting** to prevent DoS.
- Use **Correlation IDs** for tracing requests across services.

**Don't**:

- Don't put business logic in the Gateway (It's not a service).
- Don't let it become a Single Point of Failure (High Availability is key).

## Troubleshooting

| Error                 | Cause                                 | Solution                                          |
| :-------------------- | :------------------------------------ | :------------------------------------------------ |
| `502 Bad Gateway`     | Upstream service down or unreachable. | Check internal service health and firewall rules. |
| `504 Gateway Timeout` | Upstream taking too long.             | Optimize service or increase timeout (carefully). |

## References

- [Microservices.io - API Gateway](https://microservices.io/patterns/apigateway.html)
- [Kong Gateway](https://konghq.com/)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [G1Joshi](https://github.com/G1Joshi)
- **Source:** [G1Joshi/Agent-Skills](https://github.com/G1Joshi/Agent-Skills)
- **License:** MIT
- **Homepage:** https://skills.sh/g1joshi/agent-skills

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-g1joshi-agent-skills-api-gateway
- Seller: https://agentstack.voostack.com/s/g1joshi
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
