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

# Create FastEdge HTTP applications

export const MethodSection = ({children}) => children ?? null;

export const MethodSwitch = ({children}) => {
  const tabs = React.Children.toArray(children).map(c => {
    if (!c || !c.props) return null;
    if (c.props.id) return c;
    const inner = c.props.children;
    if (inner && inner.props && inner.props.id) return inner;
    return null;
  }).filter(Boolean);
  const firstId = tabs.length > 0 ? tabs[0].props.id : "";
  const [active, setActive] = React.useState(firstId);
  React.useEffect(() => {
    try {
      const saved = localStorage.getItem("gcore_docs_method");
      if (saved && tabs.find(t => t.props.id === saved)) {
        setActive(saved);
      }
    } catch (_) {}
  }, []);
  React.useEffect(() => {
    try {
      document.querySelectorAll("h2[id], h3[id]").forEach(heading => {
        const visible = heading.offsetParent !== null;
        document.querySelectorAll(`a[href="#${heading.id}"]`).forEach(link => {
          if (link.closest("h1,h2,h3,h4,h5,h6")) return;
          const li = link.closest("li");
          if (li) li.style.display = visible ? "" : "none";
        });
      });
    } catch (_) {}
    window.dispatchEvent(new Event("scroll"));
  }, [active]);
  const handleClick = id => {
    setActive(id);
    try {
      localStorage.setItem("gcore_docs_method", id);
    } catch (_) {}
  };
  return <div>
      <div className="not-prose flex gap-0 border-b border-zinc-200 dark:border-zinc-800 mb-8 mt-2" role="tablist">
        {tabs.map(tab => {
    const isActive = active === tab.props.id;
    return <button key={tab.props.id} role="tab" aria-selected={isActive} onClick={() => handleClick(tab.props.id)} className={["px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer", isActive ? "border-primary text-primary" : "border-transparent text-zinc-500 hover:text-zinc-800 dark:hover:text-zinc-200"].join(" ")}>
              {tab.props.label}
            </button>;
  })}
      </div>

      {tabs.map(tab => <div key={tab.props.id} style={{
    display: active === tab.props.id ? "" : "none"
  }}>
          {tab.props.children}
        </div>)}
    </div>;
};

<MethodSwitch>
  <MethodSection id="portal" label="Customer Portal">
    FastEdge HTTP applications run on Gcore's edge network and respond to HTTP requests via a dedicated URL. An application is deployed from a compiled WebAssembly binary — built using the [JavaScript SDK](https://github.com/G-Core/FastEdge-sdk-js) or [Rust SDK](https://github.com/G-Core/FastEdge-sdk-rust) — or from a preconfigured template. Templates require no binary build step.

    ## Step 1. Build a Wasm binary

    <p>Skip this step when deploying from a template — go directly to [Step 2](#step-2-deploy-the-application).</p>

    <Tabs>
      <Tab title="Rust">
        <p>Required: [Rust and Cargo](https://rustup.rs). On Windows, also install [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) with the **Desktop development with C++** workload.</p>

        1. Add the Wasm compilation target:

           ```sh theme={null}
           rustup target add wasm32-wasip2
           ```

        2. Scaffold an application from the `http-base` template:

           ```sh theme={null}
           npm create fastedge-app@latest my-rust-app -- --rust --template http-base --no-verify
           ```

        3. Build the Wasm binary:

           ```sh theme={null}
           cd my-rust-app
           cargo build --release
           ```

        <p>The Wasm file is written to `./target/wasm32-wasip2/release/basic_wasi_http.wasm`. Upload this file in Step 2.</p>
      </Tab>

      <Tab title="JavaScript">
        <p>Required: [Node.js](https://nodejs.org).</p>

        1. Scaffold an application from the `http-base` template:

           ```sh theme={null}
           npm create fastedge-app@latest my-first-app -- --javascript --template http-base --no-verify
           ```

        2. Build the Wasm binary:

           ```sh theme={null}
           cd my-first-app
           npm install
           npm run build
           ```

        <p>The Wasm file is written to `./wasm/basic-http.wasm`. Upload this file in Step 2.</p>
      </Tab>
    </Tabs>

    ## Step 2. Deploy the application

    <p>Two deployment methods are available: from a custom binary built in Step 1, or from a preconfigured template — no binary is required for templates.</p>

    ### From a binary

    <p>Use this method when deploying a Wasm binary built with the Rust or JavaScript SDK in Step 1.</p>

    1. In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **FastEdge** > **HTTP Applications** > **Applications** and click **Create new application**.

           <Frame>
             <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-list-create-button.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=1a3e89e11437947886d698f50f02c2a7" alt="HTTP Applications list with the Create new application button" width="1469" height="447" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-list-create-button.png" />
           </Frame>

    2. On the **Create an application** page, click the **Upload binary** card.

           <Frame>
             <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-upload-binary.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=b8abf5e53404235e8d0e09e9b8aee62e" alt="Create an application page with the Upload binary card" width="1468" height="670" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-upload-binary.png" />
           </Frame>

    3. In the **Upload binary** dialog, click **Click to upload or drag and drop** and select the `.wasm` file. The portal processes the upload and opens the **Deploy application** page.

           <Frame>
             <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-upload-binary.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=b8abf5e53404235e8d0e09e9b8aee62e" alt="Create application page with Upload binary option selected" width="1468" height="670" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-upload-binary.png" />
           </Frame>

    4. Enter a **Name** for the application and an optional description.

    5. (Optional) In the **Response headers** section, click **Add response header** to add static headers to every HTTP response. Common uses: CORS (`Access-Control-Allow-Origin: *`), security headers (`X-Frame-Options: DENY`), custom cache directives.

    6. (Optional) In the **Environment variables** section, click **Add environment variable** and enter key-value pairs. The application reads these values at runtime using the FastEdge SDK — for example, `getEnv('API_ENDPOINT')` in JavaScript or `std::env::var("API_ENDPOINT")` in Rust. Use for configuration that changes between deployments without rebuilding the binary.

    7. (Optional) In the **Secrets** section, click **Add secret** to attach an encrypted value for sensitive data such as API keys or tokens. The app accesses it as a regular environment variable — the key set here becomes the variable name. A secret must exist in [Secrets Manager](/fastedge/secrets-manager/manage-secrets) before it can be attached.

    8. (Optional) In the **Edge Storage** section, click **Add Edge Storage** to attach a key-value store the application can query at the edge without hitting the origin server. The store must exist on the [Edge Storage](/fastedge/kv-stores/manage-kv-store) page before it can be attached.

           <Frame>
             <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/deploy-form-config-sections.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=356b627c69e08194bef8e6db8419f48c" alt="Deploy application form with response headers and environment variables sections" width="1536" height="730" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/deploy-form-config-sections.png" />
           </Frame>

    9. Click **Save and deploy**.

    <p>The application details page opens with the deployment URL.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-app-details-url-active.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=406dfebd37e0cc76d5ceef31081afcf6" alt="Application details page with URL and Active status" width="1469" height="447" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-app-details-url-active.png" />
    </Frame>

    ### From a template

    <p>Use this method to deploy a built-in or custom template without writing or building any code.</p>

    1. In the Customer Portal, navigate to **FastEdge** > **HTTP Applications** > **Applications** and click **Create new application**.

           <Frame>
             <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-list-create-button.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=1a3e89e11437947886d698f50f02c2a7" alt="HTTP Applications list with the Create new application button" width="1469" height="447" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-list-create-button.png" />
           </Frame>

    2. Scroll to the **Create from a template** section and select a template. Built-in templates are **Geolocation-based redirect** and **Markdown renderer**. To deploy from a custom template, create it first on the **HTTP Applications** > **Templates** page as described in [custom templates](/fastedge/create-manage-templates).

           <Frame>
             <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-create-from-template.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=fc75739e6e2c36f9cfe8c111b36c228f" alt="Create from a template section with Geolocation-based redirect and Markdown renderer" width="1467" height="656" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-create-from-template.png" />
           </Frame>

    3. Enter a **Name** for the application and an optional description.

    4. Fill in the **Template environment variables** required by the selected template:

       **Markdown renderer**

       * **BASE** (required): Base URL for Markdown source files. Example: `https://raw.githubusercontent.com/G-Core/FastEdge-sdk-js/main/`
       * **HEAD** (optional): HTML inserted into the `<head>` tag. Example: `<style>body{font-family:sans-serif}</style>`

       **Geolocation-based redirect**

       * **DEFAULT** (required): Fallback redirect URL for visitors whose country does not match any rule. Example: `https://example.com/fallback`
       * In the **Environment variables** section, add ISO 3166-1 alpha-2 country codes as keys with redirect URLs as values. Example: key `LU`, value `https://example.com/luxembourg`.

    5. (Optional) Configure additional sections:

       * **Response headers**: static headers added to every response (e.g., CORS or security headers).
       * **Environment variables**: runtime key-value pairs the application reads via the SDK. These are separate from the template-defined variables above.
       * **Secrets**: encrypted values for sensitive data such as API keys. The app accesses a secret as an environment variable using the key name set here. Requires an existing secret in Secrets Manager.
       * **Edge Storage**: a key-value store the app queries at the edge. Requires an existing store on the **FastEdge** > **Edge Storage** page.

           <Frame>
             <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/template-deploy-env-vars-form.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=da6c4c2a4565b158637fb0aad8721a49" alt="Deploy application form with template environment variables" width="1455" height="687" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/template-deploy-env-vars-form.png" />
           </Frame>

    6. Click **Save and deploy**.

    <p>The application details page opens with the deployment URL.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-app-details-url-active.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=406dfebd37e0cc76d5ceef31081afcf6" alt="Application details page after template deployment" width="1469" height="447" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-app-details-url-active.png" />
    </Frame>

    ## Step 3. Test the application

    <p>Click the URL at the top of the application details page to open the application in a browser, or test with curl:</p>

    ```sh theme={null}
    curl -i https://<app-name>-<id>.fastedge.app/
    ```

    <p>To find the URL later, navigate to **FastEdge** > **HTTP Applications** > **Applications** and check the **URL** column.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-application-list-edge-storage.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=5f1e9aaf3e0dc4f568600af3b85357ab" alt="HTTP Applications list with Name, URL, and Status columns" width="1470" height="439" data-path="images/docs/fastedge/getting-started/create-fastedge-apps/http-apps-application-list-edge-storage.png" />
    </Frame>
  </MethodSection>

  <MethodSection id="api" label="REST API">
    Deploy a compiled WebAssembly application to the FastEdge edge network using the [Python SDK](/developer-tools/sdks/python), [Go SDK](/developer-tools/sdks/go), or curl.

    <Info>
      An [API token](/account-settings/api-tokens) from the Gcore Customer Portal is required.
    </Info>

    <p>Set this variable before running the examples:</p>

    ```bash theme={null}
    export GCORE_API_KEY="{YOUR_API_KEY}"
    ```

    ## Step 1. Build a Wasm binary

    <p>Build the binary using the Rust or JavaScript SDK. Set `WASM_PATH` at the end of the tab — it is used in Step 2.</p>

    <Tabs>
      <Tab title="Rust">
        <p>Required: [Rust and Cargo](https://rustup.rs). On Windows, also install [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) with the **Desktop development with C++** workload.</p>

        ```bash theme={null}
        rustup target add wasm32-wasip2
        npm create fastedge-app@latest my-rust-app -- --rust --template http-base --no-verify
        cd my-rust-app && cargo build --release
        export WASM_PATH="./target/wasm32-wasip2/release/basic_wasi_http.wasm"
        ```
      </Tab>

      <Tab title="JavaScript">
        <p>Required: [Node.js](https://nodejs.org).</p>

        ```bash theme={null}
        npm create fastedge-app@latest my-first-app -- --javascript --template http-base --no-verify
        cd my-first-app && npm install && npm run build
        export WASM_PATH="./wasm/basic-http.wasm"
        ```
      </Tab>
    </Tabs>

    ## Step 2. Deploy the application

    <p>Deploying requires two calls: upload the binary, then create the application referencing the returned binary ID.</p>

    **1. Upload the binary**

    | Parameter    | Required | Description                                   |
    | ------------ | -------- | --------------------------------------------- |
    | Request body | Yes      | Raw Wasm binary as `application/octet-stream` |

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore(api_key=os.environ["GCORE_API_KEY"])

        with open(os.environ["WASM_PATH"], "rb") as f:
            binary = client.fastedge.binaries.create(f)

        # binary.id is needed for the next call
        print("Binary ID:", binary.id)
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "os"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/option"
        )

        func main() {
            client := gcore.NewClient(option.WithAPIKey(os.Getenv("GCORE_API_KEY")))

            f, err := os.Open(os.Getenv("WASM_PATH"))
            if err != nil {
                panic(err)
            }
            defer f.Close()

            binary, err := client.Fastedge.Binaries.New(context.TODO(), f)
            if err != nil {
                panic(err)
            }
            // binary.ID is needed for the next call
            fmt.Println("Binary ID:", binary.ID)
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -sX POST 'https://api.gcore.com/fastedge/v1/binaries/raw' \
          -H 'Authorization: APIKey $GCORE_API_KEY' \
          -H 'Content-Type: application/octet-stream' \
          --data-binary "@$WASM_PATH"
        ```

        <p>The API returns:</p>

        ```json theme={null}
        {"id": 4683, "api_type": "wasi-http", "status": 1, "checksum": "ba9dae6f9e5850833cd1929170916f2b"}
        ```

        ```bash theme={null}
        export BINARY_ID="{id}"   # replace with the id from the response above
        ```
      </Tab>
    </Tabs>

    **2. Create the application**

    | Parameter | Required | Description                                                       |
    | --------- | -------- | ----------------------------------------------------------------- |
    | `name`    | Yes      | Unique application name (lowercase letters, numbers, and hyphens) |
    | `binary`  | Yes      | Binary ID from the upload response                                |
    | `status`  | Yes      | `1` — enabled, `0` — disabled                                     |

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        app = client.fastedge.apps.create(
            name="my-edge-app",
            binary=binary.id,
            status=1,
        )
        print("App URL:", app.url)
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        import (
            "github.com/G-Core/gcore-go/fastedge"
            "github.com/G-Core/gcore-go/packages/param"
        )

        app, err := client.Fastedge.Apps.New(context.TODO(), fastedge.AppNewParams{
            App: fastedge.AppParam{
                Name:   param.NewOpt("my-edge-app"),
                Binary: param.NewOpt(binary.ID),
                Status: param.NewOpt(int64(1)),
            },
        })
        if err != nil {
            panic(err)
        }
        fmt.Println("App URL:", app.URL)
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -sX POST 'https://api.gcore.com/fastedge/v1/apps' \
          -H 'Authorization: APIKey $GCORE_API_KEY' \
          -H 'Content-Type: application/json' \
          -d "{\"name\": \"my-edge-app\", \"binary\": $BINARY_ID, \"status\": 1}"
        ```

        <p>The API returns:</p>

        ```json theme={null}
        {"id": 2543, "name": "my-edge-app", "url": "https://my-edge-app-1000503.fastedge.app", "status": 1, "binary": 4683, "api_type": "wasi-http", "plan": "Free"}
        ```
      </Tab>
    </Tabs>

    ## Step 3. Test the application

    <p>The deployment URL becomes active within a few seconds of creation. Send a request to the `url` from the create-app response:</p>

    ```bash theme={null}
    curl -i https://<app-name>-<id>.fastedge.app/
    ```

    <p>The `http-base` template returns a plain-text response:</p>

    ```
    HTTP/1.1 200 OK
    content-type: text/plain;charset=UTF-8

    Hello from FastEdge!
    ```
  </MethodSection>
</MethodSwitch>
