For AI agents: the complete documentation index is at llms.txt. Markdown versions are available by appending .md or sending Accept: text/markdown.
Reflex Logo
Docs Logo

Installation

~3 minutes · Requires Python 3.10+.

Starter rules file:

# Reflex conventions

- Reflex is pure Python that compiles to a React frontend. Do NOT write JS, HTML, or JSX.
- Components are function calls that return components; pass props as keyword args.
- NEVER use plain Python control flow on state Vars inside the render tree.
  No `if`, `for`, `len()`, or f-strings over a Var — use `rx.cond`, `rx.foreach`,
  and Var operators instead. (This is the most common mistake.)
- State lives in `rx.State` subclasses. State only mutates inside event-handler
  methods — never at module load or render time. Derived values use `@rx.var`.
- Event handlers may be `async` and may `yield` to push intermediate UI updates.
- Always run commands with `uv run` (e.g. `uv run reflex run`). Never bare `python`.
- `.web/` is generated output — never edit or commit it. `rxconfig.py` is the config entry point.
- Verify your work headlessly: `CI=1 uv run reflex run` (frontend :3000, backend :8000),
  add `--loglevel debug` to diagnose failures.

Virtual Environment

We recommend uv as the default; venv, conda, and poetry are alternatives.

Install Reflex on your system

Install uv

curl -LsSf https://astral.sh/uv/install.sh | sh

After installation, restart your terminal or run source ~/.bashrc (or source ~/.zshrc for zsh).

Alternatively, install via Homebrew, PyPI, or other methods.

Set up the Reflex project

Replace <your-app> with your project name, then switch into the new directory.

mkdir <your-app>
cd <your-app>
uv init
uv add reflex
uv run reflex init

Running uv run reflex init will return the option to start with a blank Reflex app or to try our AI builder.

Initializing the web directory.

Get started with a template:
(0) A blank Reflex app.
(1) Try our AI builder.
Which template would you like to use? (0):

If this is your first time, pick (0) A blank Reflex app — the rest of the docs assume you started there.

Run the App

Run it in development mode:

uv run reflex run

Your app runs at http://localhost:3000. Reflex hot reloads any code changes in real time — your edits show up automatically.

For troubleshooting, increase log verbosity with the --loglevel flag:

uv run reflex run --loglevel debug