vsupalov

Is Vue Just Overkill for My Project?

You can use Vue for a very small parts of a single template in your Django app. If there’s a place where you want to create an interactive element, you could use Vue instead of jQuery or vanilla JavaScript. That wouldn’t be overkill, but a sensible and acceptable way to make use of that frontend framework.

With Vue, you don’t have to commit to a too-complicated solution. But depending on the way you choose to setup Vue with your app might lead to an “overkill solution”.

The simplest way to use Vue

Vue can be considered a very light-weight frontend framework options. It was designed to be “incrementally adoptable” - you can start using it without much overhead in any of your Django templates.

Just check out this article for an example on how to get started.

You won’t need to learn Webpack, change the shape of your project or make big changes from the get-go. If you just want a bit of interactivity sprinkled in here and there, Vue is a great way to go.

Do you want a part of your page to be interactive? Then Vue is a good fit. Even more so if the UI is a bit more complex. If all you need are on-click events, you might even have an easier time with jQuery - but Vue pays off as soon as you’re going for a bit more DOM manipulation.

Where “overkill” hides

Now, let’s look at ways to make things more complicated than they need to be. While there are good reasons to use frontend frameworks with Django, that doesn’t mean you need to adopt all of the seemingly-popular patterns around them.

Most of all, there’s usually no need to split your front- and backend into separate projects, or to build a SPA from the get-go.

Each of this decisions is separate and should be well-justified by itself, not as a package deal. You can read on my thoughts regarding SPAs, and reasons to go that route here.

If you’re planning to use Django as your backend, and build an SPA with Vue - you might want to go through the reasoning behind that choice first. Especially if it feels like overkill. There’s probably a well-justified reason why it does.

Being skeptical of complexity is a good thing!

In Conclusion

Vue.js is a pretty cool framework, and there are ways to use it sparingly. I don’t think it’s ever “overkill” to use Vue by itself, and a lot of projects can benefit from using it over something like jQuery.

Building an SPA without the right reasons, or splitting your frontend from your backend completely, are what makes the use of a frontend framework “overkill”.

The good news is: you can use Vue without buying into unnecessary complexity and architectural patterns which are of no use to you! Check out this article for an example on how to get started with Vue in a single template, without having to change your project in a major way.

Want to create better Django apps?

Subscribe for regular articles about Django!

     (About the content, privacy, analytics and revocation). 

    We won't send you spam. Unsubscribe at any time.

    Powered By ConvertKit