-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Architecture.md #1331
Open
dmfalke
wants to merge
12
commits into
main
Choose a base branch
from
ARCHITECTURE.md
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+423
−0
Open
Architecture.md #1331
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cf4d0fa
add ARCHITECTURE.md
dmfalke 3202f34
Merge branch 'main' into ARCHITECTURE.md
dmfalke f60e319
Clarify web server requirements
dmfalke f6f87c5
Add mention of other monorepo packages
dmfalke c44e50d
Stub out other sections to write
dmfalke 094c77e
Add content
dmfalke 189d660
Spelling
dmfalke 21f3284
Additions to "State Management"
dmfalke 4cdc85f
Document build and development tools
dmfalke c3bff47
Update some links
dmfalke 4788a5f
Add FEATURES.md
dmfalke 145c5bf
update title
dmfalke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Architecture | ||
|
||
> [!NOTE] | ||
> This document is intended to be prescriptive, and any deviation from | ||
> implementation should be treated as a bug in the implementation. That is not | ||
> to say that this document will not contain any errors. Please use your best | ||
> judgement, when encountering any said deviations! | ||
|
||
This document is intended to provide an architectural overview of the | ||
single-page applications that this repository produces. The goal is to | ||
familiarize the reader with the code base, and how various packages and | ||
dependencies come together to in a final product. | ||
|
||
Efforts will be made to be general, providing specific examples as warranted | ||
Generally speaking, specific examples should be avoided when possible, since | ||
they can deviate from what is described in this document. | ||
|
||
## Single-page Application | ||
|
||
This repository produces the javascript and css code that is use by all | ||
VEuPathDB websites: genomics-site, clinepi-site, mbio-site, and ortho-site. All | ||
of these sites follow the same architecture, which is based on the React | ||
library. | ||
|
||
In order to use the code in a website, the top-level javascript file and css | ||
file must be included on a webpage. Because the application is a single-page | ||
application, routing is done client-side. It is standard practice to service the | ||
html that for the webpage in such a way that requests for URLs that start with a | ||
specific path are all routed to the HTML file. The javascript code will | ||
dynamically determine what to display on the screen, based on the URL. | ||
|
||
For example, you might have an Apache mod_rewrite rule that looks like this: | ||
|
||
``` | ||
RewriteEngine On | ||
RewriteBase "/app" | ||
RewriteRule "." "/index.html" [L] | ||
``` | ||
|
||
## Layering | ||
|
||
VEuPathDB websites use a layering approach to enable customizations on a | ||
per-website basis. The base layer provides a basic set of functionality, and | ||
initializes the single-page application; it also provides hooks for adding | ||
additional features and customizations. Each subsequent layer can expose | ||
additional hooks that enable further customizations. | ||
|
||
The base layer is the `wdk-client` package, which provides the core | ||
implementation of the single-page application. This includes routing via | ||
react-router, state management via redux and rxjs, and a collection of features, | ||
such as wdk strategies and record pages, and core styling. An `initialize` | ||
function is exposed as a top-level export. The function takes many options that | ||
are used to initialize the single-page application, including things like the | ||
base url, the root dom node to render, the url for the WDK REST service, etc. It | ||
also provides some hooks for adding additional features and customizations, such | ||
as wrapping components, extending the WdkService module, adding addition slots | ||
to the redux store, adding addtional routes, etc. | ||
|
||
The second layer is the `web-common` package. It exposes its own `initialize` | ||
function, which ultimately calls the `wdk-client` `initialize` function. The | ||
`web-common` package handles some business logic that is specific to our | ||
websites and various staging environments, provides more styling rules, and adds | ||
additional features and utilities. | ||
|
||
The final layer is the `*-site` package. This is where the final set of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I added some words to that effect. |
||
customizations and features are added to the single-page application. This | ||
typically includes things related to specific record types or business logic | ||
that may vary between sites. | ||
|
||
> [!NOTE] | ||
> Both `wdk-client` and `web-common` also contain utilities and components that | ||
> may be imported and used by other layers. In that sense, these packages also | ||
> serve as libraries. In a perfect world, with infinite time, these pieces would | ||
> extracted into their own packages, to minimize confusion. But, alas, the world | ||
> is not perfect, and time remains finite... wait... that can't be right... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps because I am not familiar with Apache mod_rewrite, but I lost you here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to clarify. Take a look at
web-monorepo/ARCHITECTURE.md
Lines 40 to 46 in c44e50d