<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mackson Peter</title>
    <description>The latest articles on DEV Community by Mackson Peter (@mackson_peter_909afd9db1f).</description>
    <link>https://dev.to/mackson_peter_909afd9db1f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4217459%2F28ecedae-164c-49cf-bad3-8156d3056f24.png</url>
      <title>DEV Community: Mackson Peter</title>
      <link>https://dev.to/mackson_peter_909afd9db1f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mackson_peter_909afd9db1f"/>
    <language>en</language>
    <item>
      <title>The Experience We Forgot to Build</title>
      <dc:creator>Mackson Peter</dc:creator>
      <pubDate>Sat, 14 Nov 2026 15:39:19 +0000</pubDate>
      <link>https://dev.to/mackson_peter_909afd9db1f/the-experience-we-forgot-to-build-5mh</link>
      <guid>https://dev.to/mackson_peter_909afd9db1f/the-experience-we-forgot-to-build-5mh</guid>
      <description>&lt;p&gt;&lt;em&gt;Rethinking User Experience from Product Design to Software Development&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction: When a Feature Works but the Experience Doesn't
&lt;/h2&gt;

&lt;p&gt;A while ago, I completed my identity verification, often called KYC (know your customer), on an investment platform. I filled in the required information, submitted my documents, and received a message indicating that my submission was successful. That should have been reassuring, but I soon realized I had no clear way to know what happened next.&lt;/p&gt;

&lt;p&gt;Was my verification still being reviewed? Had it been approved? Was there an issue with one of the documents? Did I need to do anything else? I could not tell from the application, so I contacted customer support. More than once.&lt;/p&gt;

&lt;p&gt;I ran into a similar problem when I raised a support ticket. The application let me describe my issue and submit it, but I could not find a useful way to revisit the ticket, check its progress, or see whether someone was working on it. I eventually sent an email and explained the same problem again.&lt;/p&gt;

&lt;p&gt;What bothered me was not simply how the application looked. It was that two important processes seemed to stop at the point where I had done my part. I could submit information, but I could not reasonably follow what happened afterward.&lt;/p&gt;

&lt;p&gt;Another experience made the problem feel more serious. I deposited some money to test an investment product. When I tried to invest it, the amount was deducted from my wallet, but it did not appear in my investment balance. For more than 24 hours, I could not tell where the money was or what had happened to the transaction.&lt;/p&gt;

&lt;p&gt;Was the investment still processing? Had it failed? Would the money be returned? A delay might have been understandable if the platform had explained what to expect, shown a meaningful transaction status, or provided a reliable way to follow up. It did none of these.&lt;/p&gt;

&lt;p&gt;The uncertainty changed my willingness to use the product. I began wondering whether I could trust the platform with a much larger investment and whether I would be able to access my money when I needed it. That experience did not prove that the platform was financially unsafe. It showed me how an unclear experience could make a product feel unsafe.&lt;/p&gt;

&lt;p&gt;It also made me think about how we define a completed feature. If a user can click Submit and the backend successfully stores the request, have we solved the user's problem? Or have we only completed one step in a much larger journey?&lt;/p&gt;

&lt;h2&gt;
  
  
  What Does It Actually Mean to Solve a User's Problem?
&lt;/h2&gt;

&lt;p&gt;As developers, we often work with requirements that are broken down into individual tasks. Build a form. Connect it to an endpoint. Validate the fields. Show a success message. Test the happy path. Mark the ticket as done.&lt;/p&gt;

&lt;p&gt;There is nothing wrong with breaking work into smaller pieces. It is how we make complex projects manageable. The problem begins when we confuse the completion of those pieces with the completion of the user's goal.&lt;/p&gt;

&lt;p&gt;Take a customer support feature. A requirement might say, "Allow users to submit support tickets." The team delivers a form, stores the ticket, and returns a reference number. Technically, the feature works. But why did the user raise the ticket in the first place? They wanted help with a problem. Submission is only the beginning of that process. The user may need to find the ticket again, see whether it has been acknowledged, provide more information, and understand the final response.&lt;/p&gt;

&lt;p&gt;This is the distinction I want us to pay attention to: &lt;strong&gt;technical completion tells us whether the software performed an operation. User completion asks whether the person achieved a meaningful outcome, or at least received a clear and usable result.&lt;/strong&gt; Both matter, and neither should be mistaken for the other.&lt;/p&gt;

&lt;h2&gt;
  
  
  User Experience Is More Than What Users See
&lt;/h2&gt;

&lt;p&gt;When people talk about user experience, the conversation sometimes moves quickly to colours, spacing, typography, and whether an interface looks modern. These things matter. But an attractive screen cannot compensate for a missing process. A beautiful KYC form does not tell me what happened to my verification three days later.&lt;/p&gt;

&lt;p&gt;It is also possible to have the necessary functionality and still provide a frustrating experience. A platform might technically expose a verification status, but bury it in an unexpected menu, label it with internal terminology, or show a message that leaves the user unsure what to do.&lt;/p&gt;

&lt;p&gt;This is why I would not treat interface design and user experience as competing ideas. The interface is one part of the experience. The rest includes the steps people must take, the information available to them, the reliability of the system, and the effort required to accomplish their goals. The human-centred design standard ISO 9241-210 takes the same broad view, treating user experience as a person's perceptions and responses before, during, and after use, not just their reaction to a screen. The useful question is not only, "Does this screen look good?" It is also, "Does this product help the user move forward?"&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Is Also a Form of Communication
&lt;/h2&gt;

&lt;p&gt;When a user takes an action, the application responds: a spinner, a notification, a changed button, a new screen. But saying something is not the same as being understood. Does that response actually tell the user what they need to know?&lt;/p&gt;

&lt;p&gt;Consider the message "Submitted successfully." What was submitted? Is it being processed? Is there an estimated review period? Will the user be notified? Can they return to see the outcome? A success message can be accurate while still leaving important questions unanswered. Compare it with an alternative (the timing is only an example):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Submitted successfully.&lt;/td&gt;
&lt;td&gt;We've received your documents. Most verifications are reviewed within two business days. We'll email you when there's an update, and you can check progress at any time under Profile &amp;gt; Verification.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The second message answers what happened, what happens next, how long it should take, and where to look. It also makes promises the system must keep: a review time the operations team can actually meet, a notification that is really sent, and a status page that exists. &lt;strong&gt;A message is only as honest as the product behind it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The principle of visibility of system status, described in Jakob Nielsen's usability heuristics, is relevant here. Systems should keep users informed through appropriate feedback. The important word is appropriate. Saving a theme preference may only need a brief confirmation. Verifying an identity or processing a payment may require much more.&lt;/p&gt;

&lt;p&gt;Good communication also includes failure. "Something went wrong" rarely tells me whether I should retry, wait, check my account, or contact support. When possible, an application should explain what it knows, avoid claiming certainty it does not have, and give the user a reasonable next step.&lt;/p&gt;

&lt;p&gt;This matters most when money is involved. Seeing funds leave one balance without appearing in another is not just a missing success message. The user needs to know whether the transaction is pending, completed, reversed, or requires attention. If the platform does not know the final outcome yet, it should communicate that uncertainty rather than present a misleading result.&lt;/p&gt;

&lt;p&gt;The same applies to support tickets. Being told a ticket was submitted is different from knowing whether it was received, assigned, investigated, or resolved. Without that visibility, I found myself calling and emailing customer care about an issue I had already reported in the app. The burden of tracking the process had shifted to me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Designing Complete User Journeys
&lt;/h2&gt;

&lt;p&gt;A common way to miss important parts of an experience is to design and review screens in isolation. We look at the onboarding screen, the upload screen, and the confirmation screen. Each one may appear complete. But what happens between them, and what happens when the user returns tomorrow? The UK Government Digital Service puts this well in its Service Standard: solve a whole problem for users, not just the part your team happens to own.&lt;/p&gt;

&lt;p&gt;For KYC, the journey might include submitting documents, waiting for review, receiving an outcome, correcting rejected information, and eventually accessing the service. If we design only the submission screen, we have not designed the verification experience. We have designed an entry point into it.&lt;/p&gt;

&lt;p&gt;A useful exercise is to map the journey from the user's perspective. What does the person know at each stage? What are they waiting for? What happens if they leave the application and come back? What happens if a request fails halfway through? The answers should influence both the interface and the underlying system. A status screen is not useful if the backend does not maintain reliable statuses. A "Try again" button is not useful if repeating the request could create duplicate records. An email update is not enough if it points the user to a process they cannot complete.&lt;/p&gt;

&lt;p&gt;This does not mean every action needs a tracking dashboard. The level of care should match the stakes, duration, frequency, and cost of uncertainty. A quick, reversible, low-risk action may need only a confirmation. A process that affects someone's identity, their access to a service, or their money deserves more deliberate treatment. The objective is not to add complexity everywhere. It is to avoid leaving important journeys without visibility or closure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Engineering the Experience, Not Just the Interface
&lt;/h2&gt;

&lt;p&gt;This is where I believe engineers have a particularly important role to play. We are often the people who see how the intended user journey connects to the behaviour of the actual system. That gives us an opportunity to identify gaps before users encounter them.&lt;/p&gt;

&lt;p&gt;Suppose a designer provides a KYC status screen with labels such as Pending, Approved, and Rejected. The frontend needs an API that exposes the current state. The backend needs a reliable source of truth for that state. The product team needs to define what each state means, and what the user can do when verification is rejected. Without those decisions, the screen is only a representation of an experience the product may not actually support.&lt;/p&gt;

&lt;p&gt;Loading, empty, and pending states are not interchangeable either. A loading state means we are waiting for information. An empty state means we have no relevant records to show. A pending state means the request was received but the process is still underway. If we treat all three as a generic spinner or a blank screen, we make the system harder to understand.&lt;/p&gt;

&lt;p&gt;Payments make the engineering implications clearest. Imagine a user initiates a payment, the server processes it, but the network connection drops before the application receives the response. If the frontend simply displays "Payment failed" and invites a retry, the experience could be misleading and even charge the user twice. The same applies when money moves between internal balances, as it did in my case: a transaction may pass through several states before it settles. The system may need transaction references, idempotent operations (designed so that repeating the same request cannot apply it twice), status reconciliation, an accurate status history, and a clear escalation route.&lt;/p&gt;

&lt;p&gt;The frontend cannot solve that problem through wording alone, and the backend cannot solve the user's uncertainty through reliable processing alone. A reassuring interface cannot compensate for an unreliable ledger. &lt;strong&gt;Good experience depends on accurate underlying behaviour and honest communication about it.&lt;/strong&gt; That includes accessibility: if a status changes, someone using a screen reader should be told. W3C's accessibility guidance on status messages exists precisely so that updates like these reach assistive technology without the user having to hunt for them.&lt;/p&gt;

&lt;p&gt;None of this means engineers should independently redesign every requirement. It means we should ask questions when the implementation reveals a gap. What happens after this request? Can users recover if it fails? How do we know the state on screen is still accurate? Those questions are part of engineering a usable product, not distractions from engineering work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building Good Experiences Is a Shared Responsibility
&lt;/h2&gt;

&lt;p&gt;It would be easy to read these examples and blame the designer for missing screens or the developer for poor feedback. In practice, incomplete experiences rarely come from one person or one discipline. Product, design, frontend, backend, QA, and support each see a different part of the journey. A backend engineer may point out that a proposed status cannot be determined reliably, and a support agent may be the first to notice that users keep asking a question the application never answers.&lt;/p&gt;

&lt;p&gt;The problem comes when each team optimizes only for its own handoff. A design can be approved, an endpoint can pass its tests, and a frontend task can be marked complete while the end-to-end experience remains confusing. A better review asks everyone to walk through the process as a user would, including delays, errors, and returning users, and to ask whether the person has enough information and control at each meaningful point.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Experience Doesn't End When We Deploy
&lt;/h2&gt;

&lt;p&gt;Even a carefully planned journey will not behave exactly as expected in real life. People use software in ways we do not anticipate, and external services fail. Deployment should be treated as the beginning of another kind of learning, not the end of responsibility for the experience. We can look at where users abandon a process, how often they retry, and how often they contact support after using a feature.&lt;/p&gt;

&lt;p&gt;Metrics need interpretation. A high ticket-submission rate does not necessarily mean the ticketing feature is successful. It could mean users have more unresolved problems. A low support-contact rate could indicate a clear product, or it could mean users cannot find a way to ask for help. Numbers become useful when we connect them to the problem we are trying to understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Business Cost of Uncertainty
&lt;/h2&gt;

&lt;p&gt;When users repeatedly need to email or call about tickets they have already raised, support teams spend time answering avoidable status questions and dealing with duplicated reports. Not every support request is evidence of product failure, but patterns of repeated contact can reveal missing visibility or incomplete journeys.&lt;/p&gt;

&lt;p&gt;Poor experiences can also weaken trust. In my case, the uncertainty did not simply make one transaction frustrating. It made me hesitant to invest more money. I did not close my account; I just became more cautious with it. That kind of quiet withdrawal is easy to miss, because a user may remain registered while becoming less active, reducing transaction volume, or eventually moving to another service. Growth is not only about convincing someone to sign up. It also depends on giving them enough confidence to return, transact again, and recommend the product to someone else.&lt;/p&gt;

&lt;p&gt;Teams can look for signals such as repeated contacts per issue, unresolved ticket age, transaction-status enquiries, and retention among users who encountered delays. These measures do not establish causation on their own, but they help teams ask whether an experience is earning or losing confidence over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six Questions Before We Call It Done
&lt;/h2&gt;

&lt;p&gt;Before calling a feature complete, I think a team should ask:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is the user trying to achieve?&lt;/li&gt;
&lt;li&gt;What happens after the main action?&lt;/li&gt;
&lt;li&gt;Can the user understand the current state?&lt;/li&gt;
&lt;li&gt;What happens when something goes wrong?&lt;/li&gt;
&lt;li&gt;Does the user know what to do next?&lt;/li&gt;
&lt;li&gt;How will we know whether the experience actually works?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These questions are not a substitute for research or testing. They are a practical way to expose assumptions that may otherwise survive all the way into production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Did We Actually Solve the Problem?
&lt;/h2&gt;

&lt;p&gt;In the end, the money did arrive, a couple of days later. But getting there meant following up with customer care several times. Each time I spoke to a different agent, and because there was no way to track the issue, I had to narrate the whole problem from the beginning again. The platform had accepted everything I gave it. What it never did was tell me what happened next, and that silence is what cost it my trust.&lt;/p&gt;

&lt;p&gt;We can build technically functional software and still leave users doing unnecessary work. Sometimes the solution is clearer communication. Sometimes it is a better-designed journey. And sometimes it requires engineering decisions that were never included in the original requirements.&lt;/p&gt;

&lt;p&gt;The next time we review a feature and say it is done, perhaps we should ask one more question: did we finish implementing what was requested, or did we actually help the user accomplish what they came to do?&lt;/p&gt;

&lt;h2&gt;
  
  
  References and Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Nielsen, J. (1994, updated). &lt;a href="https://www.nngroup.com/articles/ten-usability-heuristics/" rel="noopener noreferrer"&gt;10 Usability Heuristics for User Interface Design&lt;/a&gt;. Nielsen Norman Group.&lt;/li&gt;
&lt;li&gt;ISO 9241-210:2019. &lt;a href="https://www.iso.org/standard/77520.html" rel="noopener noreferrer"&gt;Ergonomics of human-system interaction: Human-centred design for interactive systems&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Government Digital Service. &lt;a href="https://www.gov.uk/service-manual/service-standard/point-2-solve-a-whole-problem-for-users" rel="noopener noreferrer"&gt;Service Standard: Solve a whole problem for users&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Government Digital Service. &lt;a href="https://www.gov.uk/service-manual/design/introduction-designing-government-services" rel="noopener noreferrer"&gt;Introduction to designing government services&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;W3C Web Accessibility Initiative. &lt;a href="https://www.w3.org/WAI/WCAG21/Understanding/status-messages.html" rel="noopener noreferrer"&gt;Understanding SC 4.1.3: Status Messages&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ux</category>
      <category>webdev</category>
      <category>product</category>
      <category>design</category>
    </item>
    <item>
      <title>Beyond the Folder Structure: Building Maintainable React Applications with Feature-Based Architecture</title>
      <dc:creator>Mackson Peter</dc:creator>
      <pubDate>Mon, 02 Nov 2026 09:22:39 +0000</pubDate>
      <link>https://dev.to/mackson_peter_909afd9db1f/beyond-the-folder-structure-building-maintainable-react-applications-with-feature-based-bkc</link>
      <guid>https://dev.to/mackson_peter_909afd9db1f/beyond-the-folder-structure-building-maintainable-react-applications-with-feature-based-bkc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Beyond the Folder Structure: Building Maintainable React Applications with Feature-Based Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
One thing I've come to understand from working on frontend applications is that writing code is only one part of building software. Another important part is how we organize that code, especially when we're building an application that will continue to grow.&lt;/p&gt;

&lt;p&gt;When a React project is new, it is easy to create folders for components, pages, hooks, services and utilities, and start building. You know where everything is because you've probably written most of it yourself.&lt;/p&gt;

&lt;p&gt;But what happens when the application grows to 10 or 20 features? What happens when another developer joins the team, or when you need to change a feature that was built a year ago?&lt;/p&gt;

&lt;p&gt;For me, a good architecture should do more than make the folder structure look organized. A developer should be able to find a feature, understand how it works and make changes to it without having to understand the entire application first.&lt;/p&gt;

&lt;p&gt;This is why I find feature-based architecture useful. It gives us a way to organize code around the actual work our application does, rather than only around the type of files we're writing.&lt;/p&gt;

&lt;p&gt;To explain the approach, let's imagine we're building a healthcare management application. It allows staff to register patients, manage appointments, view medical histories and maintain medication records. We'll use this same application throughout the article so the decisions are easier to follow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The problem with organizing everything by file type&lt;/strong&gt;&lt;br&gt;
A common React project starts like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/
├── components/
│   ├── PatientCard.tsx
│   ├── AppointmentCard.tsx
│   └── MedicationTable.tsx
├── hooks/
│   ├── usePatients.ts
│   └── useAppointments.ts
├── services/
│   ├── patientService.ts
│   └── appointmentService.ts
├── pages/
│   ├── Patients.tsx
│   └── Appointments.tsx
└── types/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is nothing fundamentally wrong with this structure. For a small application, it can be simple and effective.&lt;/p&gt;

&lt;p&gt;Now imagine I join the team and I'm asked to change the patient registration flow. I open the patients page, then trace its form components, validation, API calls and types across different folders. The files I need are all there, but the code for one feature is spread across the application.&lt;/p&gt;

&lt;p&gt;As more features are added, those folders become larger. It can become harder to answer a basic question: Which files belong to patient registration?&lt;/p&gt;

&lt;p&gt;This is not necessarily a code-quality problem. The individual files might be well written. The challenge is that the structure tells us what kind of file something is, but not always which business feature it belongs to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Organizing the application around features&lt;/strong&gt;&lt;br&gt;
Instead of grouping files only by what they are, we can group them by what they do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/
├── app/
├── features/
│   ├── patients/
│   ├── appointments/
│   ├── medical-history/
│   └── medications/
├── shared/
└── main.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I want to work on appointment scheduling, I have a clear starting point. If I want to change patient registration, I go to the patients feature.&lt;/p&gt;

&lt;p&gt;Each feature can keep the files it needs close together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;features/
└── patients/
    ├── api/
    │   ├── getPatients.ts
    │   ├── createPatient.ts
    │   └── patientKeys.ts
    ├── components/
    │   ├── PatientList.tsx
    │   ├── PatientForm.tsx
    │   └── PatientProfile.tsx
    ├── hooks/
    │   ├── usePatients.ts
    │   └── useCreatePatient.ts
    ├── types/
    │   └── patient.types.ts
    └── index.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're still using familiar React concepts: components, hooks, types and API functions. We're simply keeping the code for one business feature together.&lt;/p&gt;

&lt;p&gt;However, &lt;strong&gt;feature-based architecture is not just about creating a features folder&lt;/strong&gt;. We can move every file into that folder and still end up with a difficult application. The real value comes from deciding what each feature owns, what it shares and how it works with the rest of the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Each feature needs a clear responsibility&lt;/strong&gt;&lt;br&gt;
Imagine our healthcare application has four features: patients, appointments, medical history and medications.&lt;/p&gt;

&lt;p&gt;Let's say we decide to remove appointment scheduling. We would expect to remove the appointment screens and update pages that show appointment information. We would not expect patient registration to stop working because an important patient utility was hidden inside the appointments feature.&lt;/p&gt;

&lt;p&gt;That is the kind of problem clear feature ownership helps us avoid.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A feature should own the code needed for its responsibility and depend as little as possible on the internal files of other features.&lt;/strong&gt; This doesn't mean features can never work together. A patient overview page will naturally need information from several features. The point is to make those relationships deliberate and easy to identify.&lt;/p&gt;

&lt;p&gt;A useful question when adding code is: &lt;em&gt;If this feature were removed tomorrow, what else would have to change?&lt;/em&gt; If the answer includes several unrelated features, we should look again at where that code belongs.&lt;/p&gt;

&lt;p&gt;There is also a practical limit here. A folder structure cannot make every feature independent. Features may share backend data, user permissions and workflows. We should aim for clear responsibilities, not pretend those relationships do not exist.&lt;/p&gt;

&lt;p&gt;I find it helpful to think of the main dependencies this way: the application brings features together, features own their business logic, and features can use general tools from &lt;code&gt;shared&lt;/code&gt;. When one feature genuinely needs another, it should use a small public interface rather than reach into internal folders. This is a guideline for keeping changes predictable, not a rule that every feature must live in isolation. One boundary I would keep firm is that general code in &lt;code&gt;shared&lt;/code&gt; should not import business features. Otherwise, the lowest layer starts depending on the very features it is supposed to support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. When should something become shared?&lt;/strong&gt;&lt;br&gt;
Let's say we have a &lt;code&gt;PatientCard&lt;/code&gt; inside the patients feature. Later, the medical history feature needs a card with a similar layout.&lt;/p&gt;

&lt;p&gt;One option is to import the whole &lt;code&gt;PatientCard&lt;/code&gt; into medical history. That might work, but it also means medical history now relies on a component designed around the patients feature.&lt;/p&gt;

&lt;p&gt;I would first ask what we actually need to reuse. If it is just the layout, we can extract a general &lt;code&gt;InfoCard&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/
├── features/
│   ├── patients/components/PatientCard.tsx
│   └── medical-history/components/HistoryCard.tsx
└── shared/ui/InfoCard.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// shared/ui/InfoCard.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ReactNode&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;InfoCardProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ReactNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ReactNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;InfoCard&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;InfoCardProps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;section&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"info-card"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;heading&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;section&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, the patients feature can use the shared layout while keeping its own content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/components/PatientCard.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;InfoCard&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/shared/ui/InfoCard&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Patient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/patient.types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;PatientCard&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;patient&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;patient&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Patient&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;InfoCard&lt;/span&gt; &lt;span class="na"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Patient details&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;InfoCard&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now both features can reuse the layout without importing each other's internal components. Each caller supplies a heading such as &lt;code&gt;&amp;lt;h2&amp;gt;Patient details&amp;lt;/h2&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;h3&amp;gt;Medical history&amp;lt;/h3&amp;gt;&lt;/code&gt;, choosing the right level for its page. The shared component provides the wrapper and a CSS styling hook; the feature still decides what information and actions belong inside it. Its actual spacing and appearance would be defined in the shared styles.&lt;/p&gt;

&lt;p&gt;But I wouldn't move an entire component into &lt;code&gt;shared&lt;/code&gt; just because two screens look similar. A patient card may include actions, validation rules or permissions that only make sense within the patients feature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Share the general layout, not the patient-specific behavior&lt;/strong&gt;. The same distinction helps keep &lt;code&gt;shared&lt;/code&gt; from becoming a dumping ground. It is a good home for general UI controls, date formatting and HTTP configuration, but not patient forms, appointment workflows or medication rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Bringing features together on one screen&lt;/strong&gt;&lt;br&gt;
A patient overview page might show a profile, medical history, medications and upcoming appointments. We do not need to move all that functionality into the patients feature simply because it appears on one screen.&lt;/p&gt;

&lt;p&gt;The application can bring the features together while each feature remains responsible for its own part.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/routes/PatientOverview.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PatientProfile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/features/patients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MedicalHistoryList&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/features/medical-history&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MedicationList&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/features/medications&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;UpcomingAppointments&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/features/appointments&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;patientId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;PatientOverview&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;patientId&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;main&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;PatientProfile&lt;/span&gt; &lt;span class="na"&gt;patientId&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patientId&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MedicalHistoryList&lt;/span&gt; &lt;span class="na"&gt;patientId&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patientId&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MedicationList&lt;/span&gt; &lt;span class="na"&gt;patientId&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patientId&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;UpcomingAppointments&lt;/span&gt; &lt;span class="na"&gt;patientId&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patientId&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;main&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example assumes each feature exports the component shown and that those components accept a &lt;code&gt;patientId&lt;/code&gt; prop. In a real application, each one would also need appropriate loading, empty and error states.&lt;/p&gt;

&lt;p&gt;I like this approach because the route decides what appears on the page, while the features decide how their own functionality works. Passing a &lt;code&gt;patientId&lt;/code&gt; is a small, explicit contract; the route does not need to know the internal state or data-fetching logic of each feature. If appointment scheduling is removed, we can update this page without rewriting the medical history or medication features.&lt;/p&gt;

&lt;p&gt;Not every feature interaction needs to happen in a route. Sometimes one feature genuinely needs an operation provided by another. When that happens, I would rather expose a small, clearly defined interface than import an arbitrary internal file. I would also watch for chains of features depending on one another, because those can make future changes harder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Give each feature a clear entry point&lt;/strong&gt;&lt;br&gt;
Consider these two imports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Depends on the internal folder structure&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PatientProfile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/features/patients/components/PatientProfile&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Depends on a public entry point&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PatientProfile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/features/patients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second approach allows the patients feature to decide what it makes available to the rest of the application.&lt;/p&gt;

&lt;p&gt;Inside &lt;code&gt;features/patients/index.ts&lt;/code&gt;, we can write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PatientProfile&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/PatientProfile&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we later reorganize the patients feature, we can update this export without changing every consumer. The import path becomes a small agreement between the feature and the rest of the application. It is not a security boundary, and it does not prevent the features from sharing the same backend data. This is a lightweight convention rather than a full implementation of Feature-Sliced Design, which defines additional layers and import rules.&lt;/p&gt;

&lt;p&gt;There is one important detail: an &lt;code&gt;index.ts&lt;/code&gt; file does not automatically make the other files private. TypeScript will still allow a direct import if the path is accessible. If the team wants to enforce this convention, we need import rules and code reviews to support it.&lt;/p&gt;

&lt;p&gt;I also wouldn't export every hook, type and component simply because we can. The entry point should expose what other parts of the application actually need. Keeping it small gives us more freedom to change the internal implementation later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Organizing API calls and managing data&lt;/strong&gt;&lt;br&gt;
Instead of putting patient, appointment and medication requests into one large services folder, I prefer keeping each feature's API operations with the code that uses them. The features can still use a shared HTTP client for common configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// shared/api/client.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;apiClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VITE_API_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example assumes a Vite application, where &lt;code&gt;import.meta.env.VITE_API_URL&lt;/code&gt; is available. Other build setups may read environment configuration differently. Variables exposed to the browser are public configuration, not a safe place for API secrets.&lt;/p&gt;

&lt;p&gt;The patient type can stay with the patients feature. For this small example, we'll use only an ID and a display name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/types/patient.types.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Patient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;NewPatient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the patients feature can define its own API operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/api/getPatients.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;apiClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/shared/api/client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Patient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/patient.types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getPatients&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Patient&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;apiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Patient&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/patients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;Patient[]&lt;/code&gt; type tells TypeScript what response we expect. It does not check that the server actually returned valid patient records. If the API contract is uncertain or the data is sensitive, runtime response validation may be needed as well.&lt;/p&gt;

&lt;p&gt;For these hooks to work, the application must provide a &lt;code&gt;QueryClientProvider&lt;/code&gt; near its root. The &lt;code&gt;app/providers&lt;/code&gt; folder is a natural place for that setup. Create the &lt;code&gt;QueryClient&lt;/code&gt; once for the lifetime of the provider, rather than creating a new one on every render.&lt;/p&gt;

&lt;p&gt;If we use TanStack Query, we can keep the query hook with the feature as well. I also prefer one place for its query keys, so the list and registration flow cannot accidentally use different spellings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/api/patientKeys.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;patientKeys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;lists&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;patients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="kd"&gt;as const&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;patients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;detail&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="kd"&gt;as const&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/hooks/usePatients.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useQuery&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@tanstack/react-query&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getPatients&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../api/getPatients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;patientKeys&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../api/patientKeys&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;usePatients&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;useQuery&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;queryKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;patientKeys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lists&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="na"&gt;queryFn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;getPatients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now a patient list component can focus on displaying the result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/components/PatientList.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;usePatients&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../hooks/usePatients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;PatientList&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;patients&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isPending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isError&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;usePatients&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isPending&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Loading patients...&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Unable to load patients.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;patients&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;No patients found.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;ul&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patients&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;patient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;patient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;ul&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The shared client handles general request configuration. The feature API function knows which endpoint to call. The query hook handles fetching and caching. The component displays the result. Each part has a clear job.&lt;/p&gt;

&lt;p&gt;Query keys describe which data is cached. If the list later supports page numbers or filters, those values should be included in its key because they change the result. Keeping the shared &lt;code&gt;patientKeys.lists()&lt;/code&gt; prefix lets us invalidate all patient-list variants together. I would keep personal details such as names and medical notes out of query keys.&lt;/p&gt;

&lt;p&gt;Patient registration shows why keeping related work together matters. When a new patient is created, the patients feature should own both the request and the decision to refresh its list. I would keep the HTTP operation in &lt;code&gt;api/&lt;/code&gt; and the TanStack Query behavior in &lt;code&gt;hooks/&lt;/code&gt;, following the same pattern as the patient-list request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/api/createPatient.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;apiClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/shared/api/client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;NewPatient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Patient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/patient.types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createPatient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NewPatient&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Patient&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;apiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Patient&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/patients&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/hooks/useCreatePatient.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useMutation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useQueryClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@tanstack/react-query&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createPatient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../api/createPatient&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;patientKeys&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../api/patientKeys&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;useCreatePatient&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;queryClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useQueryClient&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;useMutation&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;mutationFn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;createPatient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;onSuccess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;queryClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invalidateQueries&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;queryKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;patientKeys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lists&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The form stays in the same feature and calls the mutation hook. Here is a deliberately small example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// features/patients/components/PatientForm.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useCreatePatient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../hooks/useCreatePatient&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;PatientForm&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;registration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useCreatePatient&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;trimmedName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;trimmedName&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;registration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isPending&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;registration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mutateAsync&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;trimmedName&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="nf"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Keep the name in the form so staff can try again.&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleSubmit&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt; &lt;span class="na"&gt;htmlFor&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"patient-name"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Patient name&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"patient-name"&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;required&lt;/span&gt;
      &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;registration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isPending&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;registration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isPending&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Registering...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Register&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;registration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isError&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"alert"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Registration failed. Please try again.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an architecture example, not a complete healthcare registration form. A real product needs stronger validation, access checks, consent and careful handling of personal data. Notice that the form doesn't need to know how the patient list is cached. The hook owns that decision. The form uses &lt;code&gt;mutateAsync&lt;/code&gt; so it clears the input only after a successful registration; if the request fails, the name stays available for another attempt. Returning the invalidation promise from &lt;code&gt;onSuccess&lt;/code&gt; also keeps the mutation pending while matching active queries are refetched. Inactive queries are marked stale but are not necessarily fetched immediately. This follows TanStack Query's documented behavior. The pending button helps avoid repeated clicks, but it does not guarantee that a request cannot be duplicated after a network timeout. In a real registration system, the server should handle retries safely, for example with an appropriate idempotency strategy.&lt;/p&gt;

&lt;p&gt;One more thing: not every React application needs an additional global state library. TanStack Query already helps with server data, and React's local state is enough for many UI interactions. If we later have client-side state that several unrelated parts of the application need, then a tool like Zustand may be worth considering. I would introduce it because the application needs it, not simply because it is available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. How do we keep the architecture from drifting?&lt;/strong&gt;&lt;br&gt;
Defining feature boundaries is only the beginning. We also need ways to keep those boundaries intact as the team and codebase grow.&lt;/p&gt;

&lt;p&gt;The public entry points discussed earlier are one convention worth checking automatically. ESLint import restrictions or a module-boundary plugin can help enforce them. The details depend on the project's aliases and import patterns: a rule written only for &lt;code&gt;@/&lt;/code&gt; imports might miss relative paths, and static import restrictions do not cover every dynamic import. I would test both allowed and forbidden examples and run those checks in CI.&lt;/p&gt;

&lt;p&gt;Code reviews and tests are still necessary. A lint rule can catch a forbidden import, but it cannot reliably tell us whether a supposedly shared component contains business logic that should have stayed in one feature. I would keep tests close to the feature they cover and add an integration test for the registration flow: submit a valid name, mock a successful API response, and check that the patient list refreshes. I would also test the failure path: the form should show an error and keep the entered name so staff can retry. These checks test real user actions rather than only checking whether a folder exists. For a reliable test, I would render the form inside a fresh &lt;code&gt;QueryClientProvider&lt;/code&gt;, mock the network request, and wait for the user-visible result. A new query client per test prevents cached patient data from one test affecting another.&lt;/p&gt;

&lt;p&gt;I would make the team's expectations short and practical:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep feature-specific components, API operations and rules inside their owning feature.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;shared&lt;/code&gt; for functionality that does not need to know about a particular business feature.&lt;/li&gt;
&lt;li&gt;Compose multiple features in a page or other clearly owned part of the application.&lt;/li&gt;
&lt;li&gt;Import through public entry points when working across feature boundaries.&lt;/li&gt;
&lt;li&gt;Add a new abstraction only when it solves a real problem.&lt;/li&gt;
&lt;li&gt;These are rules a developer can understand and apply during everyday work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;9. Not every feature needs the same folders&lt;/strong&gt;&lt;br&gt;
One mistake I'd avoid is treating feature-based architecture as a fixed template.&lt;/p&gt;

&lt;p&gt;A small notifications feature might only need three files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;features/notifications/
├── NotificationList.tsx
├── useNotifications.ts
└── index.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A more complex patients feature might need separate directories for forms, validation, API operations and components. Both structures can exist in the same application.&lt;/p&gt;

&lt;p&gt;We shouldn't create folders just because a template says they must exist. We should introduce structure when it makes the code easier to understand and work with.&lt;/p&gt;

&lt;p&gt;This also means feature boundaries may change. If patient registration grows into several distinct workflows, we might split it into smaller areas. If two tiny features are always changed together, we might discover that they belong to one larger responsibility. Architecture is something we maintain as the product changes, not a decision we make once and never revisit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. When does this approach make sense?&lt;/strong&gt;&lt;br&gt;
I wouldn't recommend feature-based architecture for every React project. A small landing page with a contact form probably doesn't need public entry points, strict module boundaries and several feature folders.&lt;/p&gt;

&lt;p&gt;But consider a healthcare application that starts with patients and appointments, then adds medication management, billing, reporting, staff roles and more workflows. As different developers begin working on those areas, clearer ownership becomes more valuable.&lt;/p&gt;

&lt;p&gt;The trade-off is that we now need to think about boundaries, shared code and import rules. That takes some discipline. If the application is too small to benefit from those decisions, the extra structure may slow us down.&lt;/p&gt;

&lt;p&gt;I would judge the architecture by everyday development work, not just by how clean the folders look. Suppose a new requirement adds an emergency contact to patient registration. We should be able to find the patient form, its validation, the API contract and its tests within the patients feature. We might need a backend change or an update to a genuinely shared contract, but we should not have to edit unrelated appointment or medication components. I would look at which files changed and whether those changes stayed close to the feature's responsibility. In this example, I would expect changes in &lt;code&gt;patients/components/PatientForm.tsx&lt;/code&gt;, the patients validation or types, the patient API contract, and their tests. The appointments feature should not need an edit just because patient registration gained one field. That is a more useful test of the architecture than counting folders.&lt;/p&gt;

&lt;p&gt;There is also a limit to what this approach solves. Organizing frontend files does not replace backend authorization, automated tests, accessibility or good API design. Patient records still need server-side access checks. A frontend route guard can guide the interface, but it cannot authorize an API request. I would also avoid putting medical details into query keys, logs or persistent browser storage. If the app caches patient records in memory, it needs a plan to clear or isolate user-specific cached data when staff sign out or switch accounts. For example, the sign-out flow can cancel relevant in-flight queries and clear the QueryClient cache, while also unmounting protected screens and ending the server session. Clearing a cache alone is not an authorization mechanism, and request cancellation must be supported by the HTTP layer to stop work in progress. The same browser should not show one staff member's cached records to another. Those are security and privacy decisions, not benefits that a folder structure provides automatically.&lt;/p&gt;

&lt;p&gt;For me, the question is not, &lt;em&gt;Is feature-based architecture always better?&lt;/em&gt; It is, &lt;em&gt;Has the application become complex enough that organizing code around its business features will make future changes easier?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11. Bringing everything together&lt;/strong&gt;&lt;br&gt;
Here is how those decisions could fit together in our healthcare application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/
├── app/
│   ├── routes/
│   ├── layouts/
│   └── providers/
├── features/
│   ├── patients/
│   │   ├── api/
│   │   ├── components/
│   │   ├── hooks/
│   │   ├── types/
│   │   └── index.ts
│   ├── appointments/
│   ├── medical-history/
│   └── medications/
├── shared/
│   ├── api/
│   ├── ui/
│   └── lib/
└── main.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a starting point, not a required structure. The more useful question is how to introduce it without disrupting an application that already works.&lt;/p&gt;

&lt;p&gt;If I were introducing this approach into an existing codebase, I wouldn't move every file at once. I would start with one feature, bring its related files together, define its entry point, run its tests, and check that its imports follow the agreed rules. Then I would migrate the next feature. That makes the change easier to review and avoids turning a folder reorganization into a risky rewrite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explore the working example&lt;/strong&gt;&lt;br&gt;
I have also built CarePoint, a small healthcare management application based on the example used throughout this article. It brings the ideas together in a working React project, including feature-owned components and API calls, shared UI components, and an application layer that composes features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Try the application: &lt;a href="https://feature-based-architecture-project.netlify.app/sign-in" rel="noopener noreferrer"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Explore the source code: &lt;a href="https://github.com/Macksonpeters/technical-article-feature-based-architecture-demo" rel="noopener noreferrer"&gt;&lt;/a&gt;
The repository includes setup instructions, demo sign-in details, and a guide showing where the concepts discussed in this article appear in the code. It uses a mock backend, so you can explore the example without setting up a separate API.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conclusion&lt;br&gt;
I judge frontend architecture by what happens when someone needs to change a feature. Can they find the relevant code, update a workflow without surprising side effects, and reuse general components without spreading business rules across the application?&lt;/p&gt;

&lt;p&gt;Feature-based architecture gives us a practical way to approach those questions. It encourages us to organize code around the functionality we're building, define clear responsibilities and make dependencies easier to see.&lt;/p&gt;

&lt;p&gt;Those benefits don't come from creating a &lt;code&gt;features&lt;/code&gt; folder alone. They come from clear ownership, deliberate dependencies and a team that maintains those decisions as the product changes. The proof is in everyday work: how quickly a developer can find the right code, how safely a feature can change and how easily its behavior can be tested.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The goal isn't to have the most sophisticated folder structure. It's to have a codebase that developers can understand, maintain and confidently extend.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Further reading&lt;br&gt;
These resources support the ideas discussed here. This article is a practical explanation of one approach, not a claim that React requires a particular folder structure.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React documentation, Thinking in React: &lt;a href="https://react.dev/learn/thinking-in-react" rel="noopener noreferrer"&gt;https://react.dev/learn/thinking-in-react&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;React documentation, Managing State:&lt;a href="https://react.dev/learn/managing-state" rel="noopener noreferrer"&gt;https://react.dev/learn/managing-state&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TanStack Query documentation, Query Keys: &lt;a href="https://tanstack.com/query/latest/docs/framework/react/guides/query-keys" rel="noopener noreferrer"&gt;https://tanstack.com/query/latest/docs/framework/react/guides/query-keys&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TanStack Query documentation, Invalidations from Mutations: &lt;a href="https://tanstack.com/query/latest/docs/framework/react/guides/invalidations-from-mutations" rel="noopener noreferrer"&gt;https://tanstack.com/query/latest/docs/framework/react/guides/invalidations-from-mutations&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Feature-Sliced Design documentation, Layers and public APIs: &lt;a href="https://feature-sliced.design/docs/reference" rel="noopener noreferrer"&gt;https://feature-sliced.design/docs/reference&lt;/a&gt; and &lt;a href="https://feature-sliced.design/docs/concepts/low-coupling" rel="noopener noreferrer"&gt;https://feature-sliced.design/docs/concepts/low-coupling&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ESLint documentation, no-restricted-imports: &lt;a href="https://eslint.org/docs/latest/rules/no-restricted-imports" rel="noopener noreferrer"&gt;https://eslint.org/docs/latest/rules/no-restricted-imports&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TanStack Query documentation, QueryClient (including cache clearing): &lt;a href="https://tanstack.com/query/latest/docs/framework/react/reference/classes/QueryClient" rel="noopener noreferrer"&gt;https://tanstack.com/query/latest/docs/framework/react/reference/classes/QueryClient&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;OWASP Cheat Sheet Series, HTML5 Security: &lt;a href="https://cheatsheetseries.owasp.org/cheatsheets/HTML5_Security_Cheat_Sheet.html" rel="noopener noreferrer"&gt;https://cheatsheetseries.owasp.org/cheatsheets/HTML5_Security_Cheat_Sheet.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>architecture</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
