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

# Runtime

> The runtime environment and platform APIs available to your edge functions.

Edge Compute runs your functions in real Linux containers, giving you access to standard runtime APIs and system calls. Unlike V8 isolate-based platforms, you have a full POSIX environment with native language runtimes.

## Runtime Environment

Your functions run in lightweight containers with:

* **Full language runtimes** — Python 3.11+, Node.js 18+, Go 1.25+, Java 17+ (Quarkus)
* **Standard libraries** — Use native packages and dependencies
* **POSIX APIs** — File I/O, environment variables, process control
* **Network access** — HTTP clients, TCP sockets, DNS resolution

## Platform APIs

Edge Compute provides platform bindings for accessing Telnyx services:

* [Bindings](/docs/edge-compute/runtime/bindings) — Connect to Telnyx APIs (Voice, Messaging, Storage) with auto-injected credentials
* [Execution Model](/docs/edge-compute/runtime/execution-model) — Function lifecycle, cold starts, concurrency

## Accessing Environment

Configuration is injected via environment variables:

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    // Environment variables from func.toml
    const logLevel = process.env.LOG_LEVEL || 'info';
    const apiEndpoint = process.env.API_ENDPOINT;

    // Binding credentials (auto-injected)
    const telnyxKey = process.env.TELNYX_API_KEY;
    ```
  </Tab>

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

    import "os"

    func main() {
        // Environment variables from func.toml
        logLevel := os.Getenv("LOG_LEVEL")
        apiEndpoint := os.Getenv("API_ENDPOINT")

        // Binding credentials (auto-injected)
        telnyxKey := os.Getenv("TELNYX_API_KEY")
    }
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os

    # Environment variables from func.toml
    log_level = os.environ.get('LOG_LEVEL', 'info')
    api_endpoint = os.environ.get('API_ENDPOINT')

    # Binding credentials (auto-injected)
    telnyx_key = os.environ.get('TELNYX_API_KEY')
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    public class Handler {
        // Environment variables from func.toml
        private static final String LOG_LEVEL = System.getenv("LOG_LEVEL");
        private static final String API_ENDPOINT = System.getenv("API_ENDPOINT");

        // Binding credentials (auto-injected)
        private static final String TELNYX_KEY = System.getenv("TELNYX_API_KEY");
    }
    ```
  </Tab>
</Tabs>

## HTTP Handling

Functions receive HTTP requests and return responses:

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    const express = require('express');
    const app = express();

    app.use(express.json());

    app.all('/', (req, res) => {
        if (req.method === 'POST') {
            return res.json({ received: req.body });
        }
        
        res.json({ status: 'ok' });
    });

    app.listen(8080);
    ```
  </Tab>

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

    import (
        "encoding/json"
        "net/http"
    )

    func handler(w http.ResponseWriter, r *http.Request) {
        w.Header().Set("Content-Type", "application/json")
        
        if r.Method == "POST" {
            var data map[string]interface{}
            json.NewDecoder(r.Body).Decode(&data)
            json.NewEncoder(w).Encode(map[string]interface{}{
                "received": data,
            })
            return
        }
        
        json.NewEncoder(w).Encode(map[string]string{
            "status": "ok",
        })
    }

    func main() {
        http.HandleFunc("/", handler)
        http.ListenAndServe(":8080", nil)
    }
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from flask import Flask, request, jsonify

    app = Flask(__name__)

    @app.route('/', methods=['GET', 'POST'])
    def handler():
        if request.method == 'POST':
            data = request.get_json()
            return jsonify({"received": data})
        
        return jsonify({"status": "ok"})
    ```
  </Tab>
</Tabs>

## Networking

Functions can make outbound HTTP requests:

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    async function fetchData() {
        const response = await fetch('https://api.example.com/data');
        return response.json();
    }

    async function postData(payload) {
        const response = await fetch('https://api.example.com/submit', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify(payload)
        });
        return response.status;
    }
    ```
  </Tab>

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

    import (
        "bytes"
        "encoding/json"
        "net/http"
        "time"
    )

    var client = &http.Client{Timeout: 10 * time.Second}

    func fetchData() (map[string]interface{}, error) {
        resp, err := client.Get("https://api.example.com/data")
        if err != nil {
            return nil, err
        }
        defer resp.Body.Close()
        
        var data map[string]interface{}
        json.NewDecoder(resp.Body).Decode(&data)
        return data, nil
    }
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    def fetch_data():
        response = requests.get('https://api.example.com/data')
        return response.json()

    def post_data(payload):
        response = requests.post(
            'https://api.example.com/submit',
            json=payload,
            timeout=10
        )
        return response.status_code
    ```
  </Tab>
</Tabs>

## Next Steps

* [Bindings](/docs/edge-compute/runtime/bindings) — Access Telnyx services from your functions
* [Execution Model](/docs/edge-compute/runtime/execution-model) — Understand lifecycle and performance
* [Configuration](/docs/edge-compute/configuration) — Set environment variables and secrets
