Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 3, 2026·2 min de lecture

Reflex — Full-Stack Web Apps in Pure Python

Build reactive web apps without JavaScript. Frontend and backend in one Python codebase. Deploys anywhere. 28K+ GitHub stars.

Introduction

Reflex is a full-stack Python web framework with 28,200+ GitHub stars that eliminates the need for JavaScript entirely. Define your UI, state management, and backend logic all in Python — Reflex compiles the frontend to an optimized React app and handles the backend with FastAPI. With 60+ built-in UI components, real-time state sync, database integration, and one-command deployment, Reflex lets Python developers build production web apps at the speed they build scripts. Used by thousands of teams for AI dashboards, internal tools, and customer-facing products.

Works with: Python, any Python library (Pandas, scikit-learn, OpenAI, etc.), PostgreSQL, SQLite. Best for Python developers who want to build web apps without learning React/Vue/JavaScript. Setup time: under 2 minutes.


Reflex Architecture

How It Works

You write: Pure Python
    |
    +-- Frontend (auto-compiled to React/Next.js)
    |     60+ UI components
    |     Real-time state sync via WebSocket
    |
    +-- Backend (FastAPI under the hood)
          State management
          Database ORM
          API endpoints

60+ Built-in Components

import reflex as rx

def dashboard():
    return rx.vstack(
        rx.heading("AI Dashboard"),
        rx.input(placeholder="Search...", on_change=State.set_query),
        rx.data_table(data=State.results, columns=["Name", "Score"]),
        rx.recharts.line_chart(
            rx.recharts.line(data_key="score"),
            data=State.chart_data,
        ),
        rx.button("Export CSV", on_click=State.export),
    )

Components include: tables, charts, forms, modals, tabs, accordions, menus, drawers, tooltips, progress bars, and more.

State Management

class ChatState(rx.State):
    messages: list[dict] = []
    input_text: str = ""
    loading: bool = False

    async def send_message(self):
        self.loading = True
        yield  # Update UI immediately

        response = await call_openai(self.input_text)
        self.messages.append({"role": "assistant", "content": response})
        self.input_text = ""
        self.loading = False

Database Integration

class User(rx.Model, table=True):
    name: str
    email: str
    created_at: datetime = datetime.now()

# CRUD operations
with rx.session() as session:
    session.add(User(name="Alice", email="alice@example.com"))
    session.commit()
    users = session.exec(select(User)).all()

One-Command Deploy

reflex deploy
# Deploys to Reflex Cloud (or export for self-hosting)

# Self-host export
reflex export
# Generates a Docker-ready production build

FAQ

Q: What is Reflex? A: Reflex is a full-stack Python web framework with 28,200+ GitHub stars. Write frontend and backend in pure Python — it compiles to React/Next.js automatically. 60+ UI components, real-time state sync, and one-command deployment.

Q: How is Reflex different from Streamlit or Gradio? A: Streamlit/Gradio are for quick demos. Reflex is for production web apps — it compiles to real React, supports custom components, database ORM, authentication, multi-page routing, and production deployment. Think "Next.js but in Python."

Q: Is Reflex free? A: Yes, open-source under Apache-2.0. Self-hosting is free. Reflex Cloud (managed hosting) has a free tier.


🙏

Source et remerciements

Created by Reflex. Licensed under Apache-2.0.

reflex — ⭐ 28,200+

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires