Proposed Update to the Structure of jellyfin-web - Printable Version +- Jellyfin Forum (https://forum.jellyfin.org) +-- Forum: Development (https://forum.jellyfin.org/f-development) +--- Forum: Web Development (https://forum.jellyfin.org/f-web-development) +--- Thread: Proposed Update to the Structure of jellyfin-web (/t-proposed-update-to-the-structure-of-jellyfin-web) |
Proposed Update to the Structure of jellyfin-web - thornbill - 2024-07-12 Inspired by the "Bulletproof React" project structure, I would like to propose the following modification to our existing project structure: 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/pull/5773/files RE: Proposed Update to the Structure of jellyfin-web - 1hitsong - 2024-07-12 I like this idea. I'm all for organization and keeping clean project structures, and reading through the bulletproof readme, this makes a lot of sense. |