Here, I will try to document the design decisions I have made in NotGovUK so that you can evaluate both whether NotGovUK is suitable for your project as well as the sanity of its author.
React is primarily a client-side technology whereas Nunjucks is for the server-side. Rendering components on the client allows us to provide UI interactions without loading a new page from the server. This is much quicker and so has the potential to drastically improve the overall user experience.
Historically, we have shyed away from client-side applications for accessibility reasons and the difficultly of supporting older browsers. However, React allows us to create, so called, 'isomorphic' applications. That is, applications that render on both the server-side and the client-side. This allows us to do progressive enhancement and provide client-side rendering to modern clients whilst still providing server-side rendering as a fallback option.
React is also looking to be far more popular than Nunjucks which should make it easier to resource projects in the long run.
In addition to this, we need to document the interfaces exposed by the components that we write. This always involves defining the types we expect to be passed. We could do this using JSDoc but we may as just use TypeScript and have those types be enforced for us and prevent the documentation going out of sync with the implementation.
The use of TypeScript also provides great benefits in the code that consumes our libraries and components. Specifically they benefit from a IDE and editor features such as auto-completion. This is particularly helpful when working out what 'props' can be passed to a React component.
pnpm is a drop-in replacement for the 'npm' CLI tool with built-in support for monorepos, in the form of workspaces. The thing that makes pnpm particularly suited for TypeScript monorepos is its publishConfig feature.
Using publishConfig we can set the
main property in the
only once we publish.) This means that within the monorepo we can
consume the raw TypeScript source code and not have to worry about
keeping builds up to date.
Why GitHub Actions?