Skip to Content

PairSpaces

DocsBlog

PairSpaces

Sharing Services

How services running on your Space can be shared securely from a browser

You can use your Space to create software, work on a dataset, or collaborate on a machine learning algorithm. Sometimes you want to run a service from your Space and view it from a browser, for example, Streamlit, Gradio, Marimo, or your own web application.

This section explains how you can view and share services from your Space.

Note This section applies to Spaces created using the configuration that allows access from Terminal and IDE only. When you create Spaces that can be accessed from Terminal, IDE, and Browser, we default to making VSCode available as a service from a browser.

Sharing a Service from Spaces

You use the PairSpaces CLI to open a port on your Space. You open a port using pair space SPACE_ID --port PORT_NUMBER.


> pair space SPACE_ID --port 8000

Your Space is now available on port 8000, however, you must be authenticated in PairSpaces to access. Visit https://pairspaces.com/pairs/SPACE_ID to access your Space from this port.

If you run a service from your Space on port 8000, it will be accessible at the URL provided by the PairSpaces CLI, i.e., https://pairspaces.com/pairs/SPACE_ID. To demonstrate this, we will serve a FastAPI application from port 8000. First, install pip in your Space:

> curl -O https://bootstrap.pypa.io/get-pip.py

Then, use the FastAPI documentation from here to serve their example application. From your Space, use the following command to start the FastAPI service:

> fastapi dev main.py --host 0.0.0.0

And when you navigate to https://pairspaces.com/pairs/SPACE_ID you will access your FastAPI service.

This port will only be accessible to you and any team members you shared your Space with.

Previous

Sharing Spaces

Next

AWS