What if you don't have to build a login page again?
How do you usually build a login page in an application? The first project 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. We are not going to talk about the details of the login method yet, such as email +…
When building a login page for an application, the process usually begins with creating user data within the application, such as a users table in the database. The login method, in this example, uses email and password. After developing the application, users can log in using their registered email and password. As requirements evolve, the application may need to manage users directly, including listing users, viewing user details, and managing user creation, updates, and deletions.
This leads to the development of several new pages for user management. Once this feature is completed, users can add and manage accounts on their own. In the second project, a similar login feature is duplicated for a different application called Borealis. The user management feature is also included, resulting in both projects having the same login and user management code.
A bug in the login page of Borealis is fixed, but since the code was copied from the first project, the same bug persists in Aurora. The same issue arises in the third project, Chronos, which introduces a new requirement for user role management. The login feature from the first project grows to include login, user, and role management.
However, this feature is only implemented in Chronos, leaving the first two projects with only login and user management. This pattern of code duplication across multiple projects raises questions about efficiency and maintenance. Two potential solutions are considered: creating a separate module or library for login and user management, or developing a dedicated application for these features.
Each approach has its pros and cons, such as modularity, versioning, database setup, and language compatibility. Ultimately, the choice between these options depends on the specific needs and constraints of each project.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.