-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add ADR 0009 for frontend directory structure #27
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# 9. Frontend directory structure and architecture | ||
|
||
Date: 2023-05-16 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
## Context | ||
|
||
Our software project has a frontend that needs to be organized to facilitate maintenance, scalability, modularity, and ease of navigation. The current directory structure is outdated and hard to manage. As software engineers, we propose a new directory structure based on some criteria. | ||
|
||
We studied [Redux' documentation](https://redux.js.org/faq/code-structure/) about common patterns for project structures. | ||
|
||
Most of the discussion happened reviewing [web/#1355](https://github.com/trento-project/web/pull/1355). | ||
|
||
## Decision | ||
|
||
We propose the following new directory structure for the frontend of our software project: | ||
|
||
``` | ||
assets/js | ||
├── app.js | ||
├── common | ||
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. Maybe it would be a good idea to define what this
Maybe we can put this sentence as paragraph below, so we have a written and aknowledged agreement hehe 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 you're totally right 👍 |
||
│ ├── Banners | ||
│ ├── Button | ||
│ │ ├── Button.js | ||
│ │ ├── Button.stories.js | ||
│ │ ├── Button.test.js | ||
│ │ └── index.js | ||
│ ├── ListView | ||
│ ├── Modal | ||
│ ├── ObjectTree | ||
│ ├── Table | ||
│ ├── Tags | ||
│ └── Tooltip | ||
├── pages | ||
│ ├── AboutPage | ||
│ ├── ChecksCatalog | ||
│ ├── ClusterDetails | ||
│ ├── DatabaseDetails | ||
│ ├── DatabasesOverview | ||
│ ├── ExecutionResults | ||
│ ├── Health | ||
│ ├── HealthSummary | ||
│ ├── Home | ||
│ └── HostDetails | ||
├── hooks | ||
├── lib | ||
├── state | ||
│ ├── sagas | ||
│ │ ├── clusters.js | ||
│ │ ├── clusters.test.js | ||
│ │ └── index.js | ||
│ ├── selectors | ||
│ │ ├── clusters.js | ||
│ │ ├── clusters.test.js | ||
│ │ └── index.js | ||
│ ├── clusters.js | ||
│ ├── clusters.test.js | ||
└── trento.jsx | ||
``` | ||
|
||
Note that `/common` contains truly generic and reusable utilities and components. | ||
|
||
## Consequences | ||
|
||
There may be some overhead associated with restructuring the frontend, such as updating dependencies, fixing references, or rewriting some parts of the application. However, in the long term, this new directory structure will ensure an organized and efficient system that can be easily maintained, scaled, and navigated. The new structure will also facilitate collaboration between developers as they will have a better understanding of where everything is located. | ||
|
||
We have one drawback: action creators related to sagas now live along with slices and action creators generated by redux-toolkit. We found reasonable to have action creators all stuffed in one specific place, but it is well understood that it might not be the case for everyone. | ||
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. What does this exactly mean? 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. Exactly, we can squash all together 👍 |
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.
Could we add some link to the react docs?
https://redux.js.org/faq/code-structure/
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.
Doin' this right now :D