Architecture
Layer Map
| Layer | Purpose | Current Examples |
|---|---|---|
ui/routes | Render page shells and section tabs. | reex.py, pdrs.py, rbs.py, roboticex.py, docs.py |
ui/api | Own JSON endpoints for runtime and mutations. | buyers.py, sellers.py, runtime.py |
ui/actions | Own mutation adapters against portal helpers. | buyer_mutations.py, seller_mutations.py |
ui/data | Own DB reads, portal reads, and parsing for read models. | member_accounts.py, reex_buyers.py, reex_sellers.py |
ui/domain | Own shared aggregation and business summaries. | overview.py |
ui/services | Orchestrate read flows for pages. | reex_service.py, roboticex_service.py |
ui/viewmodels | Shape stable template contracts. | sellers.py, buyers.py |
ui/templates | Presentation only. | shared components and section templates |
Request Flow
- Browser hits a page route such as
/ctx/reex?tab=sellerTable. - The route chooses the content template and asks a service for read data.
- The service pulls normalized rows from
ui/dataand summaries fromui/domain. - The route passes those rows through
ui/viewmodelswhen a stable page contract is needed. - The template renders shared components from
ui/templates/components.
Mutation Flow
- UI forms post to
/ctx/api/sellers/...or/ctx/api/buyers/.... - The API layer validates payloads and enforces runtime gating where required.
- The API delegates to handler registries in
ui/actions. - The action layer calls exchange-specific portal helpers and returns a normalized result.
- The frontend redirects back to the current page with a success or error banner.
Design Rules
- Do not put SQL or HTML parsing in
ui/routesorui/templates. - Do not add new page-bound mutation routes under section files.
- New read integrations should land in
ui/datafirst. - New mutations should land in
ui/actionsfirst. - Shared presentation should prefer
ui/viewmodelsplus component templates over exchange-specific branching in Jinja.
Current Gaps
- Read-side buyer enrichment for
RBSandRoboticexstill lives in service modules and can move intoui/datalater. Roboticexoverview uses a buyer-specific shape and is not yet normalized into the shared overview component family.- There is no dedicated architecture navigation index yet beyond this page.