Tool to create or patch FastAPI+Vue projects with integrated build/dev systems
Project description
fastapi-vue-setup
Tool to create or patch FastAPI project with a Vue frontend, with integrated build and development systems. The Python package will not need any JS runtime because it includes a prebuilt Vue frontend in it. For development (Vite and FastAPI auto reloads) and building the package one of npm, deno or bun is required (npm recommended due to bugs in deno and bun).
Features
- No JavaScript: Your Python package can be installed and used without any JS runtime
- Integrated build system: Vue frontend builds into Python package during
uv build - Development server: Single command runs Vite + FastAPI with hot-reload
- Optimized static serving: Caching, zstd compression and SPA support
Installation
Install uv, then:
uv tool install fastapi-vue-setup
fastapi-vue-setup --help
Or run directly:
uvx fastapi-vue-setup my-app
Usage
The script may be used to create an all new project folder or to patch or update an existing project to use this framework. It autodetects the project folder given and performs the appropriate actions.
Create a new project
fastapi-vue-setup my-app
This will:
- Run
uv init my-app - Run
create-vue frontend(interactive - choose your Vue options) - Patch the project with FastAPI integration
- Install dependencies via
uv add
Patch an existing project
You should have your pyproject.toml at the current working directory, and Vue with its package.json under frontend/. If either one is missing, new applications will be initialised. Otherwise we only patch what can be patched without breaking your existing projects.
fastapi-vue-setup .
CLI Options
fastapi-vue-setup [project-dir] [options]
Options:
--module-name NAME Python module name (auto-detected from pyproject.toml)
--dry-run Preview changes without modifying files
Port Configuration
The tool uses three distinct ports:
| Port | Purpose | Used by |
|---|---|---|
| 5173 | Vite dev server (HMR) | npm run dev via devserver.py |
| 5180 | FastAPI in dev mode | uvicorn via devserver.py |
| 5080 | Production server | uv run my-app |
In development, you access the app at http://localhost:5173. Vite proxies /api/* requests to FastAPI at port 5180. Configurable with devserver.py arguments.
In production, FastAPI serves both the API and static files at http://localhost:5080. Configurable by host:port argument.
Vite Plugin Configuration
The fastapiVue() plugin in vite.config.ts accepts options to customize proxy behavior:
import fastapiVue from "./vite-plugin-fastapi.js";
export default defineConfig({
plugins: [
vue(),
// Default: proxies only /api
fastapiVue(),
// Or specify custom paths to proxy to backend
fastapiVue({ paths: ["/api", "/auth", "/ws"] }),
],
});
The plugin reads environment FASTAPI_VUE_BACKEND_URL (default: http://localhost:5180) to determine where to proxy requests. This is set automatically by devserver.py.
Project Structure
After patching, your project will have:
my-app/
├── frontend/ # Vue application
│ ├── src/
│ ├── vite.config.ts # Builds to ../my_app/frontend-build
│ └── package.json
├── my_app/ # Python package
│ ├── __init__.py
│ ├── __main__.py # CLI entry point
│ ├── app.py # FastAPI application
│ └── frontend-build/ # Built frontend (gitignored)
├── scripts/
│ ├── devserver.py # Development server
│ └── fastapi-vue/ # Build utilities
└── pyproject.toml # Project configuration
The script finds your existing fastpi app module and other files and patches them with minimal changes to enable the Vue-FastAPI interconnection.
Development Workflow
# Start dev server (runs both Vite and FastAPI)
uv run scripts/devserver.py
# Build for production
uv build
# Run production server
uv run my-app
Frontend serving
Your FastAPI app will use fastapi-vue to serve the frontend file. Refer to that package's documentation for further configuration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_vue_setup-0.2.0.tar.gz.
File metadata
- Download URL: fastapi_vue_setup-0.2.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a37607abc4ff9b11b0dfb1a7777b3dc522dbc20cc6f58354f9890246cfb1edd8
|
|
| MD5 |
bfd99dcc5bef6de419a4b58ac11e0c0b
|
|
| BLAKE2b-256 |
6b9bb7416dff90bae40a16af1316ac1d3b79687b90933b6918480c18fa04fbd8
|
File details
Details for the file fastapi_vue_setup-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_vue_setup-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
894d271b13170fdf153168fac70c8149f51f72609e89583b14415b035634fda7
|
|
| MD5 |
542c60c8de721d3c37ee7d4961891cdc
|
|
| BLAKE2b-256 |
4515757593e4d4b07b5cc2bfea70762d5cc257dc6e3a29b11ebb7dbc47abec29
|