01 / THE FIRST FEATURE
A page reads from the database. A mutation stays in a Server Action. A helper goes into utils. Each choice works for the feature in front of you.
REACT FULLSTACK ARCHITECTURE / NEXT.JS
An Opinionated React Fullstack Architecture for Next.js Applications
A Next.js application rarely becomes hard to maintain overnight. It happens one reasonable shortcut at a time, until nobody is sure where business logic belongs or what a small change might break. RFAStack gives you an opinionated architecture to follow before the codebase reaches that point.
THE GAP / APPLICATION DECISIONS
The documentation can show you how a Server Component, Server Action, or Route Handler works. Your application still needs rules for when to use each one, where business logic lives, and what several callers should share.
01 / THE FIRST FEATURE
A page reads from the database. A mutation stays in a Server Action. A helper goes into utils. Each choice works for the feature in front of you.
02 / THE PATTERNS DRIFT
Another page calls an internal endpoint for the same kind of read. Another mutation keeps its checks somewhere else. Each implementation works, but the next developer has no clear pattern to follow.
03 / THE SHARED RULE
Keep business rules with the feature that owns them. Pages, Server Actions, and Route Handlers can call the same operation through the boundary they need.
THE COST / UNCERTAINTY
You should be able to find the feature, see where its rules live, and follow each read or mutation to the data it touches. When two paths do the same work and nobody can explain why, every change starts with investigation. That uncertainty slows reviews, encourages repeated mistakes, and becomes technical debt.
THE APPROACH / DEFAULTS WITH BOUNDARIES
The folder tree, server code, and the way data moves should support the same decisions. Start with the direct path, then add structure when the application gives you a reason.
Decide what the code must do and who needs it before choosing a Server Action, Route Handler, or client-side library.
Put the rule in one feature, then let pages, actions, and handlers call it instead of rewriting it.
You should be able to follow the caller to the feature, then follow the feature to the database or outside service.
Keep the direct path until the browser, an external caller, or protected data requires another boundary.
ARCHITECTURE FOUNDATIONS / OWNERSHIP
A neat folder tree is easy to copy and easy to misuse. src/app contains Next.js entry points. src/features owns product behavior. src/platform handles databases and outside services. src/shared holds code with no product-specific rule. Copy the names without the ownership rules and you get four new junk drawers.
src/app and delegate to feature-owned behavior in src/features. Features may call integrations in src/platform and generic primitives in src/shared.READING PATH / RFASTACK
Follow the decisions that shape a Next.js application across features, framework boundaries, server code, and data sources.