Skip to content

Commit afa3fdb

Browse files
committed
Migrate micro-frontends
Renames to frontend-development because not all our frontend dev is micro. This is a clean import of LBHackney-IT/micro-frontends@faecb61 plus removing the slug frontmatter on index.md/README.md to allow the build to succeed.
1 parent 9ea2519 commit afa3fdb

File tree

20 files changed

+378
-10
lines changed

20 files changed

+378
-10
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
id: index
3+
title: Introduction
4+
---
5+
6+
## Purpose
7+
8+
The purpose of the Micro Frontend Playbook is to support Hackney Council establish a set of repeatable guidelines for teams to follow, implement and contribute towards.
9+
10+
Collectively, we touch on many of the processes and operations that support our tenants, leaseholders, house officers and contractors (to name a few of our users), and it is in all of our interest to ensure a consistent experience across the platform.
11+
12+
Setting the frontend standards across Hackney Council is an aspirational goal all teams building interfaces can aspire to. We can leverage the work of our fellow collegues, consultants and contractors without having to rebuilding similar features across programmes and streams.
13+
14+
To address some of the earlier known challenges within Hackney Council in the FE space, we are advocating the use of Micro Frontends for building modern web interfaces.
15+
16+
Finally, in the spirit of enabling our end users and to share a common experience when engaging with the Hackney Council platform, we encourage everyone to participate, learn and share on this playbook.
17+
18+
19+
20+
## Help us improve
21+
We are always looking at ways we can improve. If you have any ideas or suggestions please share your feedback on our Micro-Frontends [GitHub Repo](https://github.com/LBHackney-IT/micro-frontends).
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
id: architecture
3+
title: Architecture
4+
---
5+
6+
We use the `single-spa` framework for managing MFE's within Hackney. Single-SPA offers a wide variety of tools to build MFEs, of which we have mostly followed the recommended approach.
7+
8+
1. React & Typescript
9+
2. Runtime composition via SystemJS (Import-maps)
10+
3. Global UMD shared dependencies
11+
4. Utility Module (common) for shared components / utilities
12+
5. Route based (Vertical) splitting
13+
6. Individual git repos and CICD pipelines
14+
15+
## Root Config
16+
The Root Config is the main entry point for the app and is responsible for the orchestration of the MFEs. It contains the import-map, which informs the app of the locations of each MFE, and what namespace to mount them in.
17+
18+
## Applications
19+
These are the individual React MFEs. Primarily hold the views and components required to generate full pages. An Application can contain it's own router and maintain sub-routes related to the MFE.
20+
21+
## Utility Modules
22+
A utility module is very similar to an Application, except it does not have any specific views, and is intended to be available globally from the root config. Utility modules should provide access to shared code, such as utility methods and generic React components.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
id: aws_services
3+
title: AWS Services
4+
---
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
id: benefits
3+
title: Benefits of MFE and example usages
4+
---
5+
6+
## Independent Teams
7+
Microfrontends allow teams to work independantly with their own codebases, pipelines and release strategies to contribute to the same application. This leads to faster development, less dependencies and less domain knowledge required to start contributing effectively.
8+
9+
## Isolated Environments
10+
Each MFE can have their own supporting architecture completley isolated from other parts of the ecosystem. If one MFE fails to build/deploy the rest of the ecosystem is unaffected. You also only need the MFE's you are working on during development, reducing complex getting started guides.
11+
12+
## Scalabale Focussed Teams
13+
Focussed teams can be built around a single MFE allowing the org to scale independantly with considerably reduced onboarding efforts. Allowing domain expert developers to work on features autonomously.
14+
15+
## Maintainable
16+
MFE's are in general much smaller applications to their monolith counterparts. Allowing developers to understand the entirety of the app with less overhead. Resulting in better long term maintainence.
17+
18+
## Example of usage
19+
![MFE](./docs-images/mfe5.png)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
id: boilerplate
3+
title: BoilerPlate
4+
slug: /boilerplate
5+
---
6+
7+
## Base configuration repo
8+
A refresher on the benefits of microfrontends in the context of Hackney Council:
9+
- Each team has the power to deploy microfrontends independently
10+
- Teams can benefit from other teams and collectively contribute to wider Hackney standards
11+
12+
We propose using a tried a tested microfrontend framework called single-spa for scaffolding MFE applications.
13+
14+
The framework documentation can be found [here](https://single-spa.js.org/docs/getting-started-overview).
15+
16+
On a high level, the key thing to keep in mind is that a root config is responsible for rendering HTML pages and the associated javascript. Each MFE application is visible to the root config, which is responsible for displaying the relevant pages to a user.
17+
18+
The microfrontend's that are built will still be applications that developers are already used to.In another words if you would have built with a project with React JS, you can stay assured that you will be building with React JS.
19+
(this would apply to other frontend frameworks as well!)
20+
21+
Setting up a MFE using single span is very easy, you can begin scaffolding an application with the CLI with the command below:
22+
23+
```
24+
npx create-single-spa
25+
```
26+
27+
The CLI neatly allows you to scaffold the root config or the MFE applications.
28+
29+
Start by selecting the option most relevant to you:
30+
- single-spa application / parcel
31+
- in-browser utility module (styleguide, api cache, etc)
32+
- single-spa root config
33+
34+
Select the FE frameworks of choice:
35+
- react
36+
- vue
37+
- angular
38+
- svelte
39+
40+
Select the preferred package manager:
41+
- yarn
42+
- npm
43+
- pnpm
44+
45+
Enable typescipt:
46+
- Yes
47+
- No
48+
49+
Organisation name:
50+
- e.g mtfh (modern tools for housing)
51+
52+
53+
Project name:
54+
- e.g tenure (for the tenure screen)
55+
56+
57+
After choosing your options, the CLI will scaffold the project as per your needs
58+
59+
## Content
60+
If you already are aware of the endpoints you might use, feel free to update the README.md for others to see how they can run your project locally.
61+
62+
```
63+
ACTIVITIES_API_URL=
64+
PERSON_API_URL=
65+
```
66+
67+
[Click here](https://github.com/LBHackney-IT/mtfh-frontend-activity-history) for an example of a README.md you can take inspiration from.
68+
69+
70+
71+
72+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
id: deployment_and_architecture
3+
title: Deployment and Architecture
4+
---
39.4 KB
Loading
79.2 KB
Loading
65 KB
Loading
172 KB
Loading

0 commit comments

Comments
 (0)