> For the complete documentation index, see [llms.txt](https://docs.openg2p.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openg2p.org/products/open-agri-stack/architecture/networking-and-gateway.md).

# Networking and Gateway

Ingress, gateway functions, networking.

**Status: decided; built except where marked "to do".**

The functions of an API gateway are fulfilled by the ingress of the [OpenG2P deployment](https://docs.openg2p.org/operations/deployment/openg2p-deployment-model.md) (Nginx, Istio), through which partners reach Agri Stack as every OpenG2P service, and by the services themselves:

| API gateway feature                                        | In the OpenG2P deployment                                                                                                                                                                                                                                                                                                      |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Single public entry point, TLS, routing                    | Nginx and the Istio ingress gateway, a VirtualService per service                                                                                                                                                                                                                                                              |
| Partner authentication                                     | Each service verifies the partner's signature over the request body against [Partner Management](https://docs.openg2p.org/platform/platform-services/partner-management.md)                                                                                                                                                    |
| Access control                                             | Each partner's use-case policies (one per use case) in the Exchange's Partner Management, checked by the Composite on every call; Istio `AuthorizationPolicy` to limit registries' partner APIs to the Composite (to do)                                                                                                       |
| Rate limits and quotas                                     | A per-partner, per-use-case limit in the Composite, set in each use case and counted across pods in Redis; optionally an edge limit on the Composite's route at the Istio ingress gateway (off by default); daily quotas to do ([rate limiting](https://docs.openg2p.org/products/open-agri-stack/composite/rate-limiting.md)) |
| Usage reports                                              | Audit events from every hop, in the Audit Manager                                                                                                                                                                                                                                                                              |
| mTLS between services, timeouts, retries, circuit breaking | Istio                                                                                                                                                                                                                                                                                                                          |
| Developer portal                                           | The [Partner Guide: Fetching Farmer Data](https://docs.openg2p.org/products/open-agri-stack/partner-integration-guide.md) and the Composite's describe endpoints                                                                                                                                                               |

{% hint style="info" %}
A gateway product is worth adding only if many partner-facing APIs from different teams need a common portal, keys, analytics or billing, or if a national API gateway is mandated. It would then sit in front of the Composite, unchanged.
{% endhint %}

## Networking between installs

Each install's partner-facing APIs (the registries' partner APIs; at the Exchange, the Composite, the Consent Manager's partner API and the partner portal) are on public hostnames on its own ingress. Staff portals and admin APIs can stay on an internal gateway reached over WireGuard. The Composite's internal API (`/composite/v1/internal`, the consent templates the Exchange CM reads) is never on its public host ([chart settings](https://docs.openg2p.org/products/open-agri-stack/deployment/exchange/composite-chart-settings.md#hostnames-and-ingress)). Calls between installs use those public hostnames, protected by signed requests with keys in Partner Management, not shared Keycloak tokens: each install is a partner of the services it calls, and no secrets are exchanged. A gateway between departments with mutual TLS is an [Roadmap](https://docs.openg2p.org/products/open-agri-stack/roadmap.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.openg2p.org/products/open-agri-stack/architecture/networking-and-gateway.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
