noted.do
The Tech Guy

When to Skip the Framework

Ask online how to start a new web project and you'll get a framework name before you finish the sentence. Laravel, Django, Rails, Next.js, take your pick. And a lot of the time that's good advice. But not always, and I think "just use a framework" gets said on autopilot more than it should.

First, what a framework actually gives you, because it's a lot. Routing. A database layer. Templates. Form validation. Sessions and authentication. CSRF protection. Migrations. A folder structure so everyone knows where things go. Plus a community that has already hit every weird bug you're about to hit and written up the fix. When you use one, you're borrowing years of other people's decisions, and most of those decisions are better than what you'd come up with on a deadline.

That's also the cost. You're borrowing their decisions. You learn the framework's way of doing things on top of the language itself, and when something goes wrong you're debugging through layers you didn't write. Upgrades between major versions can turn into projects of their own. You pull in a pile of dependencies, each one something to keep updated. And for a small app, the framework can easily be bigger than everything you wrote.

So when would I skip it? A few situations come to mind.

When the project is small and will stay small. A contact form, a landing page with a signup, a little internal tool with three screens. You can write that in plain code in an afternoon, it'll have almost nothing to update, and it'll run on basically anything.

When you want to really understand how the web works. Building a few things without a framework teaches you what a request is, how sessions and cookies actually connect, how routing is just looking at a URL and picking some code to run. After that, frameworks stop feeling like magic and start feeling like convenience, which is how they should feel.

When you care a lot about longevity and low maintenance. Plain code with very few dependencies can sit on a server for years with only language updates to worry about. There's no framework end-of-life date to plan around.

When the framework fights the problem. Some projects are shaped oddly, and you spend more time working around the framework's assumptions than you would writing the thing directly.

And when would I absolutely not skip it? When the project is going to grow, especially with more than one developer. A framework's conventions mean a new person can find their way around on day one. It's also when you need lots of the standard pieces at once: user accounts, password resets, email verification, admin panels, background jobs, file uploads. Writing all of that well is a lot of work, and some of it (auth in particular) is easy to get subtly wrong in ways that turn into security problems.

That's the big caveat with going framework-free. You become responsible for the stuff the framework used to handle quietly. You need to escape output in your templates to prevent XSS. You need prepared statements for every query. You need CSRF tokens on your forms, secure session cookie settings, proper password hashing with the language's built-in functions, and sensible error handling that doesn't print stack traces to visitors. None of it is hard individually. Forgetting one of them is the problem.

There's also a middle ground that I think gets overlooked. You don't have to pick between a full framework and writing everything yourself. You can write plain code and pull in a few small, focused libraries: a router, a templating engine, a validation library, a mailer. You get to choose each piece, swap any of them out, and still not reinvent the dangerous parts.

My rule of thumb: if you can describe the whole app in two sentences and you're the only one working on it, plain code is a perfectly good choice and often a nicer one. If the description starts sprawling, or you need user accounts and you've never built them before, reach for a framework and don't feel bad about it.

Comments

Be kind. See the rules.