Skip to main content

qpyserve

FastAPI + any frontend. One Python command. One browser address.

QPyServe is a thin bridge, not a new web framework. Write normal FastAPI endpoints and use plain HTML/JS, React, Vue, or another Vite frontend. QPyServe handles local startup, frontend dependencies, API proxying, hot reload, and static production serving.

Status: Early alpha. Not yet load-tested or security-audited. Multiple workers do not guarantee performance for 1,000 concurrent users.

Installation

pip install qpyserve

For a source checkout: python -m pip install -e . instead. If not yet released to PyPI, install from GitHub: pip install git+https://github.com/austinwin/qpyserve.git (requires repository access).

Hello world: two files

main.py:

from fastapi import FastAPI
from qpyserve import run

app = FastAPI()

@app.get('/api/hello')
def hello():
    return {'message': 'Hello from Python'}

if __name__ == '__main__':
    run(app, frontend='frontend', port=1111)

frontend/index.html:

<!doctype html>
<html lang="en">
  <body>
    <button id="hello">Call Python</button><pre id="result"></pre>
    <script>
      document.querySelector('#hello').onclick = async () => {
        const response = await fetch('/api/hello');
        document.querySelector('#result').textContent =
          JSON.stringify(await response.json());
      };
    </script>
  </body>
</html>
python main.py

Open http://localhost:1111. /api/hello serves the same origin and /docs shows FastAPI documentation. No Node.js, package.json, or additional commands are needed for plain HTML. Edit HTML/JS and the development page automatically refreshes.

React, Vue, or another Vite frontend

Point frontend='frontend' to an ordinary Vite project containing package.json with vite in its dependencies. The Python code does not change. Run python main.py.

  • QPyServe detects npm, pnpm, Yarn, or Bun from packageManager / lockfiles (npm is the fallback).
  • It installs missing frontend dependencies with the selected package manager, then runs the locally installed Vite. No npm run dev script is required.
  • Existing vite.config.js / .ts / .mjs and plugins are retained; Vite provides normal HMR.
  • Development browser URL stays http://localhost:1111. The API runs on loopback :1112 and is proxied through :1111.
  • Node.js and the chosen package manager must be installed for Vite projects. QPyServe does not silently install Node or fetch arbitrary runtime binaries. It reports what is missing.

See the runnable HTML counter and React counter.

Production and builds

Command Behavior
python main.py Start dev server, HMR/reload; install frontend packages if needed
python main.py --build Install packages if needed, build frontend, and exit
python main.py --prod Serve prebuilt frontend and FastAPI on one port
python main.py --prod --build Build frontend first, then serve it in production mode

Plain HTML needs no build. For Vite sites, build once in CI/CD using --build; production machines only need Python and the built static files. Avoid building on every production restart.

Production deployment: Put an HTTPS reverse proxy or managed load balancer in front, use process supervision, secure the API using ordinary FastAPI dependencies/middleware, and add shared storage/caching as needed. QPyServe does not provide authentication, rate limiting, distributed state, or production infrastructure on its own.

Advanced options (optional)

run(
    app,
    frontend='frontend',
    port=1111,
    host='127.0.0.1',
    workers=1,
    api_paths=['/ws', '/custom'],  # /api and FastAPI docs are always included
    dist='dist',
    app_import='main:app',  # only needed for nonstandard entrypoints
)

api_paths explicitly adds proxy prefixes for custom HTTP routes or WebSockets during Vite development and prevents those prefixes from falling back to the SPA HTML in production. It does not create or authenticate endpoints. Don't use a broad prefix such as / because it would consume frontend routes.

Bind host='0.0.0.0' only when you intentionally want to expose the service over a network; never expose the Vite development server to the public internet. workers > 1 requires production mode and a shared state store for data that must persist across processes. The normal FastAPI OpenAPI/docs and external API clients keep working. Custom Vite proxy/SSR settings remain your frontend's responsibility when your app needs unusual behavior.

Scope and boundaries

  • QPyServe: startup/orchestration, dependency detection, Vite development proxy, SPA/static file serving, basic dev reload.
  • FastAPI: APIs, authentication, security, WebSockets, validation, database code, dependency injection.
  • Vite: React/Vue/JS build, HMR, frontend plugins.
  • Deployment platform: HTTPS, worker replicas, monitoring, database, caches, queues, backups.

Vite builds are static SPAs; Next.js server-side rendering, distributed WebSocket fan-out, automatic Kubernetes provisioning, and shared-memory magic are not provided. The HTML file server excludes hidden files, package manager manifests, and Python sources; don't put secrets in a public frontend directory.

Contributing and verification

python -m pip install -e '.[test]'
python -m pytest -q
python -m build

Check AGENTS.md for AI-assisted contributions and RELEASING.md for PyPI publishing. MIT License.

Metadata

Release files for qpyserve 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qpyserve 0.1.0
File Size Uploaded Provenance Actions
qpyserve-0.1.0.tar.gz 16.3 kB With provenance Details for qpyserve-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qpyserve 0.1.0
File Interpreter ABI Platform Actions
qpyserve-0.1.0-py3-none-any.whl Python 3 none any Details for qpyserve-0.1.0-py3-none-any.whl

Total release size: 29.1 kB

Release files / qpyserve-0.1.0.tar.gz

Download URL qpyserve-0.1.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f42914b819ed921199205ec9915781f95bb7e4ab6b3a287db2058062d83181c9
BLAKE2b-256 checksum
How to use checksums
8c282ed75654f43cb871b72120d31b11610c534edae006bcf6ee5d09ff22f673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / qpyserve-0.1.0-py3-none-any.whl

Download URL qpyserve-0.1.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80ce9a17b59be4734c3675c82513ea133b9df34c257569d316f82dd45c557a00
BLAKE2b-256 checksum
How to use checksums
a49d06ac84f32e555a171cb0d1fef4197c20ebfd51ed3f7611cd33afd42287c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for qpyserve 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qpyserve-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page