ScriptsApr 3, 2026·2 min read

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.

SC
Script Depot · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

pip install reflex
reflex init my_app
cd my_app
reflex run

Open http://localhost:3000 — your app is running.

# my_app/my_app.py
import reflex as rx

class State(rx.State):
    count: int = 0
    def increment(self):
        self.count += 1

def index() -> rx.Component:
    return rx.box(
        rx.heading(f"Count: {State.count}"),
        rx.button("Click me", on_click=State.increment),
    )

app = rx.App()
app.add_page(index)

Intro

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 & Thanks

Created by Reflex. Licensed under Apache-2.0.

reflex — ⭐ 28,200+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets