Quickstart
From zero to a Streamlit app querying real data in about five minutes.
You’ll create a project, register a data source, and ship a working in-browser Streamlit app that talks to it.
1. Create a project
Sign in to app.pycorner.dev, click New Project, pick the stlite type. You’ll land in the editor with an app.py and a requirements.txt.
2. Register a Resource
Resources are named connections that your apps address by name. Three kinds:
| Kind | Reach | Auth held by |
|---|---|---|
| Database | Server-side driver (postgres / mysql) | PyCorner backend |
| API | HTTP proxy to any upstream URL | PyCorner backend |
| Tunnel | Raw TCP to a target behind your firewall | Your tunnel agent |
Open the Resources tab and create one. For this quickstart we’ll do an API resource pointing at httpbin so you can run it without any database.
- Name:
httpbin - Upstream URL:
https://httpbin.org - Headers JSON:
{"X-From": "pycorner"}
Save.
3. Write the app
Back in the editor, replace app.py with:
import pycorner
import streamlit as st
st.title("My first PyCorner app")
api = pycorner.api("httpbin")
r = api.get("/headers")
st.write(f"HTTP {r.status_code}")
st.json(r.json())
requirements.txt stays empty — pycorner is auto-injected by the editor, and the rest is stdlib + streamlit.
Click Save. The preview on the right remounts and the script runs against your real resource. The response JSON will show the X-From: pycorner header injected by the backend.
4. Where to go from here
- Talk to a real database → Databases walks through creating a Postgres resource (direct or via your tunnel agent for on-prem DBs).
- Wrap a third-party API with secret-keeping → APIs covers header injection and egress routing.
- Use a native Python DB driver in the browser → Raw TCP shows the
pg8000+ raw-TCP path. - Reach internal infrastructure behind a firewall → Tunnel Agent explains the install.
Things to know
- Save mounts a fresh runtime. Each Save in the editor re-mounts Pyodide and re-runs the script with a freshly minted auth token. There’s no need to “deploy”.
pycorneris pre-injected. Don’t add it torequirements.txt. Do add anything else your script uses (e.g.pg8000,pymysql).st.dataframedoesn’t render data in stlite because pyarrow is mocked — usest.table(rows)orst.write(rows)instead. See Client library reference for the full list of stlite gotchas.