Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/whitphx/stlite/llms.txt

Use this file to discover all available pages before exploring further.

Stlite is a port of Streamlit to WebAssembly that lets you run Python data apps entirely inside the browser — no server, no backend, no deployment pipeline required. By compiling CPython to WebAssembly via Pyodide, Stlite executes your Streamlit scripts client-side, so every visitor runs the app locally in their own browser tab. You can ship a fully interactive Python app as a static HTML file, embed it in a React application, or bundle it into a cross-platform desktop executable.

How It Works

Stlite layers three key technologies to replace the traditional Streamlit server:
  • Pyodide (WebAssembly CPython) — A full CPython interpreter compiled to WebAssembly. Pyodide runs inside the browser and can import pure-Python packages from PyPI via micropip, as well as a growing set of packages with native extensions that have been pre-compiled for the Pyodide environment.
  • Web Workers — Python execution happens inside a Web Worker, keeping the heavy computation off the browser’s main thread so the UI stays responsive. An optional SharedWorker mode lets multiple Stlite apps share a single worker to reduce memory consumption.
  • No-server architecture — Stlite replaces Streamlit’s WebSocket-based communication between browser and server with an in-process message-passing bridge. The rendered UI components are the same as standard Streamlit; only the transport layer changes. The result is a fully static artifact — HTML, CSS, and JavaScript — that works when opened directly from the file system or hosted on any CDN.
Because Stlite runs in a sandboxed browser environment, some Python features behave differently. For example, time.sleep() is a no-op (use asyncio.sleep() instead), and only packages compatible with the Pyodide runtime can be installed. See the Stlite README for the full list of known limitations.

Packages

Stlite ships as several packages, each targeting a different distribution scenario. Choose the one that matches how you want to build and share your app.

@stlite/browser

Embed a Streamlit app in any static HTML page via a CDN <script> tag or the mount() JavaScript function. Zero build step required — ideal for quick sharing and simple self-hosted pages.

@stlite/react

React bindings for Stlite. Integrate the Pyodide-backed Streamlit kernel directly into an existing React application using createKernel() and the <StliteAppWithToast> component.

@stlite/desktop

Bundle your Streamlit app into a standalone desktop executable (.app, .exe, .dmg) using Electron and electron-builder. Packages ship with a pre-vendored Pyodide runtime so the app works fully offline.

@stlite/cli

Command-line tools for converting a local Streamlit project into a shareable URL, a self-contained HTML file, an offline web bundle, or a Stlite Desktop artifact — all from a single stlite command.

Package Comparison

PackageUse caseRequires build step?Distribution
@stlite/browserStatic HTML pages, quick embeds, CDN hostingNoSingle .html file or any static host
@stlite/reactEmbedding Streamlit inside a React applicationYes (Vite)Bundled web app
@stlite/desktopCross-platform desktop executablesYes (npm + electron-builder).app / .exe / .dmg installer
@stlite/cliCLI conversion of existing Streamlit projectsNo (npx / pip)Shareable URL, .html file, offline bundle, or desktop artifact

Key Features

  • No server required — the entire Python runtime runs in the visitor’s browser via WebAssembly.
  • Runtime package installation — install packages at startup using the requirements option (or <app-requirements> tag) via micropip. No rebuild needed.
  • Multipage apps — pass multiple pages/*.py files via the files option to build standard Streamlit multipage apps.
  • SharedWorker mode — run multiple Stlite apps in a single shared worker to reduce memory consumption when embedding many apps on one page.
  • IndexedDB file persistence — mount the IDBFS filesystem to chosen directories so files written by your Python code survive page reloads and browser sessions.
  • Custom Pyodide distribution — point the pyodideUrl option at your own Pyodide mirror for air-gapped or CDN-restricted environments.
  • Streamlit config support — pass streamlitConfig key-value pairs (e.g. theme.base, client.toolbarMode) to configure the app without a config.toml file.
  • Top-level await — unlike standard Streamlit, Stlite supports top-level await in app scripts, enabling async HTTP requests (pyodide.http.pyfetch()) and asyncio.sleep() directly at the script level.
  • HTTP client compatibilityrequests and urllib work via automatic pyodide-http patches; urllib3 ≥ 2.2.0 has native Pyodide support.
  • Desktop & offline bundles@stlite/desktop and @stlite/cli web pre-vendor the Pyodide runtime and package wheels so the app runs without any network access.

Try It Online

You can experiment with Stlite immediately — no installation needed — in the Stlite Sharing online editor: Open Stlite Sharing →

Build docs developers (and LLMs) love