jfluents is a zero-configuration utility that takes a JSON data instance and instantly generates a beautiful, interactive Microsoft Fluent UI v9 form. Export the same JSON to Python as a Pydantic model — either from a browser stub or via the FastAPI backend.
| Package | Description |
|---|---|
jfluents-web/ |
Next.js (App Router) frontend — JSON editor, recursive UI renderer, export source switcher |
jfluents-api/ |
FastAPI backend — Pydantic model generation via datamodel-code-generator |
The toolbar Browser | Backend control selects where Export to Python runs. The generated dialog labels the active source (Browser stub or FastAPI + datamodel-code-generator).
- JSON parsing, recursive UI generation, and form state run entirely in the browser via React Context.
- Export to Python uses a lightweight client-side Pydantic stub — no server required.
- Default when running
pnpm devwithout Docker.
- Select Backend in the toolbar (shown as unavailable if the API is not running or not configured).
- Export to Python proxies through Next.js (
/api/generate-pydantic) to FastAPI (POST /generate/pydantic). - Uses
datamodel-code-generatorto return a real Pydantic v2 model string.
cd jfluents-web
pnpm install
pnpm devOpen http://localhost:3000. Load a template from the dropdown or paste JSON on the left; the Fluent UI preview updates live on the right. Browser is selected by default — click Export to Python anytime.
Live demo: edvardhov.github.io/jfluents (Browser export only — no backend on GitHub Pages).
docker compose up --buildDocker starts the web app with Backend pre-selected (BACKEND_ENABLED=true). Click Export to Python to receive a generated Pydantic model from FastAPI.
Terminal 1 — API:
cd jfluents-api
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000Terminal 2 — Web:
cd jfluents-web
pnpm install
API_URL=http://localhost:8000 BACKEND_ENABLED=true pnpm devSelect Backend in the toolbar before exporting. BACKEND_ENABLED=true lets the UI detect and report backend availability; API_URL points the Next.js proxy at your local FastAPI instance.
JsonEditor + Templates
│
▼
SchemaContext (form state)
│
▼
SchemaRenderer (recursive Fluent UI mapping)
│
▼
PreviewPanel
Toolbar → DataProvider (Adapter)
├─ Browser: BrowserDataProvider (client stub)
└─ Backend: BackendDataProvider → /api/generate-pydantic → FastAPI
| Control | Purpose |
|---|---|
| Theme toggle | Switch light / dark mode |
| Help | Welcome dialog and guided tour |
| Fluent UI | Open Microsoft Fluent UI v9 docs |
| Browser | Backend | Python export source |
| Export to Python | Generate and show Pydantic code |
| JSON Type | Fluent UI Component |
|---|---|
string |
Input / Textarea (long strings) |
number |
SpinButton |
boolean |
Switch |
array (primitives) |
TagGroup + add input |
array (objects) |
List of Cards |
object |
Accordion / Card (recursive) |
null |
Disabled Input placeholder |
$ui directive |
Explicit control — 48 directives covering inputs, display, layout, navigation, data views, and overlays |
Use $ui on any object to opt into richer Fluent UI controls while keeping plain JSON working unchanged.
Recursion is bounded by MAX_DEPTH = 20 with stable path-based React keys.
| Variable | Default | Description |
|---|---|---|
API_URL |
http://localhost:8000 |
FastAPI base URL (Next.js server-side proxy) |
BACKEND_ENABLED |
unset | Set to true to enable backend availability checks and export via FastAPI |
NEXT_PUBLIC_BACKEND_MODE |
demo |
Initial toolbar selection: demo → Browser, full-stack → Backend |
WEB_ORIGIN |
http://localhost:3000 |
CORS origin for FastAPI |
The web app deploys automatically to GitHub Pages on every merge to main:
https://edvardhov.github.io/jfluents/
- Static export via
.github/workflows/deploy-pages.yml(runs after merge) - CI (
.github/workflows/ci.yml) runs build checks on every pull request mainis branch-protected — changes land only via pull request- Browser export works; Backend requires Docker or local FastAPI (API routes are not available on Pages)
- Local static build:
cd jfluents-web && pnpm build:pages→ output injfluents-web/out
- Frontend: Next.js 16, React 19, Fluent UI v9 (
makeStyles/ Griffel) - Backend: FastAPI, Pydantic v2, datamodel-code-generator
- Orchestration: Docker Compose
MIT — see LICENSE.