Repository navigation
Group the server's modules into domain folders - #84
Merged
Merged
Conversation
apps/server/src had 45 modules side by side. They now sit in folders by what they are about: auth, config, disks, http, integrations, notifications, schedule, smart, snapraid and system; main.ts, bin.ts and bin-cli.ts stay at src/. The tests follow their module into a __tests__ folder of its domain, as parsers/__tests__ already did. Only git mv, no file changes its content; the imports follow in the next commit, so this commit alone does not build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3rdfbWb1xDUdPRng7TX9Z
Only specifiers and paths change: the relative imports, the fixtures the moved tests read (../../parsers/__tests__/fixtures), the repository root app-files.ts resolves from (one level deeper now), and the server paths named in comments, the Dockerfile, build-binary.sh, the upstream-release workflow and the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3rdfbWb1xDUdPRng7TX9Z
The source tree in development.md lists the folders instead of the loose modules, and the module map in architecture.md is ordered by folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3rdfbWb1xDUdPRng7TX9Z
Owner
Author
TDD review: no findingsI reviewed the move (33a8a20 only What I checked:
Checks: No fix commits were needed. Generated by Claude Code |
Owner
Author
|
TDD-Review abgeschlossen: keine belegten Findings (Details im vorigen Kommentar). Server-Tests gleich wie master (234 pass, 2 skip), CI grün: backend, frontend, install, e2e local/binary/image je 2/2. Merge per Squash. Generated by Claude Code |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
apps/server/srchad 45 modules side by side. This PR groups them into domain folders. Behaviour does not change: there are no code changes, only moves and the import paths that follow them.New tree
Decisions
__tests__/folder in each domain (smart/__tests__/smart-baseline.test.ts), the same wayparsers/__tests__/already works.bun testfinds*.test.tsanywhere, so no config changes. A test still imports its own module as../x.ts, the same as before. Only imports from other domains get one more../. Onesrc/__tests__/mirroring the domains would have added a../to every import.integrations/, notnotifications/. That is how the code uses it:home-assistant*.tsnever touchnotifications.ts. They are built fromarray-snapshot.tsandmetrics.ts(ConfigMetrics), the same as the Prometheus metrics, andmcp.tsimportsarrayStatefromhome-assistant.ts. So these five modules sit together.smart-ignore.tsgoes insmart/, even thoughconfig-parser.tsandroutes/config-operations.tsare what call it. The whole module is about SMART attributes.container-pause.tsgoes insystem/next todocker.ts. It is the only module that drives the Docker client; executors and the scheduler only hold and release it.demo.tsgoes insystem/. It stands in for hardware (smartctl, devices, df, Docker) for six modules across domains.parity-usage.tsgoes indisks/. It reads df for the data and parity disks.routes/,engine/,executors/andparsers/stay as they are, because no merge was obviously right.Commits
Move the server's modules into domain folders: onlygit mv. All 82 files are R100 (git show -M --name-statusshows 82 × R100). This commit does not build on its own.Point the imports and paths at the new domain folders: only specifiers and paths change. 282 lines changed: 236 import lines, plus 46 path lines:../parsers/__tests__/fixturesbecame../../parsers/__tests__/fixturesapp-files.ts:new URL("../../../", import.meta.url)became"../../../../", because the module is one level deeper and the repository root has to stay the sameseed-demo.ts: imports and a commentapps/server/src/…paths named in comments inpackages/shared/src/i18n.ts,AccountDialog.tsx,RemoveDataDiskWizard.tsx,docker/Dockerfile,scripts/build-binary.shandupstream-release.ymldocs/architecture.mdanddocs/development.md, including the folder prefix in the module mapCheck: replace every relative specifier,
apps/server/src/…path and module-map path with a placeholder in the removed and added lines, sort both sides, and they are identical (diffis empty). So no changed line differs except in a path.build-binary.sh, the Dockerfile'sCOPY,tsconfig.jsonand the e2e harness need no changes: they namesrc/,src/main.tsandsrc/bin.ts, which stay where they are.config.test.tsspawnsjoin(import.meta.dir, "..", "config-parser.ts"), which still resolves because the test and the module moved together.Describe the server's domain folders in the docs: the source tree in development.md lists the folders, and the module map in architecture.md is ordered by folder. Docs only.No behaviour change
Run on this branch after rebasing onto
master:bun test(apps/server)tsc --noEmit(apps/server)bun install --frozen-lockfilebiome check,typecheck,test,build../server/srcrecursively)scripts/build-binary.sh--versionprints 1.3.3; serves the UI (/200,<title>SnapRAID UI</title>) and the API; the MCP endpoint lists and reads the embedded docs (docs://snapraid-ui/*)bun --bun playwright test)binary.specruns only for the binary,docker.specneeds a Docker daemon)E2E_BINARY=../dist/snapraid-ui-linux-x86_64)docker.spec)Possible later splits (not done here)
config/maintenance-settings.tsholds the settings of four domains: Docker pause, spindown, metrics and MCP. It could become one settings file per domain.system/demo.tsstands in for SMART, disks, df and Docker. Each stand-in could move next to the domain it replaces.config/setup.tsmixes mount discovery (df) for the setup wizard with creating an array, which is config. The first half could move todisks/.routes/snapraid.ts(job routes plusheal) imports from nearly every domain. It is the obvious next split.Generated by Claude Code