2024-07-12, 03:04 AM
Inspired by the "Bulletproof React" project structure, I would like to propose the following modification to our existing project structure:
The addition of the
The
This would be an alternative to the approach of grouping related code under the corresponding route that we had utilized here. I prefer keeping the
A
You can see an example of this structure in practice in my add plugin redesign pull request: https://github.com/jellyfin/jellyfin-web...5773/files
The addition of the
features
directory.The
features
directory will provide us with a more organized file layout as the project continues to grow, allowing us to group code for a common feature under a single directory. Our hooks
directory for example is currently growing out of control as we write more new code using Tanstack Query hooks for queries and mutations. Under the features
directory structure, these would move to features/{feature_name}/api/{hook_name}.ts
for example. Components and types related to a specific feature would also move in a similar fashion. Some possible features could be "libraries", "users", "auth", "search".This would be an alternative to the approach of grouping related code under the corresponding route that we had utilized here. I prefer keeping the
routes
directory clean of any supporting code so that it reflects the url structure of the app. This also enables sharing code for the same feature between routes while keeping it organized separately from global/common code.A
features
directory could be present at the application (apps/dashboard/features
) or global level for common features (like auth). Common lower level components and hooks would stay structured as is.You can see an example of this structure in practice in my add plugin redesign pull request: https://github.com/jellyfin/jellyfin-web...5773/files