Skip to main content

Litestar Vite

Litestar Vite connects the Litestar backend to a Vite toolchain. It supports SPA, Template, Inertia, and meta-framework workflows, and it can proxy Vite dev traffic through your ASGI port or run Vite directly.

Features

  • One-port dev: proxies Vite HTTP + WS/HMR through Litestar on a single ASGI port by default.
  • Framework-mode support: use mode="framework" (alias mode="ssr") for Astro, Nuxt, and SvelteKit. Litestar proxies everything except your API routes.
  • Production assets: reads the Vite manifest from public/manifest.json (configurable) and serves under asset_url.
  • Type-safe frontends: optional OpenAPI/routes export plus @hey-api/openapi-ts via the Vite plugin.
  • Inertia support: Inertia v2/v3 protocol support with session middleware, script-element bootstrap by default, and optional SSR.

Install

pip install litestar-vite
npm install litestar-vite-plugin

Quick Start

from litestar import Litestar
from litestar_vite import VitePlugin

app = Litestar(plugins=[VitePlugin()])
litestar assets init --template vue
litestar assets install
litestar run --reload

VitePlugin() detects development and production behavior without manual VITE_DEV_MODE parsing. The effective litestar run --host/--port values are also passed to the frontend environment and .litestar.json bridge.

Optional Granian native static serving

Granian 0.16+ can serve eligible production bundle files before the request enters Python:

from litestar import Litestar
from litestar_granian import GranianPlugin
from litestar_vite import VitePlugin

app = Litestar(plugins=[VitePlugin(), GranianPlugin(static="auto")])

This is an optimization, not a separate application configuration. The Litestar static route stays registered, so Uvicorn and other ASGI servers serve the same files. Granian automatically falls back to Litestar when assets are protected, customized, missing, or otherwise unsafe to intercept.

Native hits bypass ASGI middleware, guards, compression, custom headers, and Python access logging. Keep protected or customized assets on the Litestar fallback path. See the production guide for the server matrix and advanced configuration.

Documentation

Common Commands

  • litestar assets init --template <name>: scaffold a frontend or framework app
  • litestar assets install: install frontend dependencies with the configured executor
  • litestar assets build: build production assets
  • litestar assets serve: run the frontend toolchain directly
  • litestar assets generate-types: export OpenAPI, routes, and Inertia page-prop metadata
  • litestar assets doctor: inspect and optionally repair config drift

Development

# Install Python, docs, and JS dependencies; build package artifacts
make install && make build

# Run an example app
uv run litestar --app-dir examples/vue-inertia assets install
uv run litestar --app-dir examples/vue-inertia run

Replace vue-inertia with any other example app: vue, react, svelte, react-inertia, htmx, angular, astro, nuxt, or sveltekit.

litestar-vite now defaults Inertia apps to script-element bootstrap. Inertia v3 clients use that transport automatically; if you pin Inertia v2, keep createInertiaApp({ defaults: { future: { useScriptElementForInitialPage: true } } }) aligned in the browser entry and SSR entry when ssr=True is enabled, or opt back into the legacy data-page path with InertiaConfig(use_script_element=False).

Metadata

Release files for litestar-vite 0.32.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 litestar-vite 0.32.0
File Size Uploaded
litestar_vite-0.32.0.tar.gz 686.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for litestar-vite 0.32.0
File Interpreter ABI Platform
litestar_vite-0.32.0-py3-none-any.whl Python 3 none any Details

Total release size: 996.5 kB

Release files / litestar_vite-0.32.0.tar.gz

Download URL litestar_vite-0.32.0.tar.gz
Size 686.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4a96c5ae29b3169c89d54c55150f1612bd95344dc882b1ecbee12b815e0edf55
BLAKE2b-256 checksum
How to use checksums
765c4cdce005d9a81b1b0e7ca395aff01505e36917c508aab2fb0a5f5b35e939
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 28, 2026.

Transparency log

Release files / litestar_vite-0.32.0-py3-none-any.whl

Download URL litestar_vite-0.32.0-py3-none-any.whl
Size 309.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31ad3abfea7d9f3e4ff13b25d27badbd2774f0fe9f3776e7f8e1bfb16bc1a7ab
BLAKE2b-256 checksum
How to use checksums
80fe94a7e3981fb7173bcb0fc5439166bd5fd29f6bff00a0ab00cf0ef758c4f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.32.0 This release

2 release files

0.31.0

2 release files

0.30.1

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.28.0

2 release files

0.27.0

2 release files

0.25.0

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.1

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.18.2

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.1

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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