Skip to content

Frontend patterns for teams: feature folders and lint rules

How to organize folders by feature, when Feature-Sliced Design pays off and why an architecture rule that is not in the linter ends up ignored. With numbers measured in my own projects.

Ramon Gomes 18 min read Level: Advanced

Also available in: Español, Français, Português

Series Front-end for a news portal Part 5 of 7

Senior frontend job posts ask, in one wording or another, for someone to "define and maintain standards for the team". It sounds vague until you open a two-year-old repository with six people working in it and find a utils/ folder with 80 files, a 900-line component nobody wants to touch and three different ways of fetching data from the server.

This article collects what I use and what I measured in my own projects: folders, component patterns, state, conventions and, above all, how a rule leaves the document and gets into the linter. A standard that only exists in a .md file is a suggestion.

Type-based or Feature-based: What Changes in Practice

Type-based groups files by technical role: components/, hooks/, services/, utils/. Feature-based groups them by subject: features/orders/ holds the API, components, hook and test for orders, and only shared code moves up to components/ or lib/.

The old React FAQ accepted both: don't nest more than three or four folders and don't spend more than five minutes choosing (React, legacy). Next.js says it is "unopinionated" about organization and closes with "choose a strategy that works for you and your team and be consistent" (Next.js, 2026).

I agree, but I pick a side. Robert C. Martin wrote in 2011 that architecture should "scream" its use cases, not the framework (Screaming Architecture). components/, hooks/ and services/ scream "React"; features/customers/ and features/billing/ scream the product.

Diagram with two file lists for the same orders feature: organized by type, the files are spread across components, hooks, services, types and utils, five folders; organized by feature, they all sit in features/orders, one folder, and only the shared UI stays outside
Same change, two trees. In one you open five folders; in the other, one.

The practical argument is colocation, from Kent C. Dodds: "place code as close to where it's relevant as possible" (Kent C. Dodds, 2019). With "orders" in a single folder, the pull request stays small and deleting the feature means deleting the folder. In a thread on TabNews, a Brazilian dev forum, about how people organize their frontend, nobody defended type-based organization (TabNews).

Woodworker seen from behind hanging a board with a handsaw, a square and clamps on a pegboard wall; next to it, another board with sandpaper, a chisel and a hand plane; under the workbench, an open drawer holding nothing but a jumble of screwdrivers
Each board holds the kit for one job. The screwdriver drawer is the hooks/ folder: everything of the same type and nothing about the same subject.

The Most Common Structures, Side by Side

Structure What it looks like Wins Loses When
Type-based components/, hooks/, services/, utils/ Quick start, everyone gets it One change touches 4 or 5 folders; the tree talks about the framework Prototype, small app
Feature-based features/<x>/ + shared components/ and lib/ Colocation, smaller PRs, easy to delete Without lint, features start importing each other Most team apps
Feature-Sliced Design 7 layers, slices and segments, imports only go down Verifiable rules and shared vocabulary Learning curve and discipline Large product, several teams
App Router colocation app/route/_components, route groups (group) Safe by default, separate layouts Code reused across routes has no home Next site or app with little shared logic
Monorepo apps/ + packages/ with workspaces Physical boundary between packages Tooling cost Several apps, or app + design system
Atomic Design atoms, molecules, organisms, templates, pages Language for a design system Organizes UI, not the domain Only inside the design system

bulletproof-react. Alan Alickovic's guide, with 36.1k stars, is the most copied reference for feature-based structure (bulletproof-react): src/app with routes and providers, shared folders and src/features/<x> with api, components, hooks and whatever else is needed. Importing across features "might not be a good idea", and the shared, features, app flow is enforced with import/no-restricted-paths (structure). The rule lives in the linter, not just in the README.

Colocation in the App Router. In Next, only page and route become public routes, so components can live next to the route. _x folders are left out of routing; (auth) and (app) organize without showing up in the URL and allow different root layouts (Next.js). For choosing where each page renders, I wrote about SSR, SSG, ISR and CSR.

Monorepo. Turborepo recommends apps/ for applications and packages/ for everything else, and it runs on top of your package manager's workspaces (Turborepo, 2026). Nx goes further and tags projects (scope:client, scope:shared) to say who can depend on whom (Nx). Nubank, in a guide on frontends at scale, mentions a monorepoSingle repository that holds several related projects or packages, such as apps and shared libraries, with common versioning and tooling. with Lerna or Nx and workspaces (Nubank, 2024).

Atomic Design. Brad Frost's five stages (Atomic Design, 2016) are great vocabulary for a design systemSet of components, color and spacing tokens and usage rules a team shares so every screen follows the same look and behavior. and a poor skeleton for the app: the team argues over whether the card is a molecule or an organism, and the business logic ends up with no address. I only use it inside components/ui, documented in Storybook.

Feature-Sliced Design and the Step Back in Version 2.1

FSD is the most complete attempt to turn folder structure into rules. There are 7 layers, top to bottom: app, processes (deprecated), pages, widgets, features, entities and shared. A module can only import from layers strictly below it, and slices on the same layer can't see each other. Inside each slice there are conventional segments: ui, api, model, lib, config (FSD).

Diagram of the Feature-Sliced Design layers in six levels, from app at the top to shared at the bottom, with arrows pointing down and the pages layer highlighted as the place where code is born in version 2.1
Each layer only imports from the ones below. In 2.1, code starts in pages and only moves down when another screen needs it.

The most interesting part is version 2.1, "Pages come first!": the difference from 2.0 is "pages first" decomposition (release v2.1). Before, the tendency was to extract early into features and entities; now the code stays in the page until reuse shows up.

That's the methodology admitting, in public, that hasty abstraction is expensive. Kent C. Dodds calls it AHA, "Avoid Hasty Abstractions" (Kent C. Dodds, 2020), and quotes Sandi Metz: "duplication is far cheaper than the wrong abstraction" (Sandi Metz, 2016). A shared/ folder full of things used by a single screen is the same problem as utils/.

Cartoon of a developer pushing with his hands and knee against a drawer stuffed with cables, batteries, keys, an umbrella, a rubber duck, a sock and a fish, while the other drawers in the cabinet are empty
Every codebase has a utils/ drawer. Nobody remembers who put the fish in there, but three features import it.

For a two-person app, feature-based with two or three boundary rules in the linter solves the same problem with less vocabulary. FSD pays off with several teams and a long life.

My Projects: The Written Rule and the Lint Rule

Here's the honest part. I measured three of my projects in November 2026.

Personal CRM (Next 16, React 19, TanStack Query). The tree, trimmed:

text
apps/web/src/
  app/(auth)/  app/(app)/{hoje,clientes,comercial,financeiro,conversas,...}
  features/<40 pastas>/      api.ts + <feature>-*.tsx + <feature>.test.tsx
  components/{ui,shell,crm,auth,brand}
  lib/{api,auth,query-client.tsx,utils.ts}
  i18n/  messages/

The project's standards document says it plainly: "features/x doesn't import from features/y. Whatever is shared moves up to components/ or lib/". The eslint.config.mjs only has the Next config (core-web-vitals and typescript). I counted the @/features/A imports inside features/B: 324. The security feature imports the AI one 29 times; contracts imports proposals 23 times. The rule became a dead letter precisely because no tool complains.

Another drift: the doc expects features/x/components/, and 38 of the 40 features are flat. That's not a code problem; it's the doc asking for more structure than the code needs.

What works: types come from the generated OpenAPI client, never redeclared, and the big decisions are in 7 numbered ADRs.

ManiVez (React Native app with Expo, pnpm monorepo).

text
apps/mobile/src/
  app/{(app),(auth),(onboarding)}/   rota fina
  features/<40 pastas>/              telas + *.test.tsx ao lado
  ui/                                design system + index.ts
  data/                              repositórios (Firebase e fake)
  domain/                            regra pura, sem react-native
  platform/                          *.ts e *.web.ts

The repository's AGENTS.md has three boundary rules: data only through useRepos(), a screen never imports @react-native-firebase/*, and domain/ doesn't know about react-native. I counted: zero violations across the three. Why? Screen tests run with createFakeRepos(), so the natural path to the data is the repository and not the SDK, and the linter bans neighboring patterns, like importing colors straight from the tokens instead of useColors(), via no-restricted-imports.

The rule with no tool behind it is a different one: "no file over ~250 lines". Today, not counting tests, 51 of the 554 code files go past that; among the .tsx components, 38 of 385, and the largest screen has 602 lines. A rule with a tool holds. A rule without one slips, even in a project where everything else stays on track.

This site (Astro with React islands). The tree is a hybrid: components by section (article, blog, tools), but hooks/, services/ and types/ by type. The package.json promised npm run lint from day one and ESLint had never been installed; the command failed with "eslint: not found". I only fixed it on November 11, 2026, and left the reason at the top of the config: a lint command that doesn't run is worse than none, because it looks like someone checked.

How to Put the Boundary Into the Linter

The options, from simplest to most complete:

  • no-restricted-imports (built into ESLint): blocks paths and names. Good for one-off rules, like in ManiVez.
  • import/no-restricted-paths (eslint-plugin-import): source and target zones. It's the one bulletproof-react uses.
  • eslint-plugin-boundaries: "Lint your architecture, not just your syntax". You map folders to element types and say who can import whom. Works with ESLint 9, Oxlint and TypeScript (jsboundaries.dev).
  • dependency-cruiser: outside ESLint, it validates and draws the dependency graph; --init already comes with circular import detection (dependency-cruiser).
  • Nx enforce-module-boundaries: per-project tags in the monorepo; a project with no tag can't depend on any other (Nx).

For my CRM, the fix fits in one rule. Since flat config is JavaScript, you can generate one zone per feature by reading the folder:

js
// eslint.config.mjs
import { readdirSync } from 'node:fs';
import { defineConfig } from 'eslint/config';
import importPlugin from 'eslint-plugin-import';

const features = readdirSync('./src/features', { withFileTypes: true })
  .filter((d) => d.isDirectory())
  .map((d) => d.name);

export default defineConfig([
  {
    files: ['src/**/*.{ts,tsx}'],
    plugins: { import: importPlugin },
    settings: { 'import/resolver': { typescript: true } }, // understands the @/ alias
    rules: {
      'import/no-restricted-paths': ['error', {
        zones: [
          ...features.map((f) => ({
            target: `./src/features/${f}`,
            from: './src/features',
            except: [`./${f}`],
            message: 'A feature does not import another feature: move the code up to components/ or lib/.',
          })),
          { target: './src/lib', from: './src/features' }, // lib doesn't know about features
        ],
      }],
    },
  },
]);

With 324 violations, this breaks CI on the spot. The way through: turn it on as warn, record the number and switch to error one feature at a time. Atlassian did something similar with barrels: a codemod plus an ESLint rule with autofix (Atlassian, 2025).

Barrel Files: The Measured Cost

A barrel file is a file that only re-exports others, with no code of its own (Marvin Hagemeister, 2023). The loader has to resolve everything it re-exports: in the author's measurements, just loading the graph takes 0.31 s with a thousand modules and 3.12 s with ten thousand.

The numbers from real projects are stronger:

Case Before After
TkDodo's Next app, modules per page ~11k ~3.5k (-68%)
Jira (Atlassian), unit tests per CI build 1,600 200 (-88%)
Jira, integration tests per build 130 20
lucide-react with optimizePackageImports in Next 1,583 modules 333

Sources: TkDodo, 2024; Atlassian, 2025; Vercel, 2023. In the same Vercel test, next build got about 28% faster and serverless cold starts up to 40% faster. Atlassian also cut 75% of the build minutes consumed per commit, and owned up to what it lost: each package's "public API" and the risk of more coupling.

bulletproof-react itself walked it back: "in the past, it was recommended to use barrel files", and today the guidance is to import the file directly (bulletproof-react). The exception, according to TkDodo, is a library with a single entry point, like the ui/index.ts of ManiVez's design system. Inside features, import directly.

Component Patterns That Still Hold

Composition first. Before adding yet another boolean prop (showHeader, compact), accept children or a slot.

Compound components. "Two or more components that work together", like <select> and <option> (Kent C. Dodds, 2019). The parent keeps the state in a Context and the children read it. In React 19 the Context itself becomes the provider:

tsx
const TabsCtx = createContext<{ active: string; go: (id: string) => void } | null>(null);

export function Tabs({ initial, children }: { initial: string; children: ReactNode }) {
  const [active, go] = useState(initial);
  return <TabsCtx value={{ active, go }}>{children}</TabsCtx>;
}

Tabs.Tab = function Tab({ id, children }: { id: string; children: ReactNode }) {
  const ctx = use(TabsCtx)!;
  return <button role="tab" aria-selected={ctx.active === id} onClick={() => ctx.go(id)}>{children}</button>;
};

Custom hooks. This is where logic leaves the screen. Alura, a Brazilian tech school, describes hooks as "pillars in building a good software architecture", tying them to the single responsibility principle (Alura, 2025). In ManiVez, the 250-line rule turns a large screen into components plus a use-<screen>.ts holding the state.

Container/presentational today. The pattern of separating whoever fetches data from whoever draws still comes up in interviews. patterns.dev sums up where it stands now: "in many cases, the ContainerIsolated package that bundles an application with its dependencies and runs the same on any machine, sharing the host operating system. Docker is the most common./Presentational pattern can be replaced with React Hooks", and in a small app it "can easily be an overkill" (patterns.dev). I put the logic in a hook and keep the component that draws free of network calls: same testing benefit, one layer fewer.

Server State Is Not Client State

A lot of frontend mess comes from storing API responses in a global store. TkDodo's line settles it: "it is the server who owns the data" (TkDodo, 2020). Server data is a cache, with staleness, refetching and invalidation. bulletproof-react splits state into five kinds: component, application, server cache (TanStack Query, SWR or RTK Query, not Redux), form (React Hook Form with Zod) and URL (state management).

In my CRM the convention is written down all the way to the query key format, ["companies", "list", filters], and every list component has four mandatory states: loading, empty, error and no permission. I check that in review and in frontend tests, not in the linter.

Conventions: Names, Imports and What to Write Down

  • File names. Pick one and enforce it. bulletproof uses kebab-case with the check-file plugin (project standards). On this site: kebab-case with a role suffix (post.service.ts) and use-*.ts for hooks.
  • Absolute imports. @/features/customers/api instead of ../../../. bulletproof says "absolute imports should always be configured and used". One caveat: paths in tsconfig only teaches the alias to the type checker and doesn't change the path tsc emits; what resolves @/ at runtime is the bundler or the framework (TSConfig).
  • Named exports. Google's TypeScript style guide says "do not use default exports", because a default has no canonicalAddress a page declares as the official version of its content, so search engines merge duplicates and index only that one. name and each file can call it something different (Google). Practical exception: files the framework requires as default, like page.tsx.
  • Conventional Commits. <type>[scope]: description, with fix becoming a patch, feat a minor and ! or BREAKING CHANGE a major (Conventional Commits 1.0.0). In the CRM, the scope points to the phase: feat(f37): ... (see the spec in the catalog).
  • ADR. Michael Nygard proposed a short format in 2011: title, context, decision, status and consequences, numbered, never reusing a number (Nygard, 2011). Alura's frontend architecture course, by Vinícius Neves, treats ADRs and folder standards as the architect's job (Alura). An ADR answers the "why aren't we using Server Actions here?" that comes six months later.
  • Code review. It keeps what the linter can't catch: a bad name, an early abstraction, state in the wrong place. The mechanical stuff goes to the linter. Google's guide says to approve a change that "definitely improves the overall code health", even if it isn't perfect, and to mark personal preferences with "Nit:" so the author knows they can ignore them (Google, review standard). More in AI code review.

An unexpected side effect: ManiVez's AGENTS.md, with layers, rules and "how to verify", became the best standards document, because it's read by people and by agents. More in AI coding agents on a frontend team and, for the specification side, in SDD.

The Ground Shifted in 2026

If your team's answer to "which lint standard?" is still "Airbnb's", it's worth a second look:

What What changed Source
ESLint 9 flat config became the default and .eslintrc was deprecated (April 2024) ESLint, 2024
ESLint 10 the eslintrc system was removed; minimum Node 20.19.0 (February 2026) ESLint, 2026
ESLint 9 end of life unmaintained since August 6, 2026; the latest release is 10.15.0 ESLint blog
Airbnb the flat config issue, opened in 2023, was reopened in April 2026; still no official config issue #2804
Biome 2 type-aware lint rules without the TypeScript compiler; 2.5 passed 500 rules with cross-file analysis Biome
TypeScript 6 strict becomes true by default, target becomes es2025 Microsoft, 2026
TypeScript 7 native port in Go, about 10x faster, still no programmatic API; typescript-eslint stays on 6 for now Microsoft, 2026

In my projects, the CRM is on ESLint 9 and TypeScript 6; ManiVez on ESLint 9.39.5 with strictTypeChecked; this site on TypeScript 5.8, still before strict by default. All three have homework. The CRM already turns on strict, noUncheckedIndexedAccess and exactOptionalPropertyTypes, and bans any. The TypeScript Playground shows what each flag catches.

Biome or ESLint? Without framework-specific plugins, Biome gives you lint and formatting in a single binary, with 97% Prettier compatibility according to the project itself (Biome); migration has a command to import your ESLint and Prettier config, and it writes the formatting options out explicitly, because Biome's defaults differ from Prettier's (Biome, migration). If you depend on boundary rules, jsx-a11y or the Next and Expo plugins, the ecosystem is still in ESLint.

When to Use What

Frequently Asked Questions

Should I organize React by feature or by file type?

By feature, in most team apps: a change stays in a single folder. Type-based works for a prototype or a small app.

What is Feature-Sliced Design and is it worth it for a small project?

A methodology with 7 layers where each one only imports from the layers below. It pays off with several teams; in a small app, feature-based with lint rules is enough.

Where does code shared between two features go?

It moves up to components/ (UI) or lib/ (logic), or to entities/shared in FSD. Only once the second feature really needs it.

Can one feature import another? How do I stop it with ESLint?

The guidance from bulletproof-react and FSD is no: compose at the app or page level. To enforce it, use import/no-restricted-paths, eslint-plugin-boundaries or dependency-cruiser; in an Nx monorepo, project tags.

Do barrel files make a project slow?

They do, especially tests and the dev server. Atlassian went from 1,600 to 200 unit tests per build after removing them. They still make sense as a library's entry point.

Which style guide should I use now that Airbnb has no flat config?

Start with the recommended configs from ESLint and typescript-eslint (preferably strictTypeChecked), plus your framework's config, and add your team's boundary rules. Without specific plugins, Biome is an option.

References

Source: https://ramongomessilva.com.br/blog/frontend-patterns-for-teams · Accessed on December 02, 2026

Share Share on LinkedIn Share on X
Cite this article

Ready-made reference, with today as the access date.

ABNT

Brazilian standard (NBR 6023). Use it in theses and academic papers submitted in Brazil.

GOMES, Ramon. Frontend patterns for teams: feature folders and lint rules. Ramon Gomes, 19 nov. 2026. Disponível em: https://ramongomessilva.com.br/blog/frontend-patterns-for-teams. Acesso em: 2 dez. 2026.

APA

American Psychological Association style. Common in scientific papers and journals, especially in the social, behavioral and health sciences.

Gomes, R. (2026, November 19). Frontend patterns for teams: feature folders and lint rules. Ramon Gomes. https://ramongomessilva.com.br/blog/frontend-patterns-for-teams

BibTeX

Format for LaTeX users (Overleaf, for example). Paste it into your .bib file or import it into Zotero or Mendeley.

@online{gomes2026frontendpatternsfor,
  author = {Gomes, Ramon},
  title = {{Frontend patterns for teams: feature folders and lint rules}},
  organization = {Ramon Gomes},
  year = {2026},
  month = nov,
  date = {2026-11-19},
  url = {https://ramongomessilva.com.br/blog/frontend-patterns-for-teams},
  urldate = {2026-12-02}
}
Found a mistake?

Wrong fact, broken link, outdated information: tell me and I will fix it.

10 to 2,000 characters. If you can, point to the right source.

Only so I can reply. It never shows on any page of the site.

Written by

Ramon Gomes

Software Engineer

Full stack software engineer. I like taking a messy problem, listening to the people who live with it and shipping something that holds up day to day. These days I split my time between my own products, applied AI and client work.

Available for projects

Need Something Like This Built?

I build websites, systems, apps and AI automations, from design to deploy. Tell me what you need or see what I offer.

Related Articles