Skip to content

Commit 365b804

Browse files
committed
docs: second draft of OEP-65 ADR 0002 on frontend app migrations
Also fixing a broken link in oep 65 and the title of ADR 0001, which doesn’t need to say “OEP-65” in it.
1 parent cc5f2b7 commit 365b804

File tree

3 files changed

+73
-57
lines changed

3 files changed

+73
-57
lines changed

oeps/architectural-decisions/oep-0065-arch-frontend-composability.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ OEP-65: Frontend Composability
2929
* - References
3030
- * `FC-0054 - Composable Micro-frontends Discovery <https://openedx.atlassian.net/wiki/spaces/COMM/pages/4063821827/FC-0054+-+Composable+Micro-frontends+Piral+Discovery>`_
3131
* `FC-0007 - Modular MFE Domains Discovery <https://openedx.atlassian.net/wiki/spaces/COMM/pages/3614900241/CLOSED+FC-0007+-+Modular+MFE+Domains+Discovery>`_
32-
* :doc:`ADR 0001 - Create a unified platform repository </architectural-decisions/oep-0045/decisions/0001-tutor-as-replacement-for-edx-configuration>`
32+
* :doc:`ADR 0001 - Create a unified platform repository </architectural-decisions/oep-0065/decisions/0001-unified-platform-repository>`
33+
* :doc:`ADR 0002 - Frontend app migrations </architectural-decisions/oep-0065/decisions/0002-frontend-app-migrations>`
3334

3435
.. contents::
3536
:local:

oeps/architectural-decisions/oep-0065/decisions/0001-unified-platform-repository.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
OEP-65 Create a unified platform repository
2-
###########################################
1+
Create a unified platform repository
2+
####################################
33

44
Status
55
******

oeps/architectural-decisions/oep-0065/decisions/0002-frontend-app-migrations.rst

Lines changed: 69 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
OEP-65 Frontend App Migrations
2-
##############################
1+
Frontend App Migrations
2+
#######################
33

44
Status
55
******
@@ -9,7 +9,7 @@ Accepted
99
Summary
1010
*******
1111

12-
This ADR describes a migration path and simplified repository organization for the frontend-app-* repositories that is compatible with the shell provided by frontend-base as well as module federation and frontend projects.
12+
This ADR describes a migration path and simplified repository organization for the frontend-app-* repositories that is compatible with the shell provided by frontend-base, module federation, and frontend projects.
1313

1414
Context
1515
*******
@@ -18,87 +18,102 @@ OEP-65 proposes adopting webpack module federation for Open edX micro-frontends
1818

1919
This reference implementation is effectively a new underlying architecture for our frontend. This ADR refers to this new architecture as the "module" architecture, as opposed to the historical "micro-frontend" architecture that has existed prior to OEP-65.
2020

21-
As part of this paradigm shift, our frontend-app-* repositories (MFEs) will need to be migrated to work with frontend-base. Of particular note, this will require the repositories to:
21+
As part of this paradigm shift, our ``frontend-app-*`` repositories (MFEs) will need to be migrated to work with `frontend-base <https://github.com/openedx/frontend-base>`_. Of particular note, this will require the repositories to:
2222

2323
* Adopt a new set of build/development CLI helpers
2424
* Use the shell to provide the header, footer, and runtime initialization code, amongst other things.
25-
* Organize their code into loosely-coupled top-level components, which we'll call *modules*.
25+
* Organize their code into loosely-coupled top-level components, which we'll call *application modules*.
2626

27-
As we adopt frontend-base, the libraries it replaces will undergo their own deprecation processes, which will need to coordinate with the migration of micro-frontends included in Open edX releases. After that deprecation, the micro-frontend architecture will cease to be supported.
27+
As we adopt ``frontend-base``, the libraries it replaces will undergo their own deprecation processes, which will need to coordinate with the migration of micro-frontends included in Open edX releases. After that deprecation, the micro-frontend architecture will cease to be supported.
2828

2929
Decision
3030
********
3131

32-
Each of our frontend-app-* repositories will migrate from being an independent "micro-frontend application" to being a library of modules that can be loaded into a common Shell, deployed as a Site. We will document the migration process in detail. At a high level:
32+
Each of our ``frontend-app-*`` repositories will migrate from being an independent "micro-frontend application" to being a library of modules that can be loaded into a common Shell, deployed as a Site. These are called *application module libraries*. We will document the migration process in detail. At a high level, this will involve the following changes.
3333

34-
* They will be deployable via a variety of methods, all of which will use the Shell.
35-
* They will be deployable together or independently.
36-
* They will no longer contain .env or env.config files for any environment, including Devstack and Tutor.
37-
* They will cease to use the following libraries in favor of frontend-base:
34+
New Deployment Methods
35+
======================
3836

39-
* @openedx/frontend-build
40-
* @edx/frontend-plaform
41-
* @openedx/frontend-plugin-framework
42-
* @edx/frontend-component-header
43-
* @edx/frontend-component-footer
44-
* @openedx/frontend-slot-footer
45-
* @edx/brand
46-
* core-js
47-
* regenerator-runtime
37+
The application module libraries will be buildable in several different ways.
4838

49-
* The following dependencies will become peer dependencies:
39+
* Built as an independent Site using the Shell for initialization, the header and footer, configuration, and other foundational services (logging, analytics, i18n, etc.)
40+
* Built as federated modules to be loaded into the Shell at runtime via webpack module federation.
41+
* Built and released as an NPM package for build-time inclusion in a frontend Project, perhaps alongside other application modules from other libraries.
5042

51-
* @openedx/frontend-base
52-
* @openedx/paragon
53-
* react
54-
* react-dom
55-
* react-redux
56-
* react-router
57-
* react-router-dom
58-
* redux
43+
Environment Agnostic
44+
====================
5945

60-
* They will replace the frontend-build ``fedx-scripts`` CLI tools with the frontend-base ``openedx`` CLI tools. We'll discuss some of them in detail here, as they help illustrate what the library will be able to do:
46+
The application module libraries will no longer contain ``.env`` or ``env.config`` files for any specific environment, including Devstack and Tutor. Config filename patterns will be added to the ``.gitignore`` file. They will continue to support adding a (git ignored) config file into the repository to build or develop it, but we also expect operators to use Projects and check their config files into those project repositories as their primary way of working with the application module libraries.
6147

62-
* ``dev`` will start a dev server, loading the repository's application modules into the shell in a site.
63-
* ``dev:module`` will start a dev server that provides the application modules via module federation.
64-
* ``build`` will create a standalone deployable artifact that uses the shell (similar to the micro-frontend architecture)
65-
* ``build:module`` will create a standalone deployable artifact that provides the application modules via module federation.
66-
* ``release`` will package the library for distribution on npm.
67-
* ``serve`` will work with ``build`` or ``build:module`` to locally serve the production assets they generated.
68-
* ``pack`` will work with ``release`` to create a ``.tgz`` file suitable for installing in local git checkouts that depend on the library. (this is a development tool)
48+
Projects and these config files will be the subject of a subsequent ADR.
6949

70-
* The ``dev``, ``dev:module``, ``build``, and ``build:module`` CLI commands will rely on the existence of a "Site Config" file (the replacement for .env/env.config files) which will not be checked into the repository.
71-
* frontend-app-* repositories that are part of Open edX releases will be expected to be published on NPM as a library which exports its modules.
50+
Removed Dependencies
51+
====================
7252

73-
Redefining "application"
74-
========================
53+
Application module libraries will cease to use the following libraries in favor of ``frontend-base``:
7554

76-
This decision constitutes a re-definition of "application" in the Open edX frontend ecosystem. In the past, "application" was synonymous with the entire frontend-app-* repository. With this ADR, "application" will be synonymous with the top-level modules provided by a frontend-app-* repository. Those modules are applications.
55+
* @openedx/frontend-build
56+
* @edx/frontend-plaform
57+
* @openedx/frontend-plugin-framework
58+
* @edx/frontend-component-header
59+
* @edx/frontend-component-footer
60+
* @openedx/frontend-slot-footer
61+
* @edx/brand
62+
* core-js
63+
* regenerator-runtime
7764

78-
We believe that the boundaries of our frontend-app-* repositories are fairly arbitrary and not as semantically meaningful as the boundaries of the *application modules* within them. We want these modules to be the primary unit of modularity - not the entire repository. The shell will be configured to load applications, not repositories.
65+
Peer Dependencies
66+
=================
7967

80-
As an example:
68+
We expect application module libraries to be dependencies of Frontend Projects by default for most operators. Because of this, the following dependencies will become peer dependencies in the application module libraries themselves:
8169

82-
* The ``frontend-app-learning`` repository contains modules related to "learning" - course outline, courseware, the progress and dates pages, etc.
83-
* The ``frontend-app-authn`` repository contains modules related to "authentication" - login, registration, logout, forgot password, etc.
70+
* @openedx/frontend-base
71+
* @openedx/paragon
72+
* react
73+
* react-dom
74+
* react-redux
75+
* react-router
76+
* react-router-dom
77+
* redux
8478

85-
The shell will be configured to load things like "courseware" or "login", not "learning" and "authn" - the repository the module is in is incidental.
79+
New CLI Tools
80+
=============
8681

87-
Regarding "plugins"
88-
-------------------
82+
The ``fedx-scripts`` CLI tools from ``frontend-build`` will be replaced with the ``openedx`` CLI tools from ``frontend-base``. We'll discuss some of them in detail here, as they help illustrate what the library will be able to do:
8983

90-
Plugins are another type of module. We believe that they are different than application modules because they have a different interface with the shell. Plugins are generally UI widgets loaded into a slot, though some can be larger. Applications are generally large and complex, comprising multiple pages of functionality with internal routing. They are also loaded at a path in the application, not in a plugin slot.
84+
* ``dev`` will start a dev server, loading the repository's application modules into the shell in a site.
85+
* ``dev:module`` will start a dev server that provides the application modules via module federation.
86+
* ``build`` will create a standalone deployable artifact that uses the shell (similar to the micro-frontend architecture)
87+
* ``build:module`` will create a standalone deployable artifact that provides the application modules via module federation.
88+
* ``release`` will package the library for distribution on npm.
89+
* ``serve`` will work with ``build`` or ``build:module`` to locally serve the production assets they generated.
90+
* ``pack`` will work with ``release`` to create a ``.tgz`` file suitable for installing in local git checkouts that depend on the library. (this is a development tool)
9191

92-
Modeling applications as Plugins is a possibility, but we believe that it feels like too much indirection and abstraction, and minimizes the importance of applications. Without them there's no site, and many are likely *required* functionality for the Open edX frontend to function at all.
92+
The ``dev``, ``dev:module``, ``build``, and ``build:module`` CLI commands will rely on the existence of a "Site Config" file (the replacement for .env/env.config files) which will not be checked into the repository.
9393

94-
Some frontend-app-* repositories may also include Plugins, but they aren't the primary subject of this ADR.
94+
Distributed as NPM Packages
95+
===========================
96+
97+
``frontend-app-*`` repositories that are part of Open edX releases will be expected to be published on NPM as a library which exports its modules. These libraries will primarily be consumed by Frontend Projects.
9598

9699
Consequences
97100
************
98101

99-
As the module architecture stabilizes, frontend-app-* maintainers and developers will be encouraged to migrate their micro-frontends into application module libraries, and to adopt the module architecture provided by frontend-base. (There will be a migration guide.)
102+
As the module architecture stabilizes, ``frontend-app-*`` maintainers and developers will be encouraged to migrate their micro-frontends into application module libraries, and to adopt the module architecture provided by ``frontend-base``. (There will be a migration guide.)
103+
104+
As micro-frontends are migrated to application module libraries using the shell, there will be a deployment approach that mimics the micro-frontend architecture, but which will require operators to adopt a new underlying configuration and build process to achieve a similar result. Each ``frontend-app-*`` repository will need a deprecation process for the micro-frontend configuration and build infrastructure.
105+
106+
Thinking in Modules
107+
===================
108+
109+
Our definition of "module" aligns with the `industry standard definition <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules>`_. It is also used in the context of `module federation <https://module-federation.io>`_. It's a self-contained part of the frontend that represents a specific part of the Site, and can be loaded in a variety of ways. We have several sub-types of module:
110+
111+
* An *application module* represents a well-bounded sub-area of the Open edX frontend at a particular path. This might be "courseware", "the login page", or "account settings". There are a number of application modules that are *required* for a functioning Open edX frontend Site.
112+
* A "plugin module" represents an optional UI component that is generally added somewhere in an application module, or in the shell. The header and footer, for instance, would be overridden with alternate implementations via plugin modules. New tabs added to the course homepage are also plugin modules.
113+
* *Service modules* which act as implementations of the logging or analytics services.
114+
* *Script modules* which allow attaching arbitrary scripts to the page.
100115

101-
As micro-frontends are migrated application modules using the shell, there will be a deployment approach that mimics the micro-frontend architecture, but which will require operators to adopt a new underlying configuration and build process to achieve a similar result. Each frontend-app-* repository will need a deprecation process for the micro-frontend configuration and build infrastructure.
116+
Our ``frontend-app-*`` repositories go from being "micro-frontend applications" to being a collection of application modules centered around a particular domain (learning, authoring, authn, etc.) The question of which application modules belong in which repositories, and where the right boundaries are, is beyond the scope of this ADR.
102117

103118
Unsupported Customizations
104119
==========================

0 commit comments

Comments
 (0)