Full-stack React + Python with zero configuration. Build modern React apps with FastAPI, Bun, Inertia.js, and Tailwind CSS.
Project description
PyReact Start
Full-stack React + Python with zero configuration.
Build modern React applications powered by FastAPI, Bun, Inertia.js, and Tailwind CSS — all from a single pip install.
Motivation
When building React apps with Python, you're stuck with tough choices:
- SPA-only: You have an empty shell, and React takes over in the browser. No SEO, slow initial loads, and you still need to build a REST/GraphQL API.
- Jinja + Islands: Server-render with templates, then sprinkle React components for interactivity. But now you're thinking in two different worlds. And coordinating state across islands is not easy.
JavaScript developers use full stack frameworks like Next.js — full SSR, hydration, and seamless client/server data flow. Most python developers don't want to leave python ecosystem for the backend needs, and many want to use react for the frontend.
PyReact Start aims to solve this by providing a zero-config way to build full-stack React + Python applications. Your FastAPI routes render React components directly. Full SSR, full hydration, no API layer to build. It's a thin wrapper around Inertia.js and FastAPI. It assumes bun runtime so it can provide zero config experience.
- 🚀 Zero Config: Just install and run. Handles TS, TSX/JSX, CSS bundling along with Tailwind support out of the box.
- 🐍 Python-First: FastAPI backend with Python's full ecosystem.
- ⚛️ Modern React: React 19 with server-side rendering out of the box.
- ⚡ Bun-Powered: Lightning-fast bundling and SSR performance.
Requirements:
- Bun v1.0+ must be installed
- Your project needs a
package.jsonwith React and Inertia dependencies
Quick Start
1. Setup a new project
mkdir my-app && cd my-app
# Create pyproject.toml with Python dependencies
cat > pyproject.toml << 'EOF'
[project]
name = "my-app"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = [
"pyreact-start",
"fastapi",
"uvicorn",
]
EOF
# Create package.json with JS dependencies
cat > package.json << 'EOF'
{
"name": "my-app",
"type": "module",
"private": true,
"dependencies": {
"@inertiajs/react": "^2.2.18",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"bun-plugin-tailwind": "^0.1.2",
"tailwindcss": "^4.1.17"
}
}
EOF
# Install dependencies
uv sync
bun install
# Create directories
mkdir -p backend frontend/pages static
touch backend/__init__.py
2. Create your FastAPI backend
# backend/main.py
from fastapi import FastAPI, Request
from fastapi.staticfiles import StaticFiles
from pyreact_start import Inertia
app = FastAPI()
inertia = Inertia(app)
app.mount("/static", StaticFiles(directory="static"), name="static")
@app.get("/")
async def home(request: Request):
return await inertia.render("Home", {"message": "Hello!"}, request)
if __name__ == "__main__":
import uvicorn
uvicorn.run("backend.main:app", host="0.0.0.0", port=8000, reload=True)
3. Create your first page
// frontend/pages/Home.jsx
export default function Home({ message }) {
return <h1>{message}</h1>;
}
/* frontend/styles.css */
@import "tailwindcss";
4. Run!
# Terminal 1: Frontend dev server
pyreact dev
# Terminal 2: FastAPI backend
APP_ENV=development python -m backend.main
Visit http://localhost:8000 🎉
Project Structure
my-app/
├── backend/
│ └── main.py # FastAPI application
├── frontend/
│ ├── pages/ # React pages (auto-discovered)
│ ├── layouts/ # Shared layouts (optional)
│ ├── components/ # Reusable components (optional)
│ └── styles.css # Tailwind entry point
├── static/dist/ # Generated assets (gitignored)
├── .pyreact/ # Generated entry files (gitignored)
├── package.json # JS dependencies
└── pyproject.toml # Python dependencies
The .pyreact/ directory contains auto-generated files:
pages.js— Page map (scanned fromfrontend/pages/)client.jsx— Client-side entry pointssr.jsx— Server-side rendering entry point
Commands
| Command | Description |
|---|---|
pyreact dev |
Start dev server with hot reloading |
pyreact build |
Build optimized production bundles |
pyreact ssr |
Start the SSR server for production |
Production
# Build optimized bundles
pyreact build
# Start the SSR server (background)
pyreact ssr &
# Start the FastAPI server
APP_ENV=production python -m backend.main
How It Works
- Auto-generated Entry Points: When you run
pyreact devorpyreact build, the CLI generates entry files in.pyreact/that wire up your pages. - Page Discovery: All
.jsxfiles infrontend/pages/are automatically discovered and mapped. - Inertia.js Integration: Your FastAPI routes render React components directly, with automatic SSR.
- Tailwind CSS: Styles are processed via
bun-plugin-tailwindduring bundling.
Requirements
- Python 3.11+
- Bun v1.0+
Examples
See the examples/ directory:
- basic-app — Minimal single-page example
- tasks-app — Complex multi-page app with authentication with client side routing.
License
MIT
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 pyreact_start-0.1.0.tar.gz.
File metadata
- Download URL: pyreact_start-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a258502847b82b0e4665f3eb71911fd8e5efc7e893a501b5c51932c2c969eea2
|
|
| MD5 |
175aa1b4f0cea2e02d7636c119e4c015
|
|
| BLAKE2b-256 |
e0332472eb1b0a11009d017975f8eead617764941f6b722571190a252f5b5554
|
File details
Details for the file pyreact_start-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyreact_start-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0699b4979d9a30463fb81fa636880b021415aa85bf37181a8aa666c295a3998
|
|
| MD5 |
4db87abdd354b7ebcaa8054e7757db70
|
|
| BLAKE2b-256 |
6ce3435351da856f1252b8e56116c6579f7f425a4b6d7a08137de6830e77a476
|