{"id":13405569,"url":"https://github.com/reflex-dev/reflex","last_synced_at":"2026-01-21T00:08:17.557Z","repository":{"id":63444573,"uuid":"557075997","full_name":"reflex-dev/reflex","owner":"reflex-dev","description":"🕸️ Web apps in pure Python 🐍","archived":false,"fork":false,"pushed_at":"2025-05-12T17:10:23.000Z","size":25020,"stargazers_count":22625,"open_issues_count":261,"forks_count":1329,"subscribers_count":170,"default_branch":"main","last_synced_at":"2025-05-12T18:24:10.861Z","etag":null,"topics":["framework","gui","hacktoberfest","open-source","python","web"],"latest_commit_sha":null,"homepage":"https://reflex.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reflex-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-25T03:08:48.000Z","updated_at":"2025-05-12T17:10:26.000Z","dependencies_parsed_at":"2023-10-12T05:17:00.912Z","dependency_job_id":"18b53fa3-8496-4e33-94dc-afbb01398828","html_url":"https://github.com/reflex-dev/reflex","commit_stats":{"total_commits":2001,"total_committers":164,"mean_commits":"12.201219512195122","dds":0.7816091954022988,"last_synced_commit":"3d89d74bdcd5afb85408ebb67a672701579f4efc"},"previous_names":["pynecone-io/reflex","reflex-dev/reflex","pynecone-io/pynecone"],"tags_count":98,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reflex-dev%2Freflex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reflex-dev%2Freflex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reflex-dev%2Freflex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reflex-dev%2Freflex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reflex-dev","download_url":"https://codeload.github.com/reflex-dev/reflex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253797378,"owners_count":21965881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","gui","hacktoberfest","open-source","python","web"],"created_at":"2024-07-30T19:02:05.640Z","updated_at":"2026-01-21T00:08:17.550Z","avatar_url":"https://github.com/reflex-dev.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/reflex-dev/reflex/main/docs/images/reflex.svg\" alt=\"Reflex Logo\" width=\"300px\"\u003e\n\n\u003chr\u003e\n\n### **✨ Performant, customizable web apps in pure Python. Deploy in seconds. ✨**\n\n[![PyPI version](https://badge.fury.io/py/reflex.svg)](https://badge.fury.io/py/reflex)\n![versions](https://img.shields.io/pypi/pyversions/reflex.svg)\n[![Documentation](https://img.shields.io/badge/Documentation%20-Introduction%20-%20%23007ec6)](https://reflex.dev/docs/getting-started/introduction)\n[![PyPI Downloads](https://static.pepy.tech/badge/reflex)](https://pepy.tech/projects/reflex)\n[![Discord](https://img.shields.io/discord/1029853095527727165?color=%237289da\u0026label=Discord)](https://discord.gg/T5WSbC2YtQ)\n[![Twitter](https://img.shields.io/twitter/follow/getreflex)](https://x.com/getreflex)\n\n\u003c/div\u003e\n\n---\n\n[English](https://github.com/reflex-dev/reflex/blob/main/README.md) | [简体中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_cn/README.md) | [繁體中文](https://github.com/reflex-dev/reflex/blob/main/docs/zh/zh_tw/README.md) | [Türkçe](https://github.com/reflex-dev/reflex/blob/main/docs/tr/README.md) | [हिंदी](https://github.com/reflex-dev/reflex/blob/main/docs/in/README.md) | [Português (Brasil)](https://github.com/reflex-dev/reflex/blob/main/docs/pt/pt_br/README.md) | [Italiano](https://github.com/reflex-dev/reflex/blob/main/docs/it/README.md) | [Español](https://github.com/reflex-dev/reflex/blob/main/docs/es/README.md) | [한국어](https://github.com/reflex-dev/reflex/blob/main/docs/kr/README.md) | [日本語](https://github.com/reflex-dev/reflex/blob/main/docs/ja/README.md) | [Deutsch](https://github.com/reflex-dev/reflex/blob/main/docs/de/README.md) | [Persian (پارسی)](https://github.com/reflex-dev/reflex/blob/main/docs/pe/README.md) | [Tiếng Việt](https://github.com/reflex-dev/reflex/blob/main/docs/vi/README.md)\n\n---\n\n\u003e [!NOTE]\n\u003e 🚀 **Try [Reflex Build](https://build.reflex.dev/)** – our AI-powered app builder that generates full-stack Reflex applications in seconds.\n\n---\n\n# Introduction\n\nReflex is a library to build full-stack web apps in pure Python.\n\nKey features:\n\n- **Pure Python** - Write your app's frontend and backend all in Python, no need to learn Javascript.\n- **Full Flexibility** - Reflex is easy to get started with, but can also scale to complex apps.\n- **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.\n\nSee our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architecture/#the-reflex-architecture) to learn how Reflex works under the hood.\n\n## ⚙️ Installation\n\n**Important:** We strongly recommend using a virtual environment to ensure the `reflex` command is available in your PATH.\n\n## 🥳 Create your first app\n\n### 1. Create the project directory\n\nReplace `my_app_name` with your project name:\n\n```bash\nmkdir my_app_name\ncd my_app_name\n```\n\n### 2. Set up a virtual environment\n\nCreate and activate virtual environment\n\n```bash\n# On Windows:\npython -m venv .venv\n.venv\\Scripts\\activate\n\n# On macOS/Linux:\npython3 -m venv .venv\nsource .venv/bin/activate\n```\n\n### 3. Install Reflex\n\nReflex is available as a pip package (Requires Python 3.10+):\n\n```bash\npip install reflex\n```\n\n### 4. Initialize the project\n\nThis command initializes a template app in your new directory:\n\n```bash\nreflex init\n```\n\n### 5. Run the app\n\nYou can run this app in development mode:\n\n```bash\nreflex run\n```\n\nYou should see your app running at http://localhost:3000.\n\nNow 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.\n\n### Troubleshooting\n\nIf you installed Reflex without a virtual environment and the `reflex` command is not found, you can run commands using: `python3 -m reflex init` and `python3 -m reflex run`\n\n## 🫧 Example App\n\nLet'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.\n\n\u0026nbsp;\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"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\" /\u003e\n\u003c/div\u003e\n\n\u0026nbsp;\n\nHere is the complete code to create this. This is all done in one Python file!\n\n```python\nimport reflex as rx\nimport openai\n\nopenai_client = openai.OpenAI()\n\n\nclass State(rx.State):\n    \"\"\"The app state.\"\"\"\n\n    prompt = \"\"\n    image_url = \"\"\n    processing = False\n    complete = False\n\n    def get_image(self):\n        \"\"\"Get the image from the prompt.\"\"\"\n        if self.prompt == \"\":\n            return rx.window_alert(\"Prompt Empty\")\n\n        self.processing, self.complete = True, False\n        yield\n        response = openai_client.images.generate(\n            prompt=self.prompt, n=1, size=\"1024x1024\"\n        )\n        self.image_url = response.data[0].url\n        self.processing, self.complete = False, True\n\n\ndef index():\n    return rx.center(\n        rx.vstack(\n            rx.heading(\"DALL-E\", font_size=\"1.5em\"),\n            rx.input(\n                placeholder=\"Enter a prompt..\",\n                on_blur=State.set_prompt,\n                width=\"25em\",\n            ),\n            rx.button(\n                \"Generate Image\",\n                on_click=State.get_image,\n                width=\"25em\",\n                loading=State.processing\n            ),\n            rx.cond(\n                State.complete,\n                rx.image(src=State.image_url, width=\"20em\"),\n            ),\n            align=\"center\",\n        ),\n        width=\"100%\",\n        height=\"100vh\",\n    )\n\n# Add state and page to the app.\napp = rx.App()\napp.add_page(index, title=\"Reflex:DALL-E\")\n```\n\n## Let's break this down.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"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\" /\u003e\n\u003c/div\u003e\n\n### **Reflex UI**\n\nLet's start with the UI.\n\n```python\ndef index():\n    return rx.center(\n        ...\n    )\n```\n\nThis `index` function defines the frontend of the app.\n\nWe use different components such as `center`, `vstack`, `input`, and `button` to build the frontend. Components can be nested within each other\nto create complex layouts. And you can use keyword args to style them with the full power of CSS.\n\nReflex 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/).\n\n### **State**\n\nReflex represents your UI as a function of your state.\n\n```python\nclass State(rx.State):\n    \"\"\"The app state.\"\"\"\n    prompt = \"\"\n    image_url = \"\"\n    processing = False\n    complete = False\n\n```\n\nThe state defines all the variables (called vars) in an app that can change and the functions that change them.\n\nHere 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.\n\n### **Event Handlers**\n\n```python\ndef get_image(self):\n    \"\"\"Get the image from the prompt.\"\"\"\n    if self.prompt == \"\":\n        return rx.window_alert(\"Prompt Empty\")\n\n    self.processing, self.complete = True, False\n    yield\n    response = openai_client.images.generate(\n        prompt=self.prompt, n=1, size=\"1024x1024\"\n    )\n    self.image_url = response.data[0].url\n    self.processing, self.complete = False, True\n```\n\nWithin 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.\n\nOur 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.\n\n### **Routing**\n\nFinally, we define our app.\n\n```python\napp = rx.App()\n```\n\nWe add a page from the root of the app to the index component. We also add a title that will show up in the page preview/browser tab.\n\n```python\napp.add_page(index, title=\"DALL-E\")\n```\n\nYou can create a multi-page app by adding more pages.\n\n## 📑 Resources\n\n\u003cdiv align=\"center\"\u003e\n\n📑 [Docs](https://reflex.dev/docs/getting-started/introduction) \u0026nbsp; | \u0026nbsp; 🗞️ [Blog](https://reflex.dev/blog) \u0026nbsp; | \u0026nbsp; 📱 [Component Library](https://reflex.dev/docs/library) \u0026nbsp; | \u0026nbsp; 🖼️ [Templates](https://reflex.dev/templates/) \u0026nbsp; | \u0026nbsp; 🛸 [Deployment](https://reflex.dev/docs/hosting/deploy-quick-start) \u0026nbsp;\n\n\u003c/div\u003e\n\n## ✅ Status\n\nReflex launched in December 2022 with the name Pynecone.\n\n🚀 Introducing [Reflex Build](https://build.reflex.dev/) — Our AI-Powered Builder\nReflex 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.\n\nAlongside 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.\n\nReflex has new releases and features coming every week! Make sure to :star: star and :eyes: watch this repository to stay up to date.\n\n## Contributing\n\nWe welcome contributions of any size! Below are some good ways to get started in the Reflex community.\n\n- **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.\n- **GitHub Discussions**: A great way to talk about features you want added or things that are confusing/need clarification.\n- **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.\n\nWe 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)\n\n## All Thanks To Our Contributors:\n\n\u003ca href=\"https://github.com/reflex-dev/reflex/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=reflex-dev/reflex\" /\u003e\n\u003c/a\u003e\n\n## License\n\nReflex is open-source and licensed under the [Apache License 2.0](https://raw.githubusercontent.com/reflex-dev/reflex/main/LICENSE).\n","funding_links":[],"categories":["Python","前端开发框架及项目","Web Frameworks","Front-end frameworks","语言资源库","Repos","📈 Dashboards \u0026 BI","🐍 Python Ecosystem (Python 学习与资源)","python"],"sub_categories":["其他_文本生成、文本对话","More","python","Tools","collection"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freflex-dev%2Freflex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freflex-dev%2Freflex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freflex-dev%2Freflex/lists"}