Overview of the OpenContracts Routing System
mainThe OpenContracts routing system is a centralized architecture designed to synchronize the browser URL with application state. It is built around a single source of truth: the CentralRouteManager.
Key Principles
- Centralized Management:
CentralRouteManagerhandles all URL $\leftrightarrow$ State synchronization, entity fetching, and canonical redirects. - Explicit Route Patterns: Uses
/c/and/d/prefixes to eliminate ambiguity between different entity types. - Slug-First URLs: Provides SEO-friendly URLs with automatic redirection from IDs to slugs.
- Dumb Consumers: Route components are simplified; they only read reactive variables using
useReactiveVar()and render the UI. - Complete Viewer State: The URL encodes the full document viewer state, including both selections and visualization settings, enabling robust deep linking.