Ecto & Multi-tenancy - Dynamic Repos - Getting started

I gave a shot at summarizing some of what I’ve picked up while setting up dynamic repos with Ecto for a project. I expect to write more on this as I went to significantly more depth. But since the writing was a bit thin on the subject as it stood I wanted to get the basics summarized and out there.

I hope it will be useful to people :slight_smile:
Thanks to Jose for clearing up some stuff I ended up bringing up in issues.


Thanks for sharing, this sounds interesting, can’t wait to see more :+1:

Have you had a look at Triplex yet? At my current job we’re using it to create schemas at run time, it’s worked great so far and has a very simple / easy to understand API, highly recommend checking it out to see if it meets your requirements.


Oh, cool. I hadn’t. That uses the prefix functionality in Ecto. One of my upcoming posts will probably cover how I implemented something similar. Triplex will be useful reference. And I should consider using it for my project honestly.

Hey! Triplex creator here. Your post is pretty nice! When I get time I will investigate on using that kind of dynamic repos with triplex, I suppose both probably could work well together.


Cool, good to see more peoole who’ve dug into this :slight_smile: