Skip to main content

Turn any machine into a public server instantly with automated zero-config tunnels.

Project description

GlobalHost 🛰️

Turn any machine running your code into a publicly accessible, secure SaaS backend instantly. No localhost, no router configuration, and zero cloud deployment setup needed during development.

Features

  • Zero-Config Public Ingress: Automatically spawns a secure, temporary public HTTPS tunnel (.trycloudflare.com) on startup.
  • Framework Agnostic: Works flawlessly out-of-the-box with FastAPI, Django, Flask, or raw Python scripts.
  • Self-Contained & Lightweight: Auto-provisions the exact native binary for your OS (Mac/Win/Lin) on the fly. No brew, apt, or manual downloads required, and keeps the pip package tiny.

Architecture

[ Any PC Running Your Code ] ──(Outbound Tunnel)──> [ Global Edge Network ] ──> [ Public Internet URL ]

Quick Start

1. Installation

pip install globalhost

2. Basic Usage (Zero-Config)

Drop this into your project entrypoint. This automatically boots the tunnel and wraps your web framework.

from globalhost import GlobalHostApp
from fastapi import FastAPI

app = FastAPI()

@app.get("/my-algo")
def run_algo():
    return {"status": "Your golden algo is live globally!"}

if __name__ == "__main__":
    # Boots tunnel and starts the server
    GlobalHostApp.launch(framework="fastapi", app="main:app", port=8000)

3. Programmatic Usage (Advanced)

Need to inject the live public URL into a database, webhook, or frontend config at runtime? Use the programmatic API:

from globalhost import GlobalHostApp

gh = GlobalHostApp()

# Start the tunnel and grab the endpoint string
public_endpoint = gh.tunnel.start(port=9000)

print(f"🔗 Live Hyperlink: {public_endpoint}")
print(f"📦 Stored Attribute: {gh.tunnel.public_url}")

# Keep tunnel alive while your app runs...

How It Works Under the Hood

  1. OS Detection: On execution, the module identifies the hosting machine's operating system and architecture.
  2. Auto-Provisioning: It silently downloads and caches the exact lightweight network binary required for that specific system.
  3. Reverse Tunnel Routing: It executes the binary to establish a secure outbound connection to a global edge router, bypassing local firewalls and printing your public production-ready endpoint straight to the console.

Examples

Ready-to-run implementations are available in the examples/ directory:

  • FastAPI: examples/fastapi/01_json_api.py & 02_webpage.py
  • Django: examples/django/01_json_api.py & 02_webpage.py
  • Runtime URL Extraction: examples/runtime_url.py

Author

Joel Opoku 📧 joelclouds@gmail.com 🌐 joelclouds.pythonanywhere.com 🐙 github.com/joelclouds/globalhost

License

Distributed under the MIT License. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

globalhost-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

globalhost-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file globalhost-0.1.0.tar.gz.

File metadata

  • Download URL: globalhost-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for globalhost-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c0b47892554b0a4bfbad39d038dac56b846bb41820a92730b25ee06419cee70f
MD5 f435a4f26b96b916552a8edc36546480
BLAKE2b-256 e5b3f25229fbf09125f590f22dce68510b8062c135031269faa07f055a64ef9e

See more details on using hashes here.

File details

Details for the file globalhost-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: globalhost-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for globalhost-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bfd3cc26dc530d5d53f3f7fb0832ef302b83d19f8aef4cf4ce19aadb0197427
MD5 8827f4b049623820b1b7b63bae76c8f7
BLAKE2b-256 f1d3ca6f106cf8ccb78ea6d92f0261e0141c4f67fb8b314311a13b6da24c8934

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page