Introducing a new way to review your PRs.

Read the announcement

reflex-dev / reflex

🕸️ Web apps in pure Python 🐍

View on GitHub

30 documents · Updated Nov 23, 2026

docs / backend-services

Backend services and persistence

Backend services provide the server-side work that supports a Reflex application after a page is rendered. They receive client events and files, run state changes, keep session state available, expose durable data access, and return state updates or files to the client.

Backend service boundary

Application server

The application server is the ASGI service that joins page output with server-side work. It exposes health routes, the event transport, optional upload routes, mounted application APIs, and the frontend when the deployment mode requires it. The App is the main boundary for these services. reflex/app.py reflex/app.py

The server keeps state processing separate from page rendering. A page can describe the user interface, while the backend event path can load session state, call application code, persist changes, and send only the resulting update back to the client. The app compiles the current application before it returns this ASGI service. The final service can also apply CORS rules, mount or wrap extra API services, and add observability around the completed service before it starts accepting requests. reflex/app.py

References: reflex/app.py• L383-420 reflex/app.py• L548-585 reflex/app.py• L920-1011

Service composition

The backend is composed from services with different lifetimes and stores. The event service uses the state manager, the database service owns application records, and the upload service owns files. Middleware and lifespan tasks connect these services to each request and to the life of the server.

ServiceMain responsibilityDownstream result
Event serviceReceive client events and route them to state handlersState deltas or client events
State managerKeep session state for each client tokenCurrent state for the next event
Database serviceProvide durable application data through models and migrationsRecords shared across sessions
Upload serviceReceive files and serve stored filesUpload events, file paths, or downloads
MiddlewareInspect or change event handling before and after a handlerAccepted, replaced, or changed state updates
Lifespan serviceStart and stop long-running backend resourcesClean startup and shutdown

The event transport also applies a request boundary to oversized polling bodies. It drains a rejected body before it closes the session, so a client does not remain blocked on a request that the transport has already refused. reflex/app.py reflex/app.py

References: reflex/app.py• L412-460 reflex/app.py• L592-695 reflex/app.py• L773-817 reflex/app.py• L817-884 reflex/…/middleware.py• L23-85 reflex/…/lifespan.py• L92-148

Backend execution lifecycle

Backend process modes

The backend runs in development or production mode. Development mode watches application files and restarts the backend when code changes. Its supervisor keeps the listening socket available while a replacement worker starts, then releases the socket when no worker can serve requests and creates it again for the next worker. Production mode serves the compiled app through a worker server and can serve the compiled frontend from the same service. Both modes load the configured app factory and expose the same application server boundary. reflex/…/exec.py reflex/…/exec.py reflex/…/exec.py

The process mode affects how the service starts and reloads. It does not change the event, state, database, upload, or middleware contracts described below. For the wider startup and runtime flow, see Application runtime.

References: reflex/…/exec.py• L497-540 reflex/…/exec.py• L646-862 reflex/…/exec.py• L865-983

Compile trigger

Each backend compile receives a trigger label. A normal startup and the first reload-capable development worker use backend_startup; later development workers use hot_reload. The label lets compile instrumentation distinguish a fresh service start from a rebuild after a file change. reflex/…/exec.py reflex/app.py

The trigger remains a best-effort signal. If the development marker cannot be created, the backend uses the startup label instead of stopping the service. reflex/…/exec.py

References: reflex/…/exec.py• L37-76 reflex/app.py• L920-944

Event service

Client event transport

The event transport connects a browser session to the backend with a client token. At connect time, the backend links the token to the socket, accepts an optional boot event, and checks the frontend state schema against the backend schema. A mismatch is reported before hydration so the client can reload instead of applying updates from a different state tree. reflex/app.py

A connected client sends an event through the event namespace. The backend adds session, request, and route data to that event, then places it in the event processor queue. Connection-stable data such as headers and client address is built once and copied into each event, so a handler can change its own event data without changing later events on the same socket. reflex/app.py reflex/app.py

The same path supports updates in the other direction. The backend resolves changed state into a StateUpdate, then sends the update to the socket associated with the token. A token that belongs to another server instance is passed to the distributed token service instead of being sent to the wrong local socket. reflex/app.py

When a socket disconnects, the local processor cancels hydration and unfinished page-load chains for that token before the token link is cleaned up. The guard checks that the socket record still belongs to the disconnecting server and socket, so a stale disconnect cannot cancel work for a replacement connection. reflex/app.py packages/…/base_state_processor.py

References: reflex/app.py• L2359-2434 reflex/app.py• L2436-2472 reflex/app.py• L2474-2511 reflex/app.py• L2513-2543 reflex/app.py• L2545-2624 packages/…/base_state_processor.py• L520-530

Event processing flow

The event processor makes state changes serial and scoped to a client token. It obtains the state, runs middleware, invokes the handler, routes chained events, resolves changed values, and emits the result. Non-background handlers run while the state lock is held. Background handlers run after the lock is released and use a state proxy for later changes. packages/…/base_state_processor.py packages/…/base_state_processor.py

At startup, the app creates a fresh worker identity for token routing and passes the configured event-loop blocking threshold to the event processor. This keeps cross-worker delivery scoped to the current worker and enables runtime detection of work that holds the event loop too long without changing the event or state contract. reflex/app.py

This diagram shows how a client event becomes a state update or a follow-up event.

flowchart LR
    Client[Client event] --> Transport[Event transport]
    Transport --> Queue[Event queue]
    Queue --> State[Load session state]
    State --> Before[Preprocess middleware]
    Before --> Handler[Run state handler]
    Handler --> After[Resolve changes and postprocess]
    After --> Update[State update]
    Update --> Client
    Handler --> FollowUp[Chained backend or client event]
    FollowUp --> Queue

References: packages/…/base_state_processor.py• L173-229 packages/…/event_processor.py• L374-415 reflex/app.py• L878-899 reflex/app.py• L2545-2624

Server-side event results

Handlers can return or yield events as part of one event chain. Backend events go back to the queue. Events intended for the client are emitted through the event transport. State changes are sent before those follow-up client events so the client sees the newest state first. packages/…/base_state_processor.py

The backend also supports streamed state updates for upload handlers. In that case the upload request receives newline-delimited updates while the event runs instead of waiting for the usual socket update path. packages/…/event_processor.py reflex/state.py

References: packages/…/base_state_processor.py• L196-229 packages/…/event_processor.py• L429-489 reflex/state.py• L2593-2637

Session state service

State manager role

The state manager keeps server state for each state token between events. A state token identifies an owner and a state class. The manager provides reads, writes, and an exclusive modification scope, while the app selects one manager for the configured storage mode and gives it to the event processor. reflex/…/__init__.py reflex/…/token.py reflex/app.py

The state tree is separate from database records. State holds session values that drive the page and event flow. A handler can use the database service for durable records without treating those records as part of the session state tree.

References: reflex/…/__init__.py• L34-95 reflex/…/token.py• L17-67 reflex/app.py• L592-610

State update and persistence boundary

After a handler changes state, the backend resolves only the changed values into a delta for the client. It then cleans the change markers and persists the state that the selected manager owns. Computed values can appear in the client delta, while backend-only values stay on the server. reflex/state.py reflex/state.py

Server-side work outside the normal event handler can use the app to modify a token's state. The app takes exclusive access, keeps the event context tied to the target token, resolves the changed values, and emits a delta to the matching client when a change exists. This lets an API route or background task update the rendered page without pretending that the work came from a browser event. reflex/app.py

State persistence uses a token to identify the state owner and class. A BaseStateToken represents one root state tree for a session, while its class identifies a state within that tree. The token supplies the common scope used for caching, locking, expiry, storage keys, and cross-instance updates. reflex/…/token.py reflex/…/token.py

The disk and Redis managers serialize state for storage. When a value cannot be serialized, the state cannot cross that storage boundary. The state package also provides a diagnostic helper that can locate the failing value inside a nested state object. reflex/…/token.py reflex/…/__init__.py

References: reflex/app.py• L1991-2075 reflex/state.py• L1880-1905 reflex/state.py• L1947-2024 reflex/…/token.py• L17-67 reflex/…/token.py• L122-183 reflex/…/__init__.py• L7-67

Background state access

Background handlers do not keep the session lock while they wait. They receive a StateProxy, which blocks writes until the handler enters an asynchronous context that refreshes the state and holds its token lock. On exit, changed renderable values are persisted and sent as a state delta. reflex/…/proxy.py reflex/…/proxy.py

The same boundary protects mutable values inside state fields. A mutable proxy marks its owning state as changed, while a background proxy rejects changes made outside the lock context. This prevents a stale background task from silently overwriting a newer event result. reflex/…/proxy.py reflex/…/proxy.py reflex/…/proxy.py

References: reflex/…/proxy.py• L153-177 reflex/…/proxy.py• L228-309 reflex/…/proxy.py• L611-640 reflex/…/proxy.py• L700-758 reflex/…/proxy.py• L1154-1180

State storage modes

The state service supports three storage modes. The choice changes where session state can survive and whether several backend instances can share it. All modes keep the same high-level read, modify, and write contract.

ModeState locationMain use
MemoryCurrent backend processLocal development or a single short-lived process
DiskBackend state directoryLocal persistence across process restarts
RedisShared Redis serviceMultiple backend instances and shared session state

The memory manager expires inactive sessions in the process. The disk manager loads state from files and flushes pending writes during shutdown. The Redis manager reads and writes shared state with per-token locks and expiry, and rejects a write when its lock has expired. reflex/…/memory.py reflex/…/disk.py reflex/…/redis.py reflex/…/redis.py

For the full data model, database setup, and migration flow, see Data models and persistence.

References: reflex/…/__init__.py• L58-95 reflex/…/memory.py• L145-208 reflex/…/disk.py• L326-380 reflex/…/redis.py• L378-493

Shared state

Shared state lets several client sessions use one state owner. A client can link a shared state to another token, and a change to that owner can notify the other connected clients so their local trees receive the same update. reflex/…/shared.py reflex/…/shared.py reflex/…/shared.py

The manager holds the linked state locks during one modification scope. After the scope ends, the shared-state service finds affected client tokens and schedules updates through the app. This keeps shared changes serialized while avoiding a lock cycle between clients. reflex/…/shared.py reflex/…/shared.py

References: reflex/…/shared.py• L40-81 reflex/…/shared.py• L194-224 reflex/…/shared.py• L226-263 reflex/…/shared.py• L397-492

Database service

Application records

The database service supports durable records that are shared across client sessions and backend processes. It builds cached synchronous and asynchronous database engines from app configuration, provides database sessions, and gathers registered model metadata for schema work. reflex/model.py reflex/model.py

Database support is optional. If the database dependencies are not installed, database entry points fail with a clear installation error rather than silently using session state as a replacement. The built-in Model base remains available as a compatibility layer, but it warns that new code should use the database ORM layer directly. reflex/model.py reflex/model.py reflex/model.py

For the data model and persistence contract, see Data models and persistence.

References: reflex/model.py• L44-68 reflex/model.py• L68-274 reflex/model.py• L447-627 reflex/model.py• L477-588 reflex/model.py• L629-633

Schema change flow

The model registry gives migration tools one view of the app's registered tables. Database setup creates the migration environment, migration checks compare model metadata with the database, and migration commands can generate or apply Alembic revisions. This keeps changes to durable application data distinct from changes to the in-memory or Redis-backed session state. reflex/model.py reflex/model.py

Before a revision is written, the migration path checks whether the models and database differ. It does not write an empty revision when they match. Applying migrations upgrades pending revisions first, then optionally creates and applies a new revision. reflex/model.py reflex/…/migrations.py

The migration path classifies the Alembic environment as the Reflex template, a legacy environment, or a custom environment. A failure in a custom environment is reported and can return control to app startup, while command errors still surface to the caller. This keeps a hand-edited environment from hiding the cause of a schema failure. reflex/model.py reflex/…/migrations.py reflex/…/migrations.py

For the full data model, database setup, and migration flow, see Data models and persistence.

References: reflex/model.py• L197-274 reflex/model.py• L283-438 reflex/model.py• L416-487 reflex/…/migrations.py• L126-151 reflex/…/migrations.py• L238-275 reflex/…/migrations.py• L345-363

Service health

The health endpoint reports the status of services that the app uses. It checks the database and Redis only when the app has marked them as in use. The database check opens a connection and runs a simple query. The endpoint returns an unavailable response when a required check fails. reflex/app.py reflex/app.py reflex/model.py

References: reflex/app.py• L1013-1029 reflex/app.py• L2183-2219 reflex/model.py• L455-475

File transfer service

Upload and download flow

The upload service receives files over an HTTP endpoint because file data does not travel through the normal event socket. It identifies the client token and handler, then chooses buffered handling for regular upload handlers or streaming handling for background handlers that consume an upload chunk iterator. packages/…/_upload.py packages/…/_upload.py

Uploaded files are stored in the configured upload directory. The app serves that directory under the upload route, so the frontend can request a file URL after a handler writes the file. The service also limits path input to a safe relative path and adds response headers that prevent unknown file types from being treated as inline content. packages/…/_upload.py packages/…/_upload.py reflex/app.py

For upload component behavior and upload-specific middleware, see Uploads and middleware.

References: packages/…/_upload.py• L582-750 packages/…/_upload.py• L758-806 packages/…/upload.py• L152-187 reflex/app.py• L1031-1052

Upload update flow

Buffered uploads keep the parsed files available while the handler runs and stream state deltas in the HTTP response. Streaming uploads apply back pressure through a bounded chunk iterator, so the request producer cannot grow memory without limit while a background handler writes the data. packages/…/_upload.py packages/…/_upload.py

References: packages/…/_upload.py• L126-251 packages/…/_upload.py• L688-750

Middleware and application lifetime

Event middleware

Middleware is a hook around backend event handling. Preprocess hooks run in registration order and can return an update that stops the handler. Postprocess hooks then receive the current update and can change it before it reaches the client. reflex/…/middleware.py reflex/…/middleware.py

The built-in hydration middleware handles the first state load as a special event. It resets browser-backed storage values, marks the state as not yet hydrated, and returns the initial state update. This lets browser storage and server state meet at the start of a session. reflex/…/hydrate_middleware.py

The app can also provide a hydration fallback component. An explicit app value takes precedence over deployment configuration. A configured import that cannot load is logged and omitted, while an explicit callable failure is allowed to stop setup. reflex/app.py

For the complete middleware and upload response behavior, see Uploads and middleware.

References: reflex/…/middleware.py• L16-49 reflex/…/middleware.py• L23-85 reflex/…/hydrate_middleware.py• L19-52 reflex/app.py• L1598-1622

Application lifetime

Lifespan tasks run for as long as the ASGI app runs. They can be registered before startup as a function, coroutine, or async context manager. The app uses this boundary to configure the event processor at startup and to close token and state services at shutdown. reflex/…/lifespan.py reflex/…/lifespan.py reflex/app.py

The ASGI lifespan reports startup and shutdown failure to the server before it re-raises the error. Shutdown matters because state managers can have pending work. The disk manager flushes queued writes, the token manager disconnects active token mappings, and the app then closes the related resources. reflex/app.py reflex/…/lifespan.py

For how startup and shutdown fit into the wider app flow, see Application runtime.

References: reflex/app.py• L383-409 reflex/…/lifespan.py• L92-148 reflex/…/lifespan.py• L160-207 reflex/app.py• L694-769

Observability instrumentation

Backend instrumentation boundary

Observability instrumentation measures the backend boundary without changing the event or state contract. When instrumentation is enabled, the app wraps the completed ASGI service and records compile activity, connection counts, and event message sizes for the systems that collect those signals. reflex/app.py reflex/app.py reflex/app.py reflex/app.py

The event namespace also routes frontend error reports through the app's frontend exception handler. It accepts reports only from linked sessions and limits both per-session and process-wide report volume, so client errors can reach logs or custom handlers without allowing one client to flood them. reflex/app.py

Anonymous telemetry is an optional diagnostic channel for backend and tool activity. It gathers limited runtime context and event data, then sends it outside the request path on a best-effort basis. The channel uses a stable encoded installation identity so events from one installation remain related without blocking the app when collection or delivery fails. reflex/…/telemetry.py reflex/…/telemetry.py

The instrumentation belongs around the composed service. This lets it observe requests after API mounting, CORS, and middleware composition while keeping application handlers focused on state and data work. For the wider metrics, traces, and logs model, see Observability and telemetry.

References: reflex/app.py• L920-944 reflex/app.py• L997-1011 reflex/app.py• L2417-2418 reflex/app.py• L2620-2624 reflex/app.py• L2635-2713 reflex/…/telemetry.py• L330-365 reflex/…/telemetry.py• L648-753

State and rendering relationship

Client and server state

The client receives renderable state deltas, while backend-only state remains available to server handlers. Browser cookies, local storage, and session storage are client-side values represented in the state model; hydration resets their server copy so a browser-side clear is reflected on the next session load. reflex/…/storage.py reflex/state.py

The event service is the bridge between these two sides. A client action enters as an event, the backend reads or changes session state, and the resulting delta drives the next render. See State and events for the state and event contract.

References: reflex/…/storage.py• L10-25 reflex/…/storage.py• L79-144 reflex/state.py• L1609-1621 reflex/state.py• L2593-2637

Change checklist

When these files or sections are changed, remember to consider these:

  • Changing the event transport or token mapping requires checking local delivery, cross-instance delivery, reconnect behavior, connection bootstrap, and state updates sent to the matching client.
  • Changing frontend schema checks or event deserialization requires checking the reload signal, boot event ordering, malformed payload handling, and the client state contract.
  • Changing connection-scoped router data requires checking trusted proxy handling, per-event copies, route lookup, and the values exposed through state.router_data.
  • Changing oversized polling request handling requires checking body draining, the 400 response, session closure, and the configured transport buffer limit.
  • Changing CORS or API composition requires checking same-origin behavior, deployed frontend origins, mounted API routes, websocket headers, and the outer instrumentation wrapper.
  • Changing disconnect cleanup requires checking that only the matching local socket cancels hydration and unfinished page-load chains, while token cleanup still completes for the disconnected client.
  • Changing state fields or their serializable shape requires checking state-manager reloads, nested serialization diagnostics, and schema mismatch behavior for disk and Redis state.
  • Changing state token identity or class mapping requires checking cache keys, storage keys, lock scope, legacy string conversion, and linked-state access.
  • Changing the state manager selection requires checking expiry, locking, and shutdown behavior for the selected deployment mode.
  • Changing background state access or mutable-field tracking requires checking refresh behavior, lock ownership, delta emission, and stale-write protection.
  • Changing shared-state linking requires checking linked-token locks, affected-client fan-out, and rehydration after unlinking.
  • Changing database models requires checking model registration and the migration metadata used to create or apply schema revisions.
  • Changing migration setup, revision generation, or migration error handling requires checking the configured database URL, registered model metadata, current Alembic revision, upgrade order, change detection, and custom env.py behavior.
  • Changing the legacy Model wrapper requires checking callers that still depend on its compatibility methods and the direct ORM path recommended for new callers.
  • Changing upload handler argument rules requires checking both the HTTP multipart fields and the event handler parameter resolution.
  • Changing upload paths or served file headers requires checking path safety and whether browsers download or display the response.
  • Adding middleware that can return an update requires checking that later handlers and middleware do not run when the early update is intentional.
  • Changing hydration behavior or the fallback component requires checking the initial state update, browser storage reset, and the point at which is_hydrated becomes true.
  • Adding lifespan resources requires checking that registration happens before startup and that cleanup completes before the state and token services close.
  • Changing frontend error reporting requires checking linked-session validation, sanitization, per-session limits, process-wide limits, and the frontend exception-handler contract.
  • Changing anonymous telemetry collection or delivery requires checking the opt-in setting, stable identity continuity, background delivery, and the rule that telemetry failures do not affect app requests.
  • Changing backend startup, reload signaling, or development worker supervision requires checking compile trigger labels, request behavior during worker replacement, and prompt refusal when no worker can serve.
  • Changing event processor startup or the event-loop blocking threshold requires checking that the configured diagnostic reaches each worker and that event handling remains unchanged when the diagnostic is disabled.
  • Changing out-of-band state updates requires checking typed token selection, event-context rebinding, exclusive state access, delta emission, and callers outside the event socket.

Important failure modes

TriggerConsequenceGuard
A client connects without a usable tokenEvents have no session target and are ignored or cannot update stateCheck token creation, connection query data, boot event ordering, and reconnect handling
Frontend and backend state schemas differThe client cannot dispatch a received state deltaCompare the schema during connect and rebuild the frontend against the matching backend
A client sends an oversized polling POSTThe request is rejected and the client can remain blocked if its body is not drainedDrain the body, return 400, and close the matching socket session
A client disconnects during hydration or page loadWork tied to the closed page can continue and produce stale work or updatesLet the matching local socket invoke processor disconnect cleanup before token removal
A state field cannot be serializedThe state is not persisted to disk or RedisKeep persisted state values serializable and use the nested serialization diagnostic when needed
A Redis lock expires during a long eventThe state write fails instead of overwriting another worker's stateUse a background event for long work or set a suitable lock lifetime
A disk or Redis state schema no longer matchesThe stored session is discarded or rebuilt from defaultsTreat state schema changes as a session compatibility change
An out-of-band update uses an invalid or stale tokenThe intended client receives no update or the state lookup failsUse a typed token associated with the target session and keep the app initialized
A background task changes state outside its proxy contextThe change is rejected instead of modifying stale stateRefresh and change state only inside async with self
A shared state link points to an invalid token or state typeLinking fails or linked clients do not receive a valid state treeUse valid shared tokens and link only SharedState types
An upload handler stops before consuming all chunksThe upload producer fails and the request returns an errorConsume the chunk iterator until completion or handle cancellation
Upload event arguments are malformed or too largeThe upload request is rejected before the handler runsSend a JSON object within the upload argument limit
A lifespan task is registered after startupThe service cannot add the task to the running appRegister all long-lived resources before the ASGI lifespan begins
A configured hydration fallback cannot be importedThe app shows no configured fallback during hydrationKeep the configured path valid and inspect the logged load error
A development reload marker cannot be createdThe compile is labeled as a startup instead of a hot reloadKeep the web directory writable when compile telemetry needs reload labels
Event-loop blocking detection is not configured for the event processorSlow backend tasks produce no blocking diagnosticPass the configured threshold during processor startup and verify the intended worker mode
A telemetry event is sent while telemetry is disabledNo diagnostic event is collectedEnable telemetry through the app configuration before relying on the signal
Telemetry collection or delivery failsThe related diagnostic signal is missing, but the app request continuesTreat telemetry as best effort and use backend instrumentation or logs for required operational signals
Telemetry remains active when a process is about to forkThe worker may inherit unsafe telemetry state or queued events may be lostDrain and stop telemetry work before forking, then create worker-local telemetry state
A development worker dies while no replacement worker is servingRequests remain queued or the port stays open without a service to answer themRelease the supervisor socket when no worker is alive and recreate it before the next worker starts
An API transformer or telemetry wrapper replaces the wrong app layerMounted routes, CORS behavior, or backend signals are missingCompose wrappers around the completed backend and verify the health and event routes
A frontend error report comes from an unknown or flooding sessionBackend logs or error handlers receive no report, or valid reports are suppressed for the windowRequire a linked token and enforce per-session and process-wide limits
Database dependencies are missing or no database URL is configuredModel, session, or engine access fails instead of falling back to session stateInstall the database extra and configure the database URL before using durable records
A durable model change is not represented by a migrationThe database schema stays out of sync with the application modelCompare registered metadata and apply the current migration revision
Model and database metadata do not differA migration command produces no revisionRun the migration change check before writing a revision
A custom migration environment fails during an app-triggered migrationStartup can continue with a logged failure, while a command reports the migration errorUse the current Reflex env.py template or inspect the custom environment failure before relying on migration results
Migration metadata is incomplete or revisions are applied out of orderSchema generation or upgrade cannot safely reach the current database stateRegister all table models and bring pending revisions to head before generating new changes

Key files

FileWhy to read it
reflex/app.pyMain backend boundary. It creates the API, event namespace, state manager, optional upload routes, health checks, hydration fallback, out-of-band state updates, connection bootstrap, schema checks, disconnect cleanup, compile trigger, event-loop blocking setup, app composition, CORS, and lifespan.
reflex/…/exec.pyBackend process lifecycle. It selects development or production serving, manages reload state and the development listening socket, and starts the backend worker server.
packages/…/base_state_processor.pyCore event-to-state flow, including middleware, handler execution, chained events, background work, and cancellation of hydration or page-load work after disconnect.
packages/…/event_processor.pyEvent queue contract and streamed delta behavior.
reflex/…/__init__.pyCommon state-manager contract and storage-mode selection.
reflex/…/token.pyState identity, storage keys, serialization boundary, and legacy token conversion.
reflex/…/memory.pySmallest example of per-session state, locking, and expiry.
reflex/…/disk.pyLocal durable state and shutdown write flushing.
reflex/…/redis.pyShared state, distributed locks, expiry, and multi-instance delivery support.
reflex/…/proxy.pySafe background state access and change tracking for mutable values.
reflex/…/shared.pyShared-state linking, lock scope, and updates to other client sessions.
reflex/…/__init__.pyDiagnostic support for finding values that cannot cross the state serialization boundary.
reflex/model.pyDatabase engines and sessions, model registry, optional ORM compatibility layer, health check, and migration support.
reflex/…/migrations.pyMigration command flow, change detection, migration-environment classification, and failure reporting.
packages/…/_upload.pyServer upload handling, streaming, file serving headers, and upload route behavior.
reflex/…/middleware.pyMiddleware contract around event processing.
reflex/…/hydrate_middleware.pyInitial state handoff between browser storage and server state.
reflex/…/lifespan.pyStartup registration and shutdown cleanup for long-lived services.
reflex/…/telemetry.pyOptional anonymous telemetry collection, identity continuity, and non-blocking best-effort delivery.
reflex/state.pyState deltas, serialization boundary, and client-storage reset behavior.
docs/application-runtime.mdWider development and production runtime model.
docs/data-models-and-persistence.mdDetailed durable data model, database setup, and migration flow.
docs/uploads-and-middleware.mdDetailed upload behavior and event middleware flow.
docs/observability-and-telemetry.mdBroader observability model and the signals collected around backend work.
docs/state-and-events.mdState and event contract used by the client and backend.