Architecture overview
The GeoNetwork UI project is a monorepo managed using Nx and is composed of:
- libraries containing components and services in the
libsfolder - applications relying on libraries in the
appsfolder - web components relying on libraries in the
apps/webcomponentsfolder
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
uifolder and are categorized by their forms:ui-inputsfor reusable components made to collect input from the user (e.g.: form fields, buttons...)ui-elementsfor 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-layoutfor components which occupy a large part of the screen and might contain variable content or other componentsui-mapfor map-specific components (map container, controls, etc.)ui-widgetsfor 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
featurefolder and are categorized by their intended use:feature-catalogfor logic and components related to general catalog topics (title, logo, etc.)feature-datavizfor logic and components related to data visualizationfeature-recordfor logic and components related to displaying a catalog record's information (metadata, data preview, exports, APIs...)feature-editorfor logic and components related to editing metadatafeature-mapfor logic and components related to interactive mapsfeature-searchfor logic and components related to searching through the catalogfeature-notificationsfor 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-accessfolder:data-access-gn4contains an auto-generated API client for the GeoNetwork 4 backend
Libraries providing various utilities in the
utilfolder:util-data-fetcherfor fetching and querying datasetsutil-app-configfor parsing and validating application configurationsutil-sharedfor shared models and types, test fixtures, app-wide settings etc.util-i18nfor translation and internationalization
Libraries providing common services or shared models are in the
utilfolder:common-domaincontains many definitions used across the whole projectcommon-fixturescontains test fixtures
Libraries providing low-level functionalities that can be used both in front and backend are in the
apifolder:api-repositoryfor providing the Records Repository abstraction as well as all models related to it (metadata records, etc.)api-metadata-converterfor 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-accessandutilshould only depend on libraries of the same type - Libraries of type
uiandapishould only depend on shared libraries or libraries of the same type
Shared libraries have thescope:sharedtag; this is for instance the case forutil-i18nandutil-shared - Libraries of type
featurecan depend on any other kind of library expectutil/app-config