Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

Latest commit

 

History

History
64 lines (44 loc) · 2.18 KB

File metadata and controls

64 lines (44 loc) · 2.18 KB
slug flet-for-fastapi
title Flet for FastAPI
authors feodor
tags
releases

We've just released Flet 0.10.0 with FastAPI support!

FastAPI coupled with Uvicorn, Hypercorn, Gunicorn or other web server replaces built-in Flet web server (Fletd) to reliably run production Flet workloads.

On the other hand, seasoned FastAPI developers can use Flet to easily add interactive, real-time dashboards and admin UI to their existing or new FastAPI services.

A minimal app example

import flet as ft
import flet.fastapi as flet_fastapi

async def main(page: ft.Page):
    await page.add_async(
        ft.Text("Hello, Flet!")
    )

app = flet_fastapi.app(main)

It's a simple app that just outputs "Hello, Flet!" on a web page.

To run the app install Flet for FastAPI and Uvicorn:

pip install flet
pip install uvicorn

Save the code above to hello.py and then start uvicorn as:

uvicorn hello:app

Open the browser and navigate to http://127.0.0.1:8000 to see the app running.

:::note Flet app must be async in order to work with FastAPI WebSocket handler. :::

Features and benefits

Check the guide for complete information about Flet with FastAPI.

Let us know what you think by joining Flet Discord server or creating a new thread on Flet GitHub discussions.