This repository hosts an experimental adapter that lets Flask applications behave like Laravel when paired with Inertia.js and React. The example app follows a Laravel-like layout: React source under templates/js, compiled assets under static, and Flask routes rendering Inertia pages.
app.py– Flask entrypoint wiring the adapter and exposing demo routes.flask_inertia/– Python package providing the Inertia helpers, middleware, and shared prop APIs.templates/index.html– Jinja shell that bootstraps the React app (using the Vite dev server in development and static bundles in production).templates/js/– React source (components, pages, layouts) managed by Vite.static/– Build output generated bynpm run build.tests/– Automated tests for the adapter package.
python -m venv .venv
source .venv/Scripts/activate # PowerShell: .\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
pip install -e .[dev] # adapter development dependencies
npm installRun the React dev server (hot reload + HMR):
npm run devRun Flask in another terminal:
flask --app app.py --debug run
# or python app.pyThe Jinja template will automatically load http://localhost:5173/src/main.jsx while --debug (or USE_VITE_DEV_SERVER=True) is enabled.
npm run build # emits assets into ./static
flask --app app.py runtemplates/index.html will now include static/assets/main.js (and main.css if present).
pytest