You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> 🚀 **Try [Reflex Build](https://build.reflex.dev/)** – our AI-powered app builder that generates full-stack Reflex applications in seconds.
24
+
> Build faster with Reflex:
25
+
>
26
+
> -**[AI Builder](https://build.reflex.dev/)** - Generate full-stack Reflex apps in seconds.
27
+
> -**[Agent Toolkit](https://reflex.dev/docs/ai/integrations/ai-onboarding/)** - Connect MCP and Skills to your coding assistant.
28
+
> -**[App Management](https://reflex.dev/hosting)** - Deploy and manage your Reflex apps.
25
29
26
30
---
27
31
@@ -33,7 +37,6 @@ Key features:
33
37
34
38
-**Pure Python** - Write your app's frontend and backend all in Python, no need to learn Javascript.
35
39
-**Full Flexibility** - Reflex is easy to get started with, but can also scale to complex apps.
36
-
-**Deploy Instantly** - After building, deploy your app with a [single command](https://reflex.dev/docs/hosting/deploy-quick-start/) or host it on your own server.
37
40
38
41
See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architecture/#the-reflex-architecture) to learn how Reflex works under the hood.
39
42
@@ -43,250 +46,77 @@ See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architectu
43
46
44
47
## 🥳 Create your first app
45
48
46
-
### 1. Create the project directory
49
+
Create a project, add Reflex, and start the development server with [uv](https://docs.astral.sh/uv/):
47
50
48
-
Replace `my_app_name` with your project name:
49
-
50
-
```bash
51
+
```shell
51
52
mkdir my_app_name
52
53
cd my_app_name
53
-
```
54
-
55
-
### 2. Install uv
56
-
57
-
Reflex recommends [uv](https://docs.astral.sh/uv/) for managing your project environment and dependencies.
58
-
See the [uv installation docs](https://docs.astral.sh/uv/getting-started/installation/) for your platform.
This command initializes a template app in your new directory:
85
-
86
-
```bash
87
57
uv run reflex init
88
-
```
89
-
90
-
### 6. Run the app
91
-
92
-
You can run this app in development mode:
93
-
94
-
```bash
95
58
uv run reflex run
96
59
```
97
60
98
61
You should see your app running at http://localhost:3000.
99
62
100
63
Now you can modify the source code in `my_app_name/my_app_name.py`. Reflex has fast refreshes so you can see your changes instantly when you save your code.
101
64
102
-
### Troubleshooting
103
-
104
-
If the `reflex` command is not on your PATH, run it through uv instead: `uv run reflex init` and `uv run reflex run`
105
-
106
65
## 🫧 Example App
107
66
108
-
Let's go over an example: creating an image generation UI around [DALL·E](https://platform.openai.com/docs/guides/images/image-generation?context=node). For simplicity, we just call the [OpenAI API](https://platform.openai.com/docs/api-reference/authentication), but you could replace this with an ML model run locally.
109
-
110
-
67
+
Build an image generation app in Python with Reflex: define the UI, manage state in a class, and call an image model from an event handler.
111
68
112
69
<divalign="center">
113
-
<imgsrc="https://raw.githubusercontent.com/reflex-dev/reflex/main/docs/images/dalle.gif"alt="A frontend wrapper for DALL·E, shown in the process of generating an image."width="550" />
<img src="https://raw.githubusercontent.com/reflex-dev/reflex/main/docs/images/reflex-image-generation-app.png" alt="Preview of an image generation app built with Reflex" width="900">
73
+
</a>
74
+
</video>
114
75
</div>
115
76
116
-
117
-
118
-
Here is the complete code to create this. This is all done in one Python file!
<imgsrc="https://raw.githubusercontent.com/reflex-dev/reflex/main/docs/images/dalle_colored_code_example.png"alt="Explaining the differences between backend and frontend parts of the DALL-E app."width="900" />
184
-
</div>
185
-
186
-
### **Reflex UI**
187
-
188
-
Let's start with the UI.
189
-
190
-
```python
191
-
defindex():
192
-
return rx.center(...)
193
-
```
194
-
195
-
This `index` function defines the frontend of the app.
196
-
197
-
We use different components such as `center`, `vstack`, `input`, and `button` to build the frontend. Components can be nested within each other
198
-
to create complex layouts. And you can use keyword args to style them with the full power of CSS.
199
-
200
-
Reflex comes with [60+ built-in components](https://reflex.dev/docs/library) to help you get started. We are actively adding more components, and it's easy to [create your own components](https://reflex.dev/docs/wrapping-react/overview/).
201
-
202
-
### **State**
203
-
204
-
Reflex represents your UI as a function of your state.
205
-
206
-
```python
207
-
classState(rx.State):
208
-
"""The app state."""
209
-
210
-
prompt =""
211
-
image_url =""
212
-
processing =False
213
-
complete =False
214
-
```
215
-
216
-
The state defines all the variables (called vars) in an app that can change and the functions that change them.
217
-
218
-
Here the state is comprised of a `prompt` and `image_url`. There are also the booleans `processing` and `complete` to indicate when to disable the button (during image generation) and when to show the resulting image.
Within the state, we define functions called event handlers that change the state vars. Event handlers are the way that we can modify the state in Reflex. They can be called in response to user actions, such as clicking a button or typing in a text box. These actions are called events.
236
-
237
-
Our DALL·E app has an event handler, `get_image` which gets this image from the OpenAI API. Using `yield` in the middle of an event handler will cause the UI to update. Otherwise the UI will update at the end of the event handler.
Reflex Build uses AI to generate complete full-stack Python applications. It helps you quickly create, customize, and refine your Reflex apps — from frontend components to backend logic — so you can focus on your ideas instead of boilerplate code. Whether you’re prototyping or scaling, Reflex Build accelerates development by intelligently scaffolding and optimizing your app’s entire stack.
269
-
270
-
Alongside this, [Reflex Cloud](https://cloud.reflex.dev) launched in 2025 to offer the best hosting experience for your Reflex apps. We’re continuously improving the platform with new features and capabilities.
271
-
272
-
Reflex has new releases and features coming every week! Make sure to :star: star and :eyes: watch this repository to stay up to date.
273
-
274
-
## Contributing
275
-
276
-
We welcome contributions of any size! Below are some good ways to get started in the Reflex community.
277
-
278
-
-**Join Our Discord**: Our [Discord](https://discord.gg/T5WSbC2YtQ) is the best place to get help on your Reflex project and to discuss how you can contribute.
279
-
-**GitHub Discussions**: A great way to talk about features you want added or things that are confusing/need clarification.
280
-
-**GitHub Issues**: [Issues](https://github.com/reflex-dev/reflex/issues) are an excellent way to report bugs. Additionally, you can try and solve an existing issue and submit a PR.
281
-
282
-
We are actively looking for contributors, no matter your skill level or experience. To contribute check out [CONTRIBUTING.md](https://github.com/reflex-dev/reflex/blob/main/CONTRIBUTING.md)
0 commit comments