ReflexProcess
Object representing a running Reflex app process. This process runs the front and back of a Reflex app. In dev mode: runs 'reflex run'. In prod mode: builds frontend (served by nginx) and runs backend-only.
There is 1 ReflexProcess per app. If the same reflex app is runned multiple times, it will use the different processes. In prod the front build folder is stored in resource path.
back_port: intfront_port: intInitialize the app process.
Note: The app is not generated here. Generation happens on first start.
intintAppInstanceCall the health check of the app to check if it is still running
boolintGet the full URL for the app with authentication tokens.
This method handles user authentication and generates access tokens.
AppInstanceUrlstrFrontThemeGet the custom-subdomain-based host name, or None when no custom subdomain applies.
Returns None in dev mode (the custom subdomain is ignored) or when the app has no custom subdomain set. Uses the same local/prod formatting as get_host_name, only the middle segment differs (custom subdomain instead of resource model id).
str - ''str | NoneGet the full custom-subdomain URL (scheme + host + port), or None when not set.
str - ''str | NoneGet the list of host names the front nginx block should answer to.
Always contains the canonical id-based host, plus the custom-subdomain host as an alias when one is set. nginx routes by server_name, so listing both names on a single server block makes the custom host resolve to the same backend as the id host.
str - ''listGet the canonical host name for the app process based on the suffix. This is used to generate the host URL for the app.
We use the resource_model_id as host name to have a stable URL for the app. The stable URL is required for reflex as the backend url is stored in the front build and should not change at each deployment. In dev mode the DEV_MODE_APP_ID is used.
An app can optionally define a custom subdomain (see get_custom_host_name). The custom host is registered as an alias on the front nginx block — it never replaces this canonical host, so URLs and baked backend addresses stay stable.
str - ''strstr - ''strstrReturn all local ports this process will bind to.
listintGet the current status of the app process
AppProcessStatusAppProcessStatusDTOGet the current status text of the app process
strGet the token of the app process. This is used to secure the app and allow access to it.
strGet the user id from the user access token. If the user does not exist, return None.
strstr | NoneGet the working directory for this app process.
The directory is created when the app is first started. Raises an exception if called before the app is generated.
strCheck if the app process is running
boolCheck if the app process is starting
boolCheck if the app process is stopped
boolSet the status and status text of the app process
AppProcessStatusstr - ''Update the stop policy on the underlying app instance.
AppStopPolicyStart the process for the app.
The app will be generated on first start if not already done.
Method to start the check running loop to check if the app is still used
Kill the process and the app
boolUpdate the custom subdomain on a (possibly running) app process.
Updates the in-memory app instance and, if the process is running, re-registers its front nginx service(s) so the custom host alias is added/removed live (with an nginx reload). The canonical id-based host is untouched, so the running app keeps serving without interruption. When the process is not running, nothing else is needed: the host is rebuilt from the persisted value on the next start.
str | NoneReturn the user id from the user access token if the user has access to the app.
strstr | NoneCheck if the process uses the given port
intboolWait for the process to start
AppProcessStatus