<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Kholid B</title>
    <description>The latest articles on DEV Community by Muhammad Kholid B (@muhammadkholidb).</description>
    <link>https://dev.to/muhammadkholidb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4085906%2F3762e914-d271-4095-91c9-62163918365a.jpg</url>
      <title>DEV Community: Muhammad Kholid B</title>
      <link>https://dev.to/muhammadkholidb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammadkholidb"/>
    <language>en</language>
    <item>
      <title>What if you don't have to build a login page again?</title>
      <dc:creator>Muhammad Kholid B</dc:creator>
      <pubDate>Sun, 23 Aug 2026 15:18:15 +0000</pubDate>
      <link>https://dev.to/muhammadkholidb/what-if-you-dont-have-to-build-a-login-page-again-36ag</link>
      <guid>https://dev.to/muhammadkholidb/what-if-you-dont-have-to-build-a-login-page-again-36ag</guid>
      <description>&lt;p&gt;&lt;em&gt;How do you usually build a login page in an application?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The first project
&lt;/h2&gt;

&lt;p&gt;Imagine you are working on a project that needs a login page. Let's call it Aurora (Project A). The login page is the entry point to the application. Users who have access can log in to the application with the permissions they have.&lt;/p&gt;

&lt;p&gt;We are not going to talk about the details of the login method yet, such as email + password, username + password, phone + password, social login, magic link, or others. Let's say we use email + password for this example. For this, we usually need user data for the application, for example a &lt;code&gt;users&lt;/code&gt; table in the database. If we use email and password as the login method, the &lt;code&gt;users&lt;/code&gt; table would at least need &lt;code&gt;email&lt;/code&gt; and &lt;code&gt;password&lt;/code&gt; columns. Of course, the password should be hashed. &lt;/p&gt;

&lt;p&gt;After the application is developed, users can log in using the email and password registered in the database.&lt;/p&gt;

&lt;p&gt;During development, we can simply inject user data directly into the database. Adding one or two users manually is still fine. If we need more users, we can create a database script to insert them.&lt;/p&gt;

&lt;p&gt;Then another requirement appears. We need to manage users directly from the application. Previously, user data could only be accessed directly from the database. Now the application needs to show a list of users, user details, and provide features to create, update, and delete users. We need to build several new pages for this user management feature.&lt;/p&gt;

&lt;p&gt;Eventually, the feature is completed. Now you can add users whenever you want, and they can immediately use their account to log in to Aurora. At this point, the user requirements for Aurora might be enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  The second project
&lt;/h2&gt;

&lt;p&gt;Then you have another project that also needs a login page. Let's call it Borealis (Project B).&lt;/p&gt;

&lt;p&gt;This is a different project from Aurora, but the login works in a similar way. Since you already built the login feature in the previous project, you can duplicate the existing code into Project B, including the user management feature. Now Project B not only has login, but also has user management just like Project A. You only need to change the styling to match Project B. The &lt;code&gt;users&lt;/code&gt; table has the same structure, so you can simply copy the DDL and DML to the database of Project B. You feel this is more efficient than building the login and user management features from scratch again.&lt;/p&gt;

&lt;p&gt;Then Project B is used by users.&lt;/p&gt;

&lt;p&gt;Unfortunately, there is a bug in the login page that prevents users from logging in with an email containing uppercase characters. You fix the bug in Project B. But because the login and user management code in Project B was copied from Project A, the same bug also exists in Project A. So you have to fix it there too. You fix the bug in both projects and hope there will be no more bugs in the future, which is almost impossible.&lt;/p&gt;

&lt;h2&gt;
  
  
  The third project
&lt;/h2&gt;

&lt;p&gt;Then a third project comes. Let's call it Chronos (Project C).&lt;/p&gt;

&lt;p&gt;Just like the previous projects, this project also needs login and user management. You are still thinking about using the same code you already have in Project A and Project B. Eventually, you build the login and user management features in Project C. But then, there is a new requirement: users need to have roles that can be managed by an admin. For example, a user can have a role such as &lt;code&gt;admin&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;guest&lt;/code&gt;, and so on. So you build a user role management feature in Project C.&lt;/p&gt;

&lt;p&gt;Now the login feature that you originally built in Project A has grown into login, user, and role management. But this new role management feature only exists in Project C. You think about implementing it in Project A and Project B as well, but decide to do it later when there is actually a need for it. Project C is finally completed and ready to use. &lt;/p&gt;

&lt;p&gt;At this point, you start thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;What if there are Project D, E, F, and more that need login and user role management?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You start seeing the same pattern in every new project you build. Of course, there will be different requirements depending on the project, but the basic needs for login and user management are still similar.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Are you going to keep copying the code from one project to another?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Is that really efficient?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Will you have the same bugs, or even new bugs, when copying the code?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;And what happens when you need to maintain or update the login and user role management features later?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Do you have to update them one by one in every project?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What if the login and user role management features could be built once and used by multiple projects?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Two possible approaches
&lt;/h2&gt;

&lt;p&gt;There are two approaches we can consider to handle this problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create login and user management as a separate module/library
&lt;/h3&gt;

&lt;p&gt;The module can then be imported into multiple projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The code is built once and can be used by multiple projects.&lt;/li&gt;
&lt;li&gt;It can be made modular, so each project can import only the modules it needs, such as login, user management, or role management.&lt;/li&gt;
&lt;li&gt;Feature development only needs to be done once and can benefit all projects using the module.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We need to carefully design the modularity.&lt;/li&gt;
&lt;li&gt;A major change in the login and user management features may affect all projects using the module. This can be handled with module versioning.&lt;/li&gt;
&lt;li&gt;Each project still needs to set up the database and data structure required by the modules.&lt;/li&gt;
&lt;li&gt;What happens if different projects use different programming languages? How many programming languages do we want to support? &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Create a separate application specifically for login and user management
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Projects that need login and user management can use the application directly without building them from scratch.&lt;/li&gt;
&lt;li&gt;Projects do not need to worry about maintaining the login and user management features.&lt;/li&gt;
&lt;li&gt;Projects can focus on their main features instead of spending time building login and user management.&lt;/li&gt;
&lt;li&gt;There is no need to set up specific tables for user and role management in each project. Everything is handled by this application.&lt;/li&gt;
&lt;li&gt;We do not need to support different programming languages. Projects can communicate with the login application through a communication protocol such as a REST API.&lt;/li&gt;
&lt;li&gt;Feature development and maintenance are done in one place, so there is no duplicated code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The login and user role management application is separated from the main project, which adds some additional work when developing or maintaining the login application.&lt;/li&gt;
&lt;li&gt;The system needs to be designed to support multiple projects and be as general as possible for any kind of project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Considering development and maintenance efficiency, option 2 seems more interesting. We can focus on developing the login and user management features in one place without worrying about compatibility with other projects. At the same time, other projects do not need to worry about maintaining the login and user management features because they are already handled by the login application.&lt;/p&gt;

&lt;p&gt;After looking into it further, it turns out that option 2 is not something new that we have to build from scratch. There are already several services that provide this kind of approach, such as Auth0, Firebase Authentication, Clerk, and others.&lt;/p&gt;

&lt;p&gt;Some of these services are very complete and can be a good fit for certain use cases. They may even have more features than we actually need. But for the projects in our example above, we might need something more specific: login and user role management with the project as the main scope.&lt;/p&gt;

&lt;p&gt;One of the services we built with this approach is &lt;a href="https://roled.io" rel="noopener noreferrer"&gt;Roled&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With Roled, authentication and user role management can be separated from the main application and managed through a single platform. Each application can have its own Project with isolated users, roles, resources, and permissions. The application does not need to worry about maintaining the login and user role management features because they are already handled by Roled.&lt;/p&gt;

&lt;p&gt;Roled is not a centralized identity platform (IdP). It is a centralized user and role management platform, with authentication as one of its features. This means Roled can also be used together with an authentication system that an application already has.&lt;/p&gt;

&lt;p&gt;Learn more about Roled and how to get started in the &lt;a href="https://docs.roled.io/quickstart" rel="noopener noreferrer"&gt;Quickstart&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We are currently looking for early adopters to experience the simplicity of Roled and become part of its development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://roled.io/signup" rel="noopener noreferrer"&gt;Try Roled&lt;/a&gt; and let us know about your experience!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Cover photo by &lt;a href="https://unsplash.com/@epicuros" rel="noopener noreferrer"&gt;Vasilis Caravitis&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/a-woman-sitting-in-front-of-a-laptop-computer-WGOpvIKwq3Y" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>software</category>
      <category>designsystem</category>
      <category>rbac</category>
      <category>idea</category>
    </item>
  </channel>
</rss>
