Front‐End Architecture - CodeHavenX/MonoRepo GitHub Wiki

This page explains the general architecture used within our project. The goal of this architecture is to provide an scalable solution to the front end application by leveraging a well-defined pattern. We favor convention and simplicity over fine-control and configurability.

Router

Routes

Destination


Event

Screen

UIState

ViewModel

Preview

classDiagram
    %% Defining the classes
    namespace Routing {
        class Router {
            +String route
        }
        class Destination {
            +String path
            +String argument1
            +Float argument2
            + ...
            +[static]pack(String, Float, ...)Destination
            +[static]unpack(path)Destination
        }
        class Route{
            <<enumeration>>
            Route1,
            Route2, 
            ...
        }
    }
    namespace Feature {
        class Event {
            <<Sealed Interface>>
        }

        class Screen {
            <<Composable Function>>
            +invoke(Destination?)
        }

        class UIState {

        }

        class ViewModel {
            <<Abstract>>
            +UIState uiState
            +Event events
        }
    }
    namespace FeatureJVM {
        class Preview {
            <<Composable Function>>
        }
    }

    %% Defining the relationships with cardinalities
    Preview "1" --> "1" Screen : invokes
    Screen "1" --> "1" ViewModel : retrieves
    ViewModel "1" --> "1" UIState : emits
    ViewModel "1" --> "1" Event : emits
    Screen "1" --> "1" UIState : observes
    Screen "1" --> "1" Event : observes
    Router "1" --> "1" Route : iterates over
    Router "1" --> "*" Screen : invokes
    ViewModel "1" --> "*" Destination: packs
    Router "1" --> "*" Destination: unpacks


    %% Adding a note to explain the diagram
    note for Preview "This function is located in the <br> JVM target and only used for testing"
    note for Router "The Router maps a Route to a Screen.<br>It unpacks a Destination and passes<br>it to the Screen as argument"
Loading

⚠️ **GitHub.com Fallback** ⚠️