r/reactjs • u/Mysterious-Lie1437 • Jul 17 '26
Show /r/reactjs Filesystem-first frontend architecture enforced by CLI (not folders-by-taste)
I kept hitting the same problem: architecture debates in review, barrels everywhere, and AI agents dumping files in random folders. So I shipped DMA (Derived Modular Architecture) — a small rule set derived from the import graph, enforced by tooling.
Layout
src/
app/ # composition root (also pages/routes)
features/ # leaf modules — no inbound from other modules
services/ # appears when something else must import it
shared/ # portable stuff on second use onlyInvariants
- downward imports only
- public API via */public/* (no barrels)
- colocate by default
- promote feature → service when inbound edges appearTooling
npx @derived-modular/cli init .
npx @derived-modular/cli check . # CI gate
npx @derived-modular/cli promote <name> --apply
# + ESLint / Biome / Oxlint plugins for editor feedbackWorks with React/Next/Vite (also Vue/Svelte/Astro examples). Same rules for humans and agents.
- Docs: https://derived-modular.vercel.app
- Repo: https://github.com/mikhailmogilnikov/derived-modular-architecture Curious how this compares to what you use (FSD, feature folders, etc.) — especially where you'd expect it to break.
1
Upvotes
3
u/Embostan Jul 17 '26
So... feature based arch with https://github.com/javierbrea/eslint-plugin-boundaries, just different?
1
u/TheRealSeeThruHead Jul 17 '26 edited Oct 14 '26
In veniam do non est excepteur eu consequat mollit. Dolore commodo dolor aute sint aliquip ipsum proident eiusmod consectetur officia eu non consectetur est quis. Eu minim laborum nisi irure veniam tempor amet velit laborum nostrud id dolor.
1
u/eSizeDave Jul 21 '26
I like the idea of this, and I may try it sometime within the next two weeks, but I prefer biome over eslint. I know eslint has improved since last year, but biome has been excellent for me since I switched over.
2
u/[deleted] Jul 17 '26
[removed] — view removed comment