DEV Community


Discussion on: When Should You Use A Web Framework?

madhadron profile image
Fred Ross

I'm going to talk about the backend, since lots of people are talking about frontend. "Framework" covers a lot of ground. It ranges from Flask, which is basically a request router, and in languages like Go is part of the standard library, to Ruby on Rails or Django which provide logins and sessions, an ORM, and piles of other stuff.

Most backends are wrappers around a relational database. You save time by

  1. Reusing a piece of business logic that is the same, such as login and sessions, particularly if, like those, it has sharp edges and security implications.
  2. Avoiding errors in the queries you send to the database (what ORMs are supposed to help with, and sometimes do).
  3. Being able to write fewer endpoints to provide the semantics you need. This is what GraphQL is designed to do.

2 and 3 aren't really framework material, though libraries to do them may be included in frameworks. So when should you use a backend framework? If you can find a framework that provides a big hunk of your business logic that you then don't have to write yourself without messing up your ability to write the endpoints you need otherwise.