Architecture overview
The GeoNetwork UI project is a monorepo managed using Nx and is composed of:
- libraries containing components and services in the
libs
folder - applications relying on libraries in the
apps
folder - web components relying on libraries in the
apps/webcomponents
folder
Other directories include:
assets-common
: shared assets across all appsconf
: configuration-related filesdocs
: this websitepackage
: contains the necessary toolkit for generating the NPM packagesupport-services
: docker composition used to set up the development environmenttools
: various tools & utils for docker, internationalization etc.translations
: contains the translations of all keys used in the project
Libraries
Overview
This is a general diagram of how libraries are organized:
Details
The libraries are organized as follows:
Presentation libraries are in the
ui
folder and are categorized by their forms:ui-inputs
for reusable components made to collect input from the user (e.g.: form fields, buttons...)ui-elements
for components focused on rendering specific types of information in an elaborate way, which may or may not be related to business usages; examples include download links, facet or selection tree, etc.ui-layout
for components which occupy a large part of the screen and might contain variable content or other componentsui-map
for map-specific components (map container, controls, etc.)ui-widgets
for reusable, small, self-contained components which show information in a visual way, similar to icons but more elaborate (e.g.: icon with tooltip, status indicator, progress bar...)
Note: presentation components contain mainly HTML and CSS code, and should contain very little logic
Libraries providing business or data logic and state management are in the
feature
folder and are categorized by their intended use:feature-auth
for logic and components related to authenticationfeature-catalog
for logic and components related to general catalog topics (title, logo, etc.)feature-dataviz
for logic and components related to data visualizationfeature-record
for logic and components related to displaying a catalog record's information (metadata, data preview, exports, APIs...)feature-editor
for logic and components related to editing metadatafeature-map
for logic and components related to interactive mapsfeature-search
for logic and components related to searching through the catalogfeature-notifications
for notifications systems
Note: these libraries provide "smart components" which are communicating with each other using a NgRx store.
They rely on presentation components and as such hold very little HTML or CSS code.Libraries used for interacting with backend services are in the
data-access
folder:data-access-gn4
contains an auto-generated API client for the GeoNetwork 4 backenddata-access-datafeeder
contains an auto-generated API client for the Datafeeder backend
Libraries providing various utilities in the
util
folder:util-data-fetcher
for fetching and querying datasetsutil-app-config
for parsing and validating application configurationsutil-shared
for shared models and types, test fixtures, app-wide settings etc.util-i18n
for translation and internationalization
Libraries providing common services or shared models are in the
util
folder:common-domain
contains many definitions used across the whole projectcommon-fixtures
contains test fixtures
Libraries providing low-level functionalities that can be used both in front and backend are in the
api
folder:api-repository
for providing the Records Repository abstraction as well as all models related to it (metadata records, etc.)api-metadata-converter
for converting metadata from and to interoperable formats
Dependency constraints
To ensure that the project structure stays healthy and avoid circular dependencies, several constraints dictating which kinds of libraries can depend on which were set up. These constraints are enforced by ESLint and configured in the ESLint configuration file.
The constraints are:
- No library should depend on
util/app-config
This is because only applications should decide whether an app config file should be loaded (see this page for more information). - Libraries of type
common
,data-access
andutil
should only depend on libraries of the same type - Libraries of type
ui
andapi
should only depend on shared libraries or libraries of the same type
Shared libraries have thescope:shared
tag; this is for instance the case forutil-i18n
andutil-shared
- Libraries of type
feature
can depend on any other kind of library expectutil/app-config