# Gateway Relay Architecture

<figure><img src="https://2726367310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDLrpcNLTxTN6K2PkVN5M%2Fuploads%2FbzRab2laboqsgAJmLfxP%2FHigh%20Level%20Architecture.drawio.png?alt=media&#x26;token=0fe1a564-7a53-4388-9d39-326cbd1b3d4f" alt=""><figcaption></figcaption></figure>

<details>

<summary>Gateway Relay Frontend</summary>

The Gateway Relay Frontend makes calls to the Gateway Relay API for the functionality it provides. The frontend houses only the components seen to the end user, and all of the Gateway Relay logic, such as gaining credits, setting payment methods, and sending relay transactions are all handled and facilitated by the Gateway Relay API.

**There is an open roadmap item to rework this frontend to be server-side rendered, rather than client-side, to learn more about this, click** [**here**](https://karan-khullar.gitbook.io/gateway/roadmap/roadmap/medium-priority-items/frontend-revamp).

</details>

<details>

<summary>Gateway Relay API</summary>

The Gateway Relay API handles all of the logic related to the functionalities of Gateway Relay, as well as acts as a decoupling layer between the frontend and all of the dependencies. The Gateway Relay API is the only thing that can read from or write to Stripe or the Gateway Relay Backend.

On the functionality side, the Gateway Relay API contains endpoints related to the following groups of functionality:

1. [Authentication](https://karan-khullar.gitbook.io/gateway/documentation/api-reference/auth)
2. [User Information](https://karan-khullar.gitbook.io/gateway/documentation/api-reference/user)
3. [Relay](https://karan-khullar.gitbook.io/gateway/documentation/api-reference/relay)
4. [Stripe](https://karan-khullar.gitbook.io/gateway/documentation/api-reference/stripe)
5. Cron job endpoints (undocumented)

</details>

<details>

<summary>Gateway Relay Database</summary>

The Gateway Relay Database stores all of the information necessary for performing the functionality related with the Gateway Relay platform. No personal information is stored, aside from the user's UP address. All payment information is stored within Stripe, and never gets stored in the Gateway Relay Database.

</details>

<details>

<summary>Stripe</summary>

Stripe is Gateway Relay's payment processing tool. All information regarding a user's payment information, as well as their active subscriptions and subscription amounts are stored here.

Stripe also calls a webhook on the Gateway Relay API in order to notify it of successful subscription payments, as well as subscription cancellations.

</details>

<details>

<summary>Pipedream</summary>

Pipedream is Gateway Relay's cron job executor. Pipedream is responsible for calling a few internal and undocumented endpoints responsible for the following functionalities:

1. Deleting stale modifiers (runs every minute)
2. Updating user experience (runs every 24 hours)
3. Resetting user check in amount (runs every 24 hours)

</details>
