Why Backend for Frontend — BFF is not a good idea?

Burak Buruk
4 min readAug 21, 2023

--

Picture this: you’ve got this awesome web or mobile app. And guess what? This app has to have a little chat with some computer magic that’s happening behind the scenes (we call that the backend). This magic is what makes the app get the data it needs and do all those cool things it does. But wait, here’s where it gets interesting: instead of all the apps using the same backend like a big pot of stew, we’re cooking up something different. Each app gets its very own “special” backend, crafted just for it. This unique backend is what we call the Independent Backend for Frontend, or BFF for short.

BFFs

Is it all sounding amazing? Well, before you jump right in and set up your very first BFF, there’s something important to think about. You see, even though there are loads of advantages, there’s a bit of a catch — there’s a cost involved. But hey, don’t let that discourage you! Let’s dive in and figure out the best path.

Main concerns with introducing BFFs

First thing I can tell is that it will be more work to you for sure. You’ll have to take care of the BFF’s deployment, health, security, scalability and all that jazz. It’s like having an extra pet to look after! So, before jumping into the BFF party, make sure it’s worth it for your app. We all know that no one is willing to deal with another end when we already have enough repositories to pet.

Latency

Throwing in an extra layer in your app could end up causing slowdowns. Even if your backend is super speedy, if your BFF becomes a speed bump, it can make things go downhill real fast. Imagine you’re driving smoothly on a highway, but suddenly there’s a big traffic jam right in front of you — not fun, right?

So, here’s the deal: while the backend might be zippy, if the BFF can’t keep up, it’s like a slowpoke at the front of the line. And that, my friend, can make the whole app experience not-so-great.

Code duplication

Every time you make a tweak to your BE, you need to make the same changes in your BFF. It’s like keeping things in sync. Imagine, it’s like you’ve got two notebooks, and whenever you write something new in one, you’ve gotta copy it to the other.

It might seem like a bit of extra work, but guess what? Of course, there are some ways to make this easier. You can use some libraries to kinda automate this job. However, this might not always work perfectly for every situation. So, while they can help, you might still need to keep an eye on things.

Maintenance

Alongside the issue of code being repeated, BFFs also raise the question of who’s in charge of looking after things. Should the Frontend or Backend folks handle it? Even though this might vary based on how your team is set up, there’s still the challenge of finding someone to take care of it.

And you know what else? Adding a whole new app, like the BFF, means there’s more stuff to keep an eye on. It’s like having an extra pet — it needs care, attention, and sometimes even fixing when things go wrong. Just like how you need to make sure your plants are watered and healthy, the BFF needs its fair share of TLC to stay in tip-top shape. So, beyond deciding who’s on duty, remember that keeping the BFF humming smoothly is like tending to a special garden of tech!

Frontend developers unfamiliar with Backend development mindset

You don’t always have Full-stack developers or Frontend developers with backend experience in your teams. Even if BFFs are lightweight backend services, it still requires some backend development mindset so that you don’t have to deal with unexpected issues.

In case you have frontend developers that cannot deal with backend development, you might need to delegate BFFs to backend developers. I am not sure if your backend developers would be happy with this approach since it will mostly copying the same thing from backend services to BFFs although the frontend developers will be the actual consumer and the ones will define the data structure.

Conclusion

Depending on your team, how things are set up in your organisation, and the product you’re working on, BFFs can actually turn out to be super helpful! They can swoop in and save the day, helping your teams get past roadblocks. But, here’s the scoop: when you bring in another application like this, there are things to think about — maintenance, keeping an eye on how it’s doing, making sure it runs smoothly, and keeping it secure, among other stuff. So, don’t rush into anything! Take your time, weigh the pros and cons, and I’m crossing my fingers that whatever choice you make ends up making your life a whole lot breezier, not tougher at all! 😊

Thanks for reading!
Please do share your story how BFF saved the day for you.

Resources

Seeing the BFF Pattern used in the wild

Web App Security, Understanding the Meaning of the BFF Pattern
Best Way to Structure Your Directory/Code (NestJS)

--

--