dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.69k stars 641 forks source link

Dexie Cloud feature request: in-app invitations #1987

Open dusty-phillips opened 6 months ago

dusty-phillips commented 6 months ago

Shared realms is an excellent feature of Dexie cloud, but the e-mail-to-invite default behaviour isn't flexible enough for all use-cases. I've encountered two related issues:

Problem 1: If the developer is using custom auth, Dexie may not have e-mail addresses or those addresses may not be up-to-date with what the custom auth system knows.

Problem 2: Users who do not know each other well may not want to share their e-mail address, but still want to collaborate.

Current Solution: In the current system, both issues can be solved by e.g. the developer creating a backend endpoint that handles creating realms and adding users to it with whatever invitation infrastructure it wants to use. The problem with this solution is that a user can't hit that backend endpoint if the app is currently in offline mode.

I have two suggested solutions. Either or both could be implemented:

Proposed Solution 1: Add web hooks to Dexie cloud, such that Dexie calls out to an arbitrary HTTP endpoint provided by the webapp developer whenever an invite needs to be sent (this infrastructure could also be used for custom e-mails, as an alternative to sharing SMTP settings). This endpoint could receive the dexie-cloud ID and issue invitations however it sees fit. Options include forcibly adding them to the realm, sending an e-mail or SMS, or having the app developer implement solution 2 below.

Proposed Solution 2: In-app invitations

I think it's possible to make realm invitations work using just dexie-cloud sync without an external e-mail service. Here's how I imagine the flow:

dfahlander commented 6 months ago

At least proposed solution 1 could be implemented with generic data mutation web hooks:

The configuration could be done via CLI or Manager app.