Hypermedia-driven
Amelinium is made with hypermedia in mind. Therefore, it supports RESTful and document-oriented architecture of web applications. A dynamic HTML content is generated by the HTTP server and rendered by the browser.
Thanks to HTMX JavaScript library user interaction can effect in changes of relevant portions of a page, without reloading the whole document or issuing redirects.
HTMX integration is not enforced. It is possible to use multi-page approach based on redirects and regular links. Amelinium dynamically detects if it can make use of HTMX. It can also be instructed in route configuration to use or not to use HTMX and skip the dynamic detection.
Model, layout, view, controller
Client-server architecture and resources organization is similar to JSP model 2 architecture.
-
Requests from the browser are passed via a middleware chain to the controller, a function assigned to a certain HTTP route in server’s configuration.
-
The controller performs any logic necessary to obtain the correct content for display.
-
To get current state of application for a user (including session-related information), controller may call functions from models to access required data sources.
-
Results of controller’s work are stored in a map as associations. Entries may contain regular values or lazily evaluated
Delay
objects. On a basis of route configuration and/or controller’s logic names of layout and view are set. -
Common controller takes over the control and it tries to find layout and view for the language detected by middleware and/or controller.
-
Using layout and view HTML document is rendered in a context of all values set in a map from point 4.
-
The result of rendering the HTML document is returned to the browser to be displayed.