Phoenix example app with foreign key multi tenancy and cluster support for genservers

Hi everyone

Not sure if this is usable and/or interesting, but I have been working on a pet project of mine, that in lack of better fantasy called “activity planner”.

Not sure if this is the place to post “show case” or repos demonstrating usage of Phoenix or Elixir, but im sure it will be ok and ignored if none is giving it any interest :wink:

It’s a basic Phoenix project with Postgres, GenServers, cluster support for genservers, Ecto multi transactions, foreign key multi tenancy, Macros to cut down the amount of repeating code etc.

Its here in all its “glory” :wink: With all my playing around with different ideas and changes, making a commit history not worthy of attention :smiley: but maybe worth for someone who wants to know why I did something.


Great job for building in public! Make sure to add it to this repo! GitHub - szTheory/real-world-phoenix: Real World Phoenix apps and their open source codebases for developers to learn from


Hello @jarlah. I’ve just found this thread with your project implementing multi tenancy using foreign key. Thanks for sharing.

I’m studying the code and noticed that you are not using the prepare_query function (here). Instead, you are using the ensure_company_id within user_auth module.

I’m wondering if you found it as a better approach than the prepare_query function on the Repo module. As I’m studying how to implement multi tenancy reading this guide, I’m trying to cover as many of the aspects related to it and learning different approaches to solve this problem.

Thanks in advance :slightly_smiling_face: