Skip to main content

Architecture

The layers and their dependency rules, the ports, how the map adapter works and how to add an adapter of your own.

This page is built from ARCHITECTURE.md in the repository, which is where it is edited.

At a glance​

The document is long, so the site gives each section its own page. A section that is still long is cut into numbered parts.

About this document​

MapCairn separates what the app does from what it runs on. The interface and the pure logic depend on small interfaces (ports). Concrete code that touches a map engine, a browser service or a network service (adapters) lives in one place each and is wired together once, in the composition root.

Diagram of 6 boxes and 7 arrows web, the host createServices(), web adapters points to map user interface. web, the host createServices(), web adapters points to adapter-maplibre MapLibre adapter. map user interface points to core ports, logic. map user interface points to theme. map user interface points to react. adapter-maplibre MapLibre adapter points to core ports, logic. adapter-maplibre MapLibre adapter points to theme. web, the host createServices(), web adapters map user interface adapter-maplibre MapLibre adapter core ports, logic theme react

An arrow means "imports". Each box is a package under packages/, so core is packages/core. core holds the ports (types only), the pure logic, the fakes and the contract suites, and imports no other package, as do theme (the tokens and their contrast maths) and react (generic hooks). Only the host imports the MapLibre adapter, and no SDK package imports the host. The host also imports core and theme directly, which the picture leaves out.