So what I'm going to show you now is a project that I worked on in the last two years as an Amplify UI team member, and I'll tell you some of the decisions that we made and how it went. So who am I? I am a developer at AWS working on the Amplify open-source libraries. You may have seen me online. I have a YouTube channel called ProgramWithEric at eric.video. I've also written some blog posts and I'm also a developer advocate, so recently I have moved roles to being a DA, which has been amazing since I get to talk to so many developers and really talk about Amplify and all the tools that it has.
I like to start the talk with this XKCD comic that talks about how to write good code. You can see at the top you see start project, do things right or do them fast, and then if you go fast, does it work yet? Or if you do things right, do you code well? Are they done yet? But at the bottom, this often happens, is you throw out all your work and start over again. As soon as you create code in any sort of project, after you're quote-unquote done, it becomes something that's a legacy app that needs to be maintained. And what happens is a year, two years pass by, new teams come in, new people come in, the technology's old, it often gets rewritten. And that's actually similar to something that happened with this project that I'm going to talk to you about.
So the My Project that I want to mention in this talk is this is what I fondly describe as the authenticator, an authentication system. It's a widget, it's sort of like a component that you can add into your application that gives you authentication so you can log into an app, you can sign into, you can create a new account. But it also has authorization, so it's backed by Cognito so you can protect your routes for only authorized users. It's just a minimum amount of boilerplate code that you add to your application to add in an authorization authentication system. And it's completely customizable, supports all sorts of things like federated logins with Google or Amazon, and it also supports multi-factor authentication, so it was quite a big project to take on.
Now we did have two prior versions of this Authenticator in the wild. So it was originally written, I believe, around in 2019, where it was using a really old version of Vue 2. It had then been rewritten to use web components and using Stencil. And this was our third round of rewriting this application, this component, to be more user-friendly. We found that using web components and Stencil had a lot of interesting problems with, especially, password managers and the way the DOM works, and ran into some customization issues. So we decided to rewrite this web component, which was actually working not just for Vue, but React and Angular, and rewrite it also all in the native libraries that they support. So we rewrote the Authenticator using Vue 3. And I'll show you how that worked.
So as this process is going on, I started the team, like I said, happened around a couple of years ago, we came up with a list of requirements that we wanted to make sure we hit. So we had these requirements. First and foremost, accessibility was extremely important, and we'll get into that. We wanted to make sure we also had a small bundle size. One thing that happens often with open source projects, you put them into your application, then you notice that your bundle size doubles in size or triples in size. And we wanted to make sure that we can make it as small as possible. We also, since we were rewriting the Vue Authenticator, we wanted to make sure that we also included code for React and Angular and that we were able to reuse code.
Comments