Installation
Reflex requires Python 3.8+.
Virtual Environment
We highly recommend creating a virtual environment for your project.
venv is the standard option. conda and poetry are some alternatives.
Install Reflex on your system
Install on macOS/Linux
We will go with venv here.
Prerequisites
macOS (Apple Silicon) users should install Rosetta 2. Run this command:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Create the project directory
Replace my_app_name
with your project name. Switch to the new directory.
mkdir my_app_name cd my_app_name
Setup virtual environment
python3 -m venv .venv source .venv/bin/activate
Install Reflex package
Reflex is available as a pip package.
pip install reflex
Initialize the project
reflex init
The command will return four template options to choose from as shown below.
Initializing the web directory. Get started with a template: (0) blank (https://blank-template.reflex.run) - A minimal template (1) dashboard (https://dashboard-new.reflex.run/) - A dashboard with tables and graphs (2) sales (https://sales-new.reflex.run/) - An app to manage sales and customers (3) ai_image_gen (https://ai-image-gen.reflex.run/) - An app to generate images using AI (4) ci_template (https://cijob.reflex.run/) - A template for continuous integration (5) api_admin_panel (https://api-admin-panel.reflex.run/) - An admin panel for an api. (6) nba (https://nba-new.reflex.run/) - A data visualization app for NBA data. (7) customer_data_app (https://customer-data-app.reflex.run/) - An app to manage customer data. Which template would you like to use? (0):
From here select a template.
Run the App
Run it in development mode:
reflex run
Your app runs at http://localhost:3000.
Reflex prints logs to the terminal. To increase log verbosity to help with debugging, use the --loglevel
flag:
reflex run --loglevel debug
Reflex will hot reload any code changes in real time when running in development mode. Your code edits will show up on http://localhost:3000 automatically.