architecture – Is the Database part of the Backend?


Depends on who you ask

From the perspective of a frontend developer, the answer is generally yes. Since the business logic acts as a (shielding) middle man between the FE and any possible data store, the FE is therefore unable to knowingly separate one from the other, and thus “the backend” refers to that (to the FE developer) inseparable blob.

But to a backend developer, the answer is generally no. Backend devs are (and need to be) very aware of what belongs in their codebase and what doesn’t, so the distinction between the two is clear. When a BE dev speaks about “the backend”, they tend to mean “my codebase”, not the database.

Just as the BE is a remote resource for the FE developer, the database is a remote resource for the BE developer. Just like how FE developers think of the backend as something outside of their own scope, so do BE developers think about the database.

That being said, there are no absolutes here. A BE developer may be speaking to a FE developer using that FE developer’s terminology, or a full stack developer may contextually include/exclude the database from “the backend” based on the current conversation, or…

But I personally can’t really get used to it because there is no business logic in the database.

As much as I don’t like using them, stored procedures are a form of business logic. That is precisely why I don’t like having them around in the database, since I don’t want to have their business logic in the database. But that doesn’t mean some projects don’t make use of them.

I would rather reference the classic 3-layer architecture (Presentation: Front-End, Logic: Back-End, Data: Database).

Your statement implies that “the backend” and “the business logic” are direct synonyms. They are most certainly not. The backend includes business logic, but it tends to contain a lot more than just business logic, even if you ignore the database itself.

That being said, the business logic is the main purpose of the backend. Therefore, if you were to conflate the two in an informal conversation, people will generally be able to infer and understand what you mean.

But if you’re going to ask a question on precise definitions and what exactly is contained in each definition, then you shouldn’t be conflating “the backend” and “the business logic” either.

Your assertion that “the database” and “the business logic” are discrete components is quite correct – assuming no stored procedures, which seems to be the governing consensus nowadays.

But your assertion does not apply to “the backend”, as that is a loosely defined concept whose exact definition depends on who uses it and in what context they do so.