Skip to content

Flask-Inertia adapter - An experimental adapter that lets Flask applications behave like Laravel when paired with Inertia.js and React

License

Notifications You must be signed in to change notification settings

MuhammadKalimullahkhan/fluxia_flask

Repository files navigation

Flask-Inertia Adapter

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.

Repository Layout

  • 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 by npm run build.
  • tests/ – Automated tests for the adapter package.

Getting Started

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 install

Development Workflow

Run the React dev server (hot reload + HMR):

npm run dev

Run Flask in another terminal:

flask --app app.py --debug run
# or python app.py

The Jinja template will automatically load http://localhost:5173/src/main.jsx while --debug (or USE_VITE_DEV_SERVER=True) is enabled.

Production Build

npm run build   # emits assets into ./static
flask --app app.py run

templates/index.html will now include static/assets/main.js (and main.css if present).

Tests

pytest

About

Flask-Inertia adapter - An experimental adapter that lets Flask applications behave like Laravel when paired with Inertia.js and React

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published