refactor(web,docs): adopt Feature-Sliced Design in both frontend apps - #33
Merged
Merged
Conversation
apps/web/src and apps/fumadocs/src are now Feature-Sliced Design roots: app, pages, features, entities and shared, one public API per slice, and imports that only ever point down a layer. Route files hold routing alone (1620 lines to 302 in apps/web); their composition, queries and handlers moved into the page slices they belong to. Steiger enforces it. Each app declares `steiger src --fail-on-warnings` as `lint:fsd`, `bun run check:fsd` runs both through turbo, and CI runs it as the Architecture step. `no-reexport-only-modules` already allowed `index.ts`; apps/fumadocs/.oxlintrc.json now says so too, because a slice's public API is exactly that deliberate entrypoint. Only the two applications are roots: FSD orders an application, and the packages are libraries the apps consume. features/ holds two slices and entities/ one, because extraction is earned by a second consumer rather than anticipated — which is what moved `countries` into shared/lib and `category-menu-icon` into entities/category. docs/engineering/ is repointed at the new paths, and carries the facts the route comments held before `no-comments` took them.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
apps/web/srcandapps/fumadocs/srcare now Feature-Sliced Design roots:app,pages,features,entities,shared, one public API per slice, and imports that only ever point down a layer. Route files hold routing alone —apps/webgoes from 1620 lines of route file to 302, with each screen's composition, queries and handlers in the page slice that owns them. Steiger enforces the result as a new Architecture step in CI. Start withapps/web/src/pages/budget/andapps/web/AGENTS.md.Motivation
components/,hooks/,lib/andutils/grouped code by what it is, so a screen's pieces sat in four folders and nothing said which of them could import which.Drawbacks
git logon a moved file need--follow.index.tsadds a hop between a call site and the symbol, which is the cost of having a public API at all.bun run lint:fsdmust run from the app directory — Steiger readssteiger.config.tsonly when that file's directory is the working directory, and silently uses its own defaults otherwise.apps/webandapps/fumadocsare roots; the packages keep their own layout, so the repository now has two conventions rather than one.Prior art
pages.features/holds two slices andentities/one — the alternative, an entity per domain noun, is the failure mode the methodology warns about.Notes
/dev-avatar, and the docs site.bun run check:fsd, proved by a violation fixture (exit 1) and by toggling a rule off and back on to prove the config is read.contributing/architecture.mdx(new Feature-Sliced Design section and the gate),contributing/index.mdx,contributing/writing-docs.mdx,contributing/categorisation.mdx,contributing/bank-provider.mdx, plusAGENTS.mdat the root and inapps/web,apps/fumadocs,packages/api,packages/env,packages/ui.docs/engineering/is repointed at the new paths and carries the facts the route comments held beforeno-commentstook them.countriesmoved toshared/libandcategory-menu-icontoentities/category:features/bank-connectionandpages/settingseach became a second consumer.devat 1303541 and touches almost every file under bothsrc/trees, so it should land before any other frontend branch.