Multiple Signups allowed and Tenant per signup #825
Replies: 1 comment 3 replies
-
|
Thanks for the kind words and for reaching out before making a pull request – I really appreciate that! First, to clarify: allowing the same email to sign up for multiple tenants is by design, not a bug. Consider an ERP system where each tenant represents a different company – it's perfectly valid for the same person to own or manage multiple companies. That said, you're right that we should handle this more gracefully. The current flow could definitely be improved by informing users during signup if they already have access to existing tenants with that email, rather than silently creating another one. Now let me explain the current multi-tenant login implementation: When a user with access to multiple tenants logs in, they default to the first tenant they were invited to (technically the first user ordered by UserId, as all IDs in PlatformPlatform are chronological). If the user switches to a different tenant, that becomes their default for that browser – it's stored in local storage as shown here: This means a user with two computers/browsers can have different default tenants on each. Depending on the SaaS product you're building, this may or may not be ideal. A "Select account" screen at login is definitely a valid alternative – I've seen SaaS products do it both ways. I went with the simpler approach to avoid extra UI and logic, but it's a reasonable feature to add. To address your other suggestions: Add the ID of the Owning user to the Tenant table – A tenant can have unlimited owners, so a single owner ID wouldn't work. But detecting if a user already owns a tenant is still straightforward. Login – present tenant selection during authentication – Definitely doable, I just wanted to keep the initial implementation lean. On the topic of PRs: I've found that external contributions, while well-intentioned, often don't fit my workflow. I like PRs to be merged within hours, not days or weeks – and when feedback requires changes, I can't expect volunteers to drop everything and respond immediately. By the time the back-and-forth is done, I've usually just built it myself using my Agentic Workflow with Claude Code, which writes a full unit tests suite, working end-to-end tests, and follows my conventions perfectly. And I can quickly try a couple different variations 😅 Especially for relatively trivial CRUD features like this. I do work with a few long-time collaborators – particularly on frontend where I need the help. If you're building something with PlatformPlatform and need these features for your own product, I'd suggest trying the Agentic Workflow with Claude Code (although I'm not sure how well it works on Windows as of writing). But with a single prompt 9 out of 10 times you will get a production-grade solution with unit tests, end-to-end tests, and code that follows all the conventions in a couple of hours. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Firstly - thanks for the effort put into this. It has been really helpful.
I have a suggestion - I'm happy to put in a PR for this - but wanted to run it by you first in case the current implementation is for a reason.
Currently
Suggestion
Hope it makes sense?
Beta Was this translation helpful? Give feedback.
All reactions