<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="234385" data-post-id="234385">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cpgo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cpgo/120/25792_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cpgo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="chasers" data-post="10" data-topic="44095">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chasers/48/14188_2.png" class="avatar"> chasers:</div>
<blockquote>
<p>Yep!!</p>
</blockquote>
</aside>
<p>Cool, I have a small demo I made using listen notify + phoenix channels when I was trying to wrap my head around listen notify. I copied most of the code from a blog post that serialized the events into a json before notifying it, with replication I dont need to serialize the data right?</p>
<p>Another question, is this a good feature to use as a foundation for an auditing library?<br>
A few days ago I complained about having to deal with how most auditing is done on rails land (using model callbacks) and on a first glance this looks like a perfect solution for that.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234385" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-234385" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234385"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="234623" data-post-id="234623">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chasers" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chasers/120/14188_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chasers
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cpgo" data-post="12" data-topic="44095">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cpgo/48/25792_2.png" class="avatar"> cpgo:</div>
<blockquote>
<p>Cool, I have a small demo I made using listen notify + phoenix channels when I was trying to wrap my head around listen notify. I copied most of the code from a blog post that serialized the events into a json before notifying it, with replication I dont need to serialize the data right?</p>
</blockquote>
</aside>
<p>You still need to deserialize it from the binary stream into a term, and then if you send it through channels you have to turn it into JSON (<a href="https://furlough.merecomplexities.com/elixir/phoenix/tutorial/2021/02/19/binary-websockets-with-elixir-phoenix.html" rel="noopener nofollow ugc">or some other binary</a> as long as the client can decode it).</p>
<p>There is <code>wal2json</code> which pushes the decoding and serialization onto the database server.</p>
<aside class="quote no-group" data-username="cpgo" data-post="12" data-topic="44095">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cpgo/48/25792_2.png" class="avatar"> cpgo:</div>
<blockquote>
<p>Another question, is this a good feature to use as a foundation for an auditing library?</p>
</blockquote>
</aside>
<p>100% I think it’s the right choice. You just monitor changes in one place. Any change to the db you know you’ll see.</p>
<p>As long as you have somewhere to store all the change data. BigQuery is a great option for that, or Clickhouse, Timescale.  If it’s not changing all that much you can use another table (just don’t track the changes for that haha).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234623" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-234623" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234623"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="234624" data-post-id="234624">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chasers" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chasers/120/14188_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chasers
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cpursley" data-post="11" data-topic="44095">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cpursley/48/25075_2.png" class="avatar"> cpursley:</div>
<blockquote>
<p>it looks like logflare.app is joining forces with Supabase (according to their blog)?</p>
</blockquote>
</aside>
<p>Yep!  Been meaning to post something here actually.</p>
<aside class="quote no-group" data-username="cpursley" data-post="11" data-topic="44095">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cpursley/48/25075_2.png" class="avatar"> cpursley:</div>
<blockquote>
<p>I’ve actually extracted out the WAL listening stuff from Supabase Realtime (which is based on Cainophile) into a package</p>
</blockquote>
</aside>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/eyes.png?v=15" title=":eyes:" class="emoji" alt=":eyes:" loading="lazy" width="20" height="20"> I’ll check it out. Sounds like you have a great setup!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234624" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-234624" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234624"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="234713" data-post-id="234713">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cpgo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cpgo/120/25792_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cpgo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Nice!<br>
I will try to find some time on the next weekends to play with this idea.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="234713" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-234713" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="234713"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="257485" data-post-id="257485">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tadasajon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/120/23216_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tadasajon
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It occurs to me that if you use Supabase for your database layer, then you not only get an auth system, but you also get multi-tenancy.  So this effectively makes your app simpler and more flexible.</p>
<p>Supabase costs $25 month, and that’s about what you have to pay just to get off the ground with a decent Postgres hosted solution for a Phoenix app anyway.</p>
<p>How is Supabase not just a hands-down winner here?  If your app needs a Postgres database and your app needs to authenticate/authorize users, then shouldn’t Supabase be the go-to choice?  What possible benefits are there to just going with a Postgres installation that doesn’t bundle an auth system?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="257485" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-257485" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="257485"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="257497" data-post-id="257497">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cmo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmo/120/19618_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cmo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Pretty sure supabase gives you API endpoints so you’re no longer using ecto to interact with a database. I assume you give up a lot of control over the database.  That might suit some people but not others.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="257497" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-257497" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="257497"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="257499" data-post-id="257499">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tadasajon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/120/23216_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tadasajon
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>From looking into it, it is not clear to me that you give up any control over the database – at least any more so than with any other hosted Postgres solution.  But I would be interested if someone can point to something specific. I don’t understand what is wrong with API endpoints – isn’t getting those for free a good thing?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="257499" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-257499" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="257499"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="257501" data-post-id="257501">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cmo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmo/120/19618_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cmo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Well you might not need them. But you’re right, you do get normal DB access in addition to the API endpoints.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="257501" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-257501" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="257501"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="259082" data-post-id="259082">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sjm" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sjm/120/24970_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sjm
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi</p>
<aside class="quote no-group" data-username="tadasajon" data-post="16" data-topic="44095">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/48/23216_2.png" class="avatar"> tadasajon:</div>
<blockquote>
<p>then you not only get an auth system, but you also get multi-tenancy.</p>
</blockquote>
</aside>
<p>can you elaborate a bit more about that part of your posting?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="259082" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-259082" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="259082"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="259220" data-post-id="259220">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tadasajon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tadasajon/120/23216_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tadasajon
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The way I understand multi-tenancy is that it allows multiple apps to use the same database.</p>
<p>If the authentication system is running inside the database, then you can write a half-dozen different front ends and you won’t have to worry about implementing an auth system each time you do that.</p>
<p>Without a database layer auth system, you can’t have a half-dozen different apps all providing different views and functionality over the same database layer without either:</p>
<ol>
<li>giving each app the database credentials and hoping they don’t mess up the data and carefully coordinating between them all</li>
</ol>
<p>or</p>
<ol start="2">
<li>bundling the half-dozen apps all within a monolith Phoenix app</li>
</ol>
<p>It seems to me that both of these approaches have a clear downside.</p>
<p>In the first case, passing out your database credentials to various short-term contractors you’ve hired and then making sure each of the half-dozen apps is careful about data and has solid auth logic is just dangerous and requires too much coordination.</p>
<p>In the second case you’re bundling code together that doesn’t really belong together, making a much more complex app, and you also cripple the ability to just use a different tech stack altogether where it may make sense for some oddball niche use-case.</p>
<p>In addition, an auth system that runs within Postgres is more secure because it is more difficult to get around (by virtue of being closer to the metal) and is also more powerful because it allows for row-level security, which allows for much more granulated control.</p>
<p>In short: using a Postgres-layer auth system is more powerful and more secure, but is also more flexible.</p>
<p>The final thing I’ll say is that the BEAM ecosystem really shines at solving a particular kind of problem – it is good for systems that need easy and scalable multi-threading along with a supervision system to make it highly reliable.</p>
<p>The BEAM was not built for writing front ends, and nor was it built to be a way to talk to a database.  It was built to reliably keep a million processes running through thick and thin.  By using a Postgres-level auth system, you can keep your BEAM code focused on what it does best while also adding flexibility, and leave the stuff it was not meant for to be done by other technologies that were in fact meant for them.</p>
<p>I’m actually curious about what I’m not understanding here – I would love to hear someone make a counter-argument to my perspective.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="259220" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/anyone-used-phoenix-supabase/44095/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-259220" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="259220"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/44095/load_more?page=3">Load more posts (25 remaining)</a>
</div></template></turbo-stream>