cortip / isomera

πŸ›  A scalable enterprise-grade SaaS boilerplate, harnessing the flexibility of isomerism to craft distinct and powerful solutions. πŸš€
https://www.isomera.org
MIT License
14 stars 6 forks source link

Sign up + sign in + forgot password functionality #74

Closed vygandas closed 9 months ago

vygandas commented 10 months ago

Some notes before digging deeper


What

The platform needs to have a complete email+password authentication system in place. Also, it should be thought through really well for future scaling. A lot of it has already been implemented, but it's not finished, and some parts are missing. This task is all about finishing it and implementing what's left. Refer to Acceptance Criteria to know what will be tested to consider this task complete and done.

Note: The next task will be to create an auth with a magic link and oAuth providers like Apple, Google, Facebook, Github, etc., so keep that in mind when designing the whole auth core.

Why

Well, probably all SaaS projects have a sign-up and sign-in and password reset. Without authentication, it would be quite complicated to get anything done. That's why we implement this core element of any SaaS project.


In addition, default organization for every new user

Every new user gets an organization silently created by default also. If developers need this functionality, it will be easily extendable. If it's unnecessary - they don't need to do anything about it - it will sit in the background.

For reference

image

For one email there should be one user entity. Users can be in one (by default) or invited to many organizations. The user has a separate profile per organization. That profile would hold a name, avatar, and other things that are related to that tied organization. This way, user authentication data is kept in one place, but identity per org is kept separate. Since this is a universal starter project, we can just guess how this can be used, but with this approach, we can be sure we can implement something like Jira, Trello, Hubspot, and DigitalOcean has, but also we will be able to keep it super simple, or even hide organization, and completely ignore it in the project if that's not needed.

Here's DigitalOcean example of multiple teams (here it's actually separate organizations with different owners, billing details and companies πŸ˜‰)

image

This is not a design or something to do, it's just for context! ☝🏻


πŸ”₯ Acceptance Criteria

ahmed-e-elhor commented 9 months ago

So you need a backend developer to solve this issue ?

vygandas commented 9 months ago

So you need a backend developer to solve this issue ?

@ahmed-e-elhor, technically it's a full stack. πŸ€·β€β™‚οΈ

Shreyansh-kankane commented 9 months ago

Sir, Do you want to add authentication and authorization feature via Google, Github, or Facebook signIn/up, Please correct me If I am wrong Basically you want to add Role Base Authentication 1) user signup, user attached to some default organization with details as null initially 1.1) user can add other organization 2) user signIn to different Organization for which they belongs to. 3) Forget Password via email verification.

and rest features you mentioned above

vygandas commented 9 months ago

Sir, Do you want to add authentication and authorization feature via Google, Github, or Facebook signIn/up, Please correct me If I am wrong Basically you want to add Role Base Authentication

  1. user signup, user attached to some default organization with details as null initially 1.1) user can add other organization
  2. user signIn to different Organization for which they belongs to.
  3. Forget Password via email verification.

and rest features you mentioned above

No. Please read again carefully. All the details are in there. I've also provided a lot of details for context so it would be easier to understand the large picture of the task and the overall goal we want to reach.

oAuth implementation will be the next step, which is not in the scope of this issue. Need to implement base authentication completely first.

In this case, even tho there's quite a lot of writing done for the organization, it should be relatively easy to implement that - just create an organization for a new user, tie it together on the relations table with the default role name and that's it. Fast one πŸ˜‰ Oh also, there's no UI for organizations, it's just making a record.

Regarding roles - it's also out of the scope of this issue. It will be needed, but not at this time.

suneox commented 9 months ago

AC scope too much, I think should be separate to 3 task sign-in sign-up forgot password

vygandas commented 9 months ago

@suneox well, it's merged into one, because sign up works, sign in also works, forgot password - sends email with code, sets in db. Practically it's more work on tokens, refresh, making sure it's all nice. It also has tests coverage, quite extensive.

vygandas commented 9 months ago
image

https://github.com/cortip/isomera/tree/main/apps/api/src/auth

ahmed-e-elhor commented 9 months ago

If You can provide more context on the e2e tests, and an example of the front end work required for this task I am ready to join

vygandas commented 9 months ago

@ahmed-e-elhor , please ask more specifically what you're interested in. e2e is e2e :) Open to suggestions and ideas, too. So far, current e2e is what NX generated by default, so nobody really messed with those at all.

Regarding frontend - can just follow the same "design" as it was done. I mean, there's no design at all, 0 lines of CSS :) The whole point is to get it working and have a good/smart/proper components structure.

vygandas commented 9 months ago

Dropping e2e from this task. A bit of an overkill πŸ€“

PhamAnhHoang commented 9 months ago
vygandas commented 9 months ago

@PhamAnhHoang, yeah, it makes sense. Of course, you would need to handle when 401 means actually logged out user, not to get into a loop of refresh attempts. And not forget everything else on the acceptance criteria πŸ˜‰

PhamAnhHoang commented 9 months ago

I saw your post on upwork. Can I contribute to this issue? @vygandas

vygandas commented 9 months ago

@PhamAnhHoang, how long this will take, what do you think? It's important for me that this ticket won't get hanging for too long.

PhamAnhHoang commented 9 months ago

You can tell me your desired deadline and I will try my best to do it @vygandas

vygandas commented 9 months ago

@PhamAnhHoang , well, it's not a very small task and I don't know how much time you will spend daily, that's why you're the best who can tell me when you think you'd be done with it.

PhamAnhHoang commented 9 months ago

I think it will take around 40 hours, so I can complete this task on Monday,

vygandas commented 9 months ago

@PhamAnhHoang please apply on upwork so I could send an offer

PhamAnhHoang commented 9 months ago

This is my Upwork profile: https://www.upwork.com/freelancers/~017c46c5e110925052. I can’t see your post anymore. Can you message me? @vygandas

vygandas commented 9 months ago

@PhamAnhHoang invitation sent βœ