Writing
Unopinionated frameworks are dangerous in the AI era
When an AI writes most of your code, every decision your framework leaves open becomes a decision a model makes for you, differently each time. Why I now treat framework opinions as guardrails, and how to add them when your stack has none.
- Published
- Reading time
- 7 min read

Vibe coding has made a quiet assumption about frameworks: that the model will make sensible choices wherever the framework doesn't. For years, the argument over opinionated and unopinionated frameworks was a matter of taste. Some teams wanted the framework to decide the folder layout, the validation approach and the way modules talk to each other. Others wanted a blank canvas. Both shipped fine software.
With AI writing a large share of the code, a decision the framework leaves open is a decision a model makes for you, on the spot, with no guarantee it makes it the same way twice. The freedom is the same, but the person exercising it changed.
#Open decisions get made by whoever types
An unopinionated framework like Express, or React without a meta-framework on top, doesn't remove decisions. It postpones them to whoever writes the code. Where does validation live? Where does the authorization check go? How do you talk to the database? A human on a team answers those once, writes the answers down or absorbs them from the codebase, and stays consistent because they remember.
A model gets its consistency from what is in its context. Agents do read your repository and tend to copy the patterns they find, which helps a lot once a codebase has a clear one. The drift shows up at the start of a project, in areas with no precedent, and in repositories that already contain three patterns.
I see it most with data fetching in React. In the same project, the model will fetch data with useEffect in one component and reach for TanStack Query in the next, depending on what the prompt and the open files happen to suggest.
// OrdersPage.tsx: useEffect and local state
function OrdersPage() {
const [orders, setOrders] = useState<Order[]>([])
useEffect(() => {
fetch('/api/orders')
.then((res) => res.json())
.then(setOrders)
}, [])
return <OrderList orders={orders} />
}
// OrderDetails.tsx: TanStack Query
function OrderDetails({ id }: { id: string }) {
const { data, isPending, error } = useQuery({
queryKey: ['order', id],
queryFn: () => fetchOrder(id),
})
// ...
}
// OrderStats.tsx: useEffect again, this time with axios and a loading flag
function OrderStats({ id }: { id: string }) {
const [stats, setStats] = useState<Stats | null>(null)
const [loading, setLoading] = useState(true)
useEffect(() => {
axios.get(`/api/orders/${id}/stats`).then((res) => {
setStats(res.data)
setLoading(false)
})
}, [id])
// ...
}
Each component works on its own. Together they are three fetching strategies with three different behaviors. Only OrderDetails has caching, deduplication and an error state. OrdersPage never handles failures and never refetches. OrderStats has no cleanup, so when id changes quickly an older response can overwrite a newer one. After a mutation, you can invalidate the ['order', id] query, but the other two components keep showing stale data because they never heard of it.
React has no opinion on any of this. Server state, caching, error handling and loading states are all your call, so the model's call, and it makes a different one each time. A framework that owns data loading, like SvelteKit with its load functions or Next.js with server components, removes that question before the model can answer it.
#Review gets harder, and so does the damage
The usual answer is "just review the code". But when AI makes writing cheap, reviewing becomes the expensive part, and how expensive depends on the framework.
The drift becomes dangerous when it reaches security. Here is the same effect on an Express API:
// Monday: zod validation, auth as router middleware
router.post('/orders', requireAuth, validate(orderSchema), createOrder)
// Wednesday: inline checks, auth inside the handler
router.post('/invoices', async (req, res) => {
if (!req.user) return res.status(401).end()
if (typeof req.body.amount !== 'number') return res.status(400).end()
res.json(await invoices.create(req.body))
})
// Friday: neither
router.post('/refunds', async (req, res) => {
res.json(await refunds.create(req.body))
})
Express can express all three of these, and that is the problem: it accepts any of them. Every one compiles and passes a quick manual test with a valid payload, yet only one is safe to expose. Nothing told the model that /refunds needed an auth check, and nothing will tell the reviewer it is missing.
In an opinionated framework, review is mostly a conformance check. Does this controller follow the module's conventions? Is the DTO validated the way every other DTO is? You compare a diff to a pattern you already know, and deviations stand out. In the Express sketch above, every pull request can introduce a new pattern, so the reviewer has to rebuild the architecture in their head to decide whether it is acceptable.
The strongest version of the opinionated approach is default-deny. In NestJS, you can register an auth guard globally, so every route requires authentication unless someone explicitly marks it public:
@Module({
providers: [{ provide: APP_GUARD, useClass: AuthGuard }],
})
export class AppModule {}
@Controller('refunds')
export class RefundsController {
constructor(private readonly refunds: RefundsService) {}
@Post()
create(@Body() dto: CreateRefundDto) {
return this.refunds.create(dto)
}
}
Now the model can forget auth on /refunds and the route is still protected. Opting out requires a visible @Public() decorator, which is exactly the kind of thing a reviewer or a lint rule can search for. Validation gets the same treatment with a global ValidationPipe and DTO classes. A guardrail doesn't make bad code impossible, it moves the dangerous mistakes from silent omissions to explicit exceptions.
The damage this prevents is rarely exotic. It is the same mistake in slightly different clothes: authorization present in some places and absent in others, three validation libraries across three endpoints, a 2000-line module with no stated intent that nobody dares to change, a package in package.json you never evaluated. Laravel's Form Requests and policies, Django's ORM and Rails' strong parameters all narrow the room for this in the same way.
A framework's opinions cover the common cases. A NestJS app without a global ValidationPipe happily accepts unvalidated input, and a Laravel model with $guarded = [] invites mass assignment. The guardrail only works if the model, and you, stay on the road it marks.
#Where the argument breaks down
It would be dishonest to present this as one-sided.
- Models are very good at React and Express precisely because so much code uses them. Familiarity is a real advantage, and an open stack with strong conventions can beat a rigid one with weak ones.
- Opinionated frameworks change between versions, and a model happily generates the API from two versions ago. A convention only helps if it is the current one.
- A framework's opinions are about structure, not about your domain. A Nest module layout gives the model no idea where your business boundaries are, and it will fill the folders with anemic services just as readily.
- For a prototype or a throwaway tool, none of this matters. Let the model wing it.
The risk grows with the lifetime and the stakes of the code, which is why I'd call open stacks dangerous rather than wrong.
#"Unopinionated" is a spectrum, and you can move along it
The conclusion isn't "never use React or Express". Plenty of tools sit in the middle: Next.js and SvelteKit decide routing, data loading and rendering for you while leaving a lot else open. What matters is how many decisions are still open and who is making them.
If you stay on an open stack, you can write the opinions yourself and make them enforceable.
Start by writing the decisions down where the model reads them. Most coding agents pick up a repository instructions file (AGENTS.md, CLAUDE.md or .github/copilot-instructions.md, depending on the tool). This site has one, and it states where posts live, which frontmatter fields are required, and that styling goes through Tailwind utilities. Something short and concrete is enough:
- Validate every request body with zod, in a `schema.ts` next to the route
- Auth is applied at the router level in `routes/index.ts`, never inside a handler
- All database access goes through `src/db/queries/`, no inline SQL elsewhere
- Do not add dependencies without asking
A written rule is still only a suggestion, and models follow instructions imperfectly. So make the rules fail the build: a lint rule, an import boundary check, or a test that walks the router and asserts every route sits behind auth. Keep one way to do each thing (one validation library, one data access layer, one error format), because every extra option is another branch the model can take. And keep a few example modules around, since a concrete file to copy works better than a paragraph describing what you want.
At that point you have built a small opinionated framework of your own. That costs more than picking one that already exists.
#Conclusion
Using a model doesn't remove the engineer. It moves them from typing to auditing, and the less opinionated the stack, the bigger the audit. If you plan to lean on AI heavily for code that will live a long time, pick a stack that has already made the boring decisions, or make them yourself and enforce them. Either way, those decisions shouldn't live in the model's next guess.
- AI
- Thoughts
- Architecture
- Frameworks