> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snagsolutions.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Stratus overview

> Stratus is Snag's onchain cloud: serverless functions, event subscriptions, gasless relayers, and ERC-20 token sync. Build custom Web3 backend logic.

<head>
  <script type="application/ld+json">
    {JSON.stringify({
            "@context": "https://schema.org",
            "@graph": [
              {
                "@type": "HowTo",
                "name": "Stratus overview",
                "description": "Stratus is Snag's onchain cloud: serverless functions, event subscriptions, gasless relayers, and ERC-20 token sync. Build custom Web3 backend logic.",
                "step": [
                  {"@type": "HowToStep", "name": "Access Stratus in the admin dashboard", "text": "Navigate to the Stratus section in the Snag admin dashboard to see tabs for Functions, Subscriptions, Relayers, and Onchain Tokens."},
                  {"@type": "HowToStep", "name": "Create a Stratus API key", "text": "Go to the API Keys page and create a new key with the Stratus scope for webhook invocations and API access."},
                  {"@type": "HowToStep", "name": "Build your first function", "text": "Head to Functions to write and deploy your first serverless function using the function templates."}
                ]
              },
              {
                "@type": "BreadcrumbList",
                "itemListElement": [
                  {"@type": "ListItem", "position": 1, "name": "Home", "item": "https://docs.snagsolutions.io/welcome"},
                  {"@type": "ListItem", "position": 2, "name": "Stratus", "item": "https://docs.snagsolutions.io/stratus/stratus-overview"},
                  {"@type": "ListItem", "position": 3, "name": "Stratus overview"}
                ]
              }
            ]
          })}
  </script>
</head>

<Frame>
  ![Stratus onchain cloud platform overview](https://assets.snagsolutions.io/public/docs/stratus-overview.webp)
</Frame>

Stratus is Snag's cloud-native solution designed to provide complete flexibility for building complex rule logic and onchain operations. With Stratus, you can seamlessly integrate one or all of its core services to develop the precise functionality you need. Each service is fully modular, so they can be used independently or combined within a function to suit your application's unique requirements.

## Core services

<CardGroup cols={2}>
  <Card title="Functions" icon="function" href="/stratus/functions">
    Write and deploy serverless JavaScript functions that execute custom onchain logic. Functions run in isolated VMs, scale horizontally, and support external API calls.
  </Card>

  <Card title="Subscriptions" icon="bell" href="/stratus/subscriptions">
    Receive real-time updates triggered by smart contract events or internal loyalty actions. Route notifications to webhooks or trigger functions automatically.
  </Card>

  <Card title="Relayers" icon="key" href="/stratus/relayers">
    Secure private key management for signing messages and relaying transactions onchain. Enable gasless transactions and sponsored actions for your users.
  </Card>

  <Card title="Onchain Tokens" icon="coins" href="/stratus/onchain-points">
    Maintain [ERC-20](https://eips.ethereum.org/EIPS/eip-20) token balances onchain for any Snag loyalty currency with automated synchronization between off-chain points and onchain tokens.
  </Card>
</CardGroup>

## How Stratus works

Stratus services are designed to work together or independently. A typical workflow combines multiple services:

1. **Subscribe** to onchain events (e.g., a token transfer or contract interaction) using Subscriptions
2. **Process** the event data with a serverless Function that applies your custom business logic
3. **Execute** onchain actions through a Relayer, such as minting rewards or updating token balances

Each service communicates through Snag's internal event system, so you can chain them together without managing infrastructure.

<Info>
  All Stratus services are available through the Snag admin dashboard. Functions and relayers also support programmatic access via the Snag API with a Stratus-scoped API key.
</Info>

## Use cases

* **Custom loyalty rules** -- Write a Stratus function that checks onchain state and rewards users based on your own criteria using the [Stratus function loyalty rule](/stratus/function-loyalty-rule)
* **Gasless transactions** -- Use relayers to sponsor gas for your users when they claim rewards, mint NFTs, or interact with smart contracts
* **Onchain event tracking** -- Subscribe to smart contract events and automatically trigger reward distributions or update user balances
* **Token-backed points** -- Sync your off-chain loyalty currency to an onchain ERC-20 token so users can trade, stake, or bridge their points
* **Automated airdrops** -- Schedule a function on a cron to periodically check leaderboard rankings and distribute token rewards

## Getting started

<Steps>
  <Step title="Access Stratus in the admin dashboard">
    Navigate to the **Stratus** section in the [Snag admin dashboard](https://admin.snagsolutions.io). You will see tabs for Functions, Subscriptions, Relayers, and Onchain Tokens.
  </Step>

  <Step title="Create a Stratus API key">
    Go to the **API Keys** page and create a new key with the **Stratus** scope. This key is used for webhook invocations and API access to Stratus services.

    <Warning>
      Stratus API keys are separate from Website API keys. Do not use Stratus keys with loyalty endpoints, and vice versa.
    </Warning>
  </Step>

  <Step title="Build your first function">
    Head to [Functions](/stratus/functions) to write and deploy your first serverless function. Check out the [function templates](/stratus/function-templates) for common patterns.
  </Step>
</Steps>

## Related pages

<CardGroup cols={2}>
  <Card title="Function Syntax" icon="code" href="/stratus/syntax">
    Reference guide for writing valid Stratus functions with proper exports, parameters, and module imports.
  </Card>

  <Card title="Function Templates" icon="copy" href="/stratus/function-templates">
    Pre-built templates for common use cases like airdrops, token gating, and custom reward logic.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/stratus/webhooks">
    Configure webhook endpoints to receive real-time notifications for onchain and loyalty events.
  </Card>

  <Card title="Function Loyalty Rule" icon="wand-magic-sparkles" href="/stratus/function-loyalty-rule">
    Create custom loyalty rules powered by Stratus serverless functions.
  </Card>
</CardGroup>
