textual-serve is an open-source project that allows you to serve and access your Textual TUI (Text-based User Interface) applications via a web browser. The Textual app runs on a machine/server under your control and communicates with the browser via a custom protocol over WebSockets. End-users interacting with the app via their browser do not have direct access to the machine the application is running on, only to the running Textual app. It effectively turns Textual TUIs into multi-user web applications. The current version is 1.1.3, and it has a regular release cadence with recent updates.
pip install textual-serveVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a simple Textual application and then serve it using `textual-serve`. The `Server` class takes a shell command to launch your Textual app. The app will be accessible in a web browser, typically at `http://localhost:8000` by default.
Users may need to right-click and use the browser's paste option, or manually type the input. Check GitHub issues for potential workarounds or fixes.
Always check the release notes for both `textual` and `textual-serve` before upgrading. Pin `textual` dependency versions if stability is critical.
Thoroughly test the shell command (`python your_app.py` or `textual run your_app.py`) independently in a terminal to ensure it works before passing it to `textual_serve.server.Server`.
Design Textual applications served with `textual-serve` with this isolated execution model in mind. Any host system interaction must be explicitly built into the Textual app's functionality.
Ensure `textual-serve` is installed via `pip install textual-serve` and that your Python environment's script directory is in your system's PATH. Alternatively, you can run it using `python -m textual_serve serve`.
Install the package using pip: `pip install textual-serve`.
Stop the process currently using the port, or specify a different port for textual-serve using `textual serve --port <new_port>` (e.g., `textual serve --port 8001`).
Verify that `textual serve` is actively running, confirm the server URL and port match what the browser is trying to connect to, check for any firewall rules blocking the port, and ensure proxy configurations correctly handle WebSockets if applicable.