Authentication System and Architecture Thinking Part 1

Recording some thoughts during learning and how to think about implementation from an architecture perspective

January 25, 2026

Recently, I've been working on some small projects, so I'm thinking about whether to use a BaaS like Supabase or build my own backend. To be honest, I've barely written any backend code since finishing bootcamp. But I still remember what my first boss said: "Understanding the backend will help you write code that better matches the data structure returned by backend APIs." I've never really understood if this is true or not, since the backend writes business logic, which is often hard for frontend developers to truly understand. Unless both frontend and backend developers are equally clear about the project details and business logic throughout the entire workflow, communication between frontend and backend is naturally common, and both sides will need to compromise and clarify requirements.

I think it would be interesting to record my process of revisiting backend development, so let's start with Authentication.

What is Auth supposed to do?

Auth has three levels:

  1. Who wants to log in?
  2. Who is already logged in, and can they stay logged in?
  3. What can they do after logging in?

Different authentication systems

So far, all the products I've worked on have been more public-facing. This year, I was fortunate to help a friend with an e-commerce admin panel, so I also got to work with internal-facing authentication.

Public-facing authentication systems

The most common type is registration and login. For the frontend, a simpler registration or login might only require a few important pieces of data, such as: username, password, email. But it could also be complex enough to require more user data. Regardless, all of this is personal information that needs to be well protected. Frontend data is basically visible in the browser, so being attacked is common. Therefore, maintaining security from frontend to backend is crucial.

However, this article won't go too deep into security. Let me refocus on how we can think about building an authentication system.

As users, registration and login are just a moment - fill in the data, verify, enter the page and see our own data. But for engineers, it can be roughly broken down into:

For this type of authentication, when planning, we can make decisions based on the following key points:

Build yourself or use a hosted service

Core authentication mechanism

Token storage and transmission

Credentials and registration strategy

Defense and risk control

Error handling and responses

Below is the authentication system flow diagram:

auth flow authentication process

The next article will record the problems and thoughts encountered when implementing the authentication system.

Back to Blog 🏃🏽‍♀️