Image for post
Image for post
Photo by Max Bender on Unsplash

Architecting Nuxt applications might seem simple at first — you have your components, pages, and maybe a few plugins. However, as your app grows and the business logic becomes more complex, so does the size and structure of your app. It might not be apparent at first, but as more API calls or other integrations make their way into the codebase you’ll quickly realize how fast these issues can become unmanageable, whether that’s due to repeated code or a poorly designed structure, or lack thereof.

Let’s take for example API calls. Every application, from a simple todo app to a large-scale eCommerce platform requires HTTP requests to an external API, whether that’s one that you’ve built yourself or by a third party. …


Image for post
Image for post
Photo by Lance Anderson on Unsplash

If you’re building apps in Node.js then you might be familiar with NestJS, a self-described feature-packed framework for building server-side applications. Think of it as the Laravel, Ruby on Rails or Flask for Node. NestJS allows us to rapidly build out services with the basics such as routing, validation and database access already packaged in.

Thankfully, authentication is also given first-party support, with support for various providers via passport and multiple guards, including JWT — today’s topic. Nest provides a basic guide to JWT implementation, but it doesn’t necessarily include all the features that your typical app might require.

Let’s take a look at a custom and feature-complete implementation that you can roll in your own application. For simplicity’s sake, we’ll assume that you have an existing project based on Nest’s setup guide and a basic understanding of the various components that Nest provides. …


Image for post
Image for post
Photo by Sawyer Bengtson on Unsplash

Authentication in SPAs is often a hot topic, and even more-so for those who aren’t sure of the best method for implementing an authentication system with all the necessary features and one that can handle the most common edge cases.

Although we won’t cover writing the backend JWT or authentication implementation, there are various articles that describe the best methods for various languages and frameworks, depending on your needs. Regardless of your choice, you’ll want to make sure to implement the three core features necessary for the frontend — registration, login and access token refreshing via refresh tokens. We’ll discuss a basic implementation of some of these endpoints, but they are still completely flexible. …

About

Jake Engel

Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store