Knowledge Base updated: 2026-11-22
Reflex knowledge base
Orientation
Reflex is a Python-first web application framework that turns application, state, and component declarations into a backend service plus a generated React frontend.
Its primary implementation areas are the Python runtime under reflex/, shared primitives in packages/reflex-base/, the maintained frontend runtime in packages/reflex-frontend/, and specialized packages for releases, build-platform services, benchmarks, and durable workflows.
Critical application state is represented by state trees and reactive Vars; route and page registrations live on the application runtime, while generated frontend artifacts are derived from application and component definitions rather than maintained as the source of truth.
System map
flowchart TD
Dev[Developer application] --> App[reflex.app.App]
App --> Routes[Page and route registry]
App --> State[State and event runtime]
App --> Middleware[Uploads and middleware]
App --> Telemetry[OpenTelemetry hooks]
App --> Compiler[Frontend compiler]
Compiler --> Generated[Generated frontend project]
Generated --> Frontend[reflex-frontend package]
Frontend --> Browser[Browser React runtime]
State <--> Browser
CLI[CLI and project workflows] --> App
CLI --> Compiler
Models[Models and persistence] <--> State
Release[Release tooling and CI] --> Packages[Published packages]
Packages --> Dev
Glossary
- App β the
reflex.app.Appapplication object that owns configuration, pages, runtime services, and server setup. - Var β a typed reactive expression that can represent state-backed values and frontend-side operations.
- Hydration β synchronization that establishes browser-visible state for an application session.
- Frontend runtime β the maintained JavaScript package included by generated Reflex applications for React, routing, client state, and utilities.
- Workflow engine β the durable scheduling and execution subsystem for event-driven or cron-triggered work.
Codebase-wide invariants
- Application page registration and route handling are coordinated by the application runtime; changes to reflex/app.py must preserve that relationship.
- Reactive expressions remain typed and serializable across backend/frontend boundaries; see packages/β¦/base.py.
- Generated frontend projects consume the maintained runtime package rather than duplicating its implementation; see
packages/reflex-frontend/**. - Compiler output is derived from Python application and component declarations; changes under
reflex/compiler/**must preserve generated-project compatibility. - Release validation is automated in repository workflows, including .github/β¦/integration_tests.yml.
Routing table
- reflex/app.py -> docs/application-runtime.md
- reflex/config.py -> docs/application-lifecycle.md
reflex/state/**-> docs/state-and-events.mdreflex/compiler/**-> docs/frontend-compilation.mdpackages/reflex-frontend/**-> docs/frontend-runtime-package.md- reflex/route.py -> docs/routing-and-pages.md
packages/reflex-base/src/reflex_base/**-> docs/runtime-foundations.mdreflex/components/**-> docs/component-system.md- reflex/β¦/component.py -> docs/component-authoring.md
reflex/components/radix/**-> docs/component-packages.mdreflex/vars/**-> docs/reactive-values-and-styling.mdpackages/reflex-base/src/reflex_base/vars/**-> docs/reactive-vars.md- reflex/style.py -> docs/styling-and-theming.md
reflex/utils/**-> docs/developer-workflows.mdreflex/cli/**-> docs/cli-and-project-workflows.mdreflex/hosting/**-> docs/deployment-and-hosting.mdreflex/experimental/**-> docs/extensions-and-custom-components.md- reflex/model.py -> docs/backend-services.md
- reflex/model.py -> docs/data-models-and-persistence.md
- reflex/app.py -> docs/uploads-and-middleware.md
- reflex/β¦/telemetry.py -> docs/observability-and-telemetry.md
.github/workflows/**-> docs/release-engineering.mdpackages/reflex-release/**-> docs/release-automation.mdpackages/reflex-build-sdk/**-> docs/build-platform-integration.mdpackages/reflex-build-sdk/**/client/**-> docs/build-service-sdk.mdbenchmarks/**-> docs/performance-benchmarking.mdbenchmarks/**/harness/**-> docs/benchmark-harness.mdreflex/workflows/**-> docs/workflow-orchestration.mdreflex/workflows/engine/**-> docs/workflow-engine.md