Looks like a great resource, thanks for sharing it!
I’ve recently implemented the Multi-Organization Model with schema-per-tenant approach in the database and Organization slug used as subdomain in the URL.
Getting cookie sessions and content security policies all working correctly when redirecting between subdomains was a little tricky
Ash made the remaining work fairly simple, just had to map the Conn.assigns.scope to the tenant
and actor
opts when calling into the application layer from the web layer.
One challenge was how to implement tests that would create new tenants and trigger the tenant schema migrations, which can be quite slow. In the end we added a test_seeds script to pre-create a few tenants and randomly select one in each test. Seems to work well with the ecto sandbox.