In this episode of the Elixir Mentor Podcast, your go-to source for All Things Elixir, I'm excited to welcome Filipe Cabaco, a talented Elixir developer at Supabase, an open-source real-time database platform. Filipe has been key in enhancing Supabase's real-time capabilities, particularly Broadcast and Presence Authorization. We'll explore Supabase's Elixir-powered real-time engine, discussing how Filipe leveraged Elixir's strengths to build scalable solutions for data synchronization and user presence management. We'll examine the challenges of implementing these features in a distributed system, the role of Elixir's concurrency model and OTP, and how Supabase's offerings fit into the landscape of real-time databases. Whether you're an Elixir enthusiast, a developer considering Supabase, or curious about Elixir in production, this episode offers valuable insights into Elixir and modern database technologies. Join us for an informative conversation on the exciting developments in Elixir and real-time data management. #ElixirLang #Supabase #RealTimeData #OpenSource #DatabaseTech Connect with Filipe: X: Follow Filipe on X (Twitter) Website: Visit Filipe's Website SUPPORT ELIXIR MENTOR 🌐 My website: Visit Elixir Mentor Website 🎙 Check out my podcast: Listen to Hired Gun Apps Podcast 🆘 NEED HELP?? Join our Discord Server 🔗 All my Links: Connect with Jacob on Linktree
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Testing what's up? I'm Jacob Witso, your Elixir mentor, and welcome to another exciting episode of the Elixir Mentor Podcast. This is where we discuss everything related to Elixir, from interviews with enthusiasts, pioneers in the community, to innovative projects and library shaping. Elixir's future. Today I'm excited to have Felipe Cabassia Kabasa. Kabasa. See, I told you I'm gonna screw it up. And he's he's an elixir
developer at Super base and he's going to be here to talk about like real time features and elixir and then all the other challenges of creating scalable systems. So welcome, Felipe. Thank you so much for joining us. And can you just give us a quick little introduction about yourself? Yeah, so first of all, thank you for having me in episodes like this. I'm, I'm really humbled by it and I'm really happy to be here. I'm Philippe. I'm an Elixir developer at the moment at Superbase.
I'm currently the kind of full time developer for Superbase Real Time, which is one of the products from Superbase. And I've been working with Elixir. So first work experience was 10 years ago or 11, I can't remember. It has been a long time since kind of Elixir 1.1 or something like that. Then unfortunately I had to let go Elixir for a while. But I've came back to Elixir and I've been doing it for the last three or four years, something like that. But it, it has always been that ecosystem that's that's stuck in
my mind even in those early days. And yeah, I'm really fortunate to be working with it daily, even on my free time, which is a problem sometimes because yeah, it's just a language I truly, truly love after seeing a lot of stacks in my life. But yeah, Elixir is the one that I really want to dedicate my time at the moment. Yeah, I've converted everything that I do to use the Acer. Like everyone says, jobs are hard. You just have to kind of make your own jobs sometimes.
Almost, yeah. It's insane the amount of things I kind of go. Where can I kind of introduce Elixir into this? Even if I need to do any kind of JS code? Isn't there a way to do this in live view or something else before actually going into into JavaScript plans? Exactly. Well, I I hate writing JavaScript hooks because it just it like makes me rack my. I used to write JavaScript every single day of my life and I for the for the life of me, I have so much trouble now writing I I can't remember the syntax, but
I've just always been searching tags. Yeah, when you language flop a lot you have to always just Google. Like what's a for loop again? Oh yeah, and I I don't even think it's if you're language flopping a lot, it's more on the side of Google is the best skill of NEC in your developer. That's true. Well, like I always, I always say like I like my memory is garbage too, so I'll always forget things. But like I'll Google it and I can like refresh my memory really quick. So I like to think that's that's a skill. So what are like you said?
So you've been involved with Elixir from the very start, almost. What got your attention on like the? Elixir when I had the I was working in in in a separate company again almost 12 years ago or 11 years ago and I was working with Scala at the time and I came from a Java world. I've heard about Scala. Scala was promised to be the better Java that that existed and part of the Scala ecosystem. They kind of pushed a lot the
idea of using AKA. AKA was a library for active pattern for Scala. So Scala also has pattern matching and then you have actor pattern on top of it. And I went, OK, yeah, this is quite good. And at that time the Elixir whispers started to appear. I I think it in Necker news and stuff like that. And then it kind of I got interested in it. I got really lucky. I jumped jobs, I got into a job
where they were actually starting to do Elixir. They did a knot system with Elixir and yeah, I was able to code a bit for that. And yeah, my mind got completely blown away coming from you have a JVM with Doctor pattern. Now you have everything without any dependency. Was a bunch of other good things attached to it. It's just it just blew my mind. And since then, I'm kind of all in in the. Ecosystem when I first started like touching Elixir and figuring things out because I'm
coming from, you know, object oriented world, JavaScript, a lot of TypeScript. I I do like, you know, the type systems, but when I finally wrap my head around pattern matching and like the pipe operator mind was blowing, I was sold. Like that's when the syntax became fun to write. And. You don't ever look back. Even recently so attached to the, the work I'm doing for real time, I'm, I need to kind of, I'm working on Postgres
replication, basically consuming the wall file. And well, Postgres has kind of a really tricky protocol, which is basically just a giant binary with information. And again, it's one of those things where pattern matching shines so brightly that it it's insane. And Andre Leopoldi actually has a really good video, a bunch of videos about using Gen. TCP to actually do proto hackers, if I'm not mistaken. And it kind of showcases how good the elixir pattern matching is for this lower level kind of
stuff. So even just having that arrow sign arrow sign is this AW, yes, it is AW. This is the character W. So I know this is this type of message so I can consume it in this certain way. That alone is a superpower that I can't even, well, I can imagine in other languages. But it will be a switch case, a bunch of ifs. It'll just be too annoying instead of just being a function. Assume it's done. It's brilliant.
Yeah, no, I could have met like, yeah, writing that in a different language. Just a nasty nested tree of conditionals. Exactly. Exactly. And even the string manipulation of get me the first first character. Cool. Now get me everything else. Get me the one to 3233 to 62 or whatever kind of getting those ranges in the Elixir world is pattern matching pattern and Python is a substring. You go it's a slice.
It becomes way trickier to do anything. So yeah, I'm that's the kind of things that really pulled me into into Elixir. Yeah, I love that. Now you mentioned you're working on like the real time features of Super Bass, right? What does that, what does that mean? Like what is your day-to-day role? What kind of projects are you working on? So some time ago actually, someone in Twitter said Super Bass is selling Phoenix channels as a product. In a way, it's kind of that.
So we're using Phoenix. Phoenix as you know is an obstruction called channels, which is stupidly useful and we actually are potentially selling it. We're basically have a pusher kind of service where we let people subscribe to Superbase to the to real time and broadcast via web sockets. And we also use Phoenix presence. So even if you look into the pages of our SO in real time, the real time documentation for
in supervised, there's a section called protocol. You can even see the BHX under score join. We really, we really are using Phoenix. Then we add the couple of extra layers on top of it, namely there's a now there's an authorization element to it where before connection, before upgrading the Websocket, the HTTP request to Websocket, we actually do a quick check against the database because we use RLS policies from post quest to actually check if the user can connect or not.
So we added that that layer. And there's another another thing we also do which is post quest changes. Post quest changes. It's basically a pulling. We pull from the wall file what actions the the user did, inserts, updates, deletes for certain tables, and we just broadcast that to the user. This is extremely useful as you can imagine. For example, if you have a front end and you want to see, I don't know, new notifications you could do, I want to trigger on every insert to the table
notifications and you'll just receive that almost instantly. And that's the service we're giving to users. OK, if you had to like explain super base for people that don't know what it is, what would be like your couple sentence summary of what it is? We did sell it as open source Firebase for a long time. I think it's a bit more than that because I really like the tag line that couple. Our CEO actually uses it, which is just Postgres. We really like to focus the idea that we're just using Postgres
and then we have some satellite services around it that will enable you to do back end as a service really well. One of our best products, it's authorization, which basically kills it in terms of pricing, in terms of scalability. We we really have a, we had examples during the AI boom, I'm not sure if we're still in it, but during the AI boom we had customers that went from basically zero to 1,000,000 users in a couple of days and supervise had no problem
churning that it's completely fine and it could actually do more. So auth was one of the projects that does really well. The storage, it's basically the same. It's OK, you have Postgres. How can we enable you to use Postgres? If you had the storage kind of service on the site, you have it there. But we, the idea is really we just create satellite, satellite services around Postgres. But Postgres is the beating guards which is extremely useful for any back end developer and even front end developers because then you can have a really good bridge between OK,
I've done my front end, I've done my POC or even my full product in this, but I want to optimize small toggles of it. Then you can do that optimization in the Postgres world, which really makes it way simpler than having something closed source. You can install an extension because you're not limited. You can add remove indexes if you go really nitty gritty, which probably will see a performance improvement in your app without much hassle. And that, I think that's the biggest win.
It's the fact that we're just Postgres with a bunch of satellite services and fully available, which is extremely useful. And yeah, that's kind of what supervises. It's Postgres with satellite services that enables you to build your back end as a service or be the back be the database for your service because we allow direct connections without any kind of issue. Now Superbase is open source, right? Do you see a lot of like outside contributors to it or is it more
of a you can trust what we're doing initiative like now we do? We do, we do have. I think we see more contributions on the client lips for sure, because that's probably where people will feel most of the pains. But we do seek other kinds of contributions. For example, even real time we had a bunch of contributions to facilitate a bit the self hosting because we had some configuration files that were not the best for self hosting.
And that's, that's scenario we want to keep improving. And we yeah, we had the external contributions of let me change this and that. Let me just load this new MVAR. There's always small, small contributions. We we do see them more on the client lip side again probably closer to the user, closer to their pains. Yeah, that makes sense. There's other contributions, there's more contributions in the community. Well, and that's probably a huge benefit to the open source too. Is then on the more user side of things.
If you're not implementing every front end stack, someone else can do it for you. Yeah, it's extremely useful. And again, since you can, let's imagine that you find a bug in the client Lib, but you don't know where the error comes from. Basically, something the server is returning doesn't make sense. If it's open source, I can go OK, what kindly am I working? Am I working on edge functions? Cool. If it's in edge functions, what's the the repo for edge function functions? It's this one. OK then I can look into the code.
This is the error that it's throwing when I'm doing this call. You can open an issue and just be more informed of what the hell is happening behind the scenes. And I'm really glad that I'm seeing more and more companies going open source because this kind of open source is actually a big superpower. Because then if your users are more informed, they'll also be more your, your troubles will also be easier to fix, right? Because they'll know, OK, I know that your server is returning this kind of error on this certain endpoint when something
doesn't happen. It doesn't make sense on my use case, why is this happening? And then you can go in and say, yeah, that's, that's a bug. It's way faster than I mean a close, a close black box of I've sent something, I've received something that doesn't make sense. Good luck. So it's truly a superpower. Yeah, I am always on the fence about like I like when I hear this use case, I was like, yeah, open source makes sense. And then there's sometimes like when I have like projects that I feel kind of leverage and give me a little bit of advantage
over competitors, I'm like, well, should I open source it? And I'm always, I'm always on the fence. Like I'm always like, yes and no. And I'm so close to making both decisions all the time. I think that the the the wind there is more on the side of maintaining something isn't free, right? For example, you can sell folks, supervise, there's nothing. Basically supervise gives you the the keys to the Kingdom. Do whatever you want. The thing is, at that point you need to maintain your Postgres, you need to maintain off, you
need to maintain real time edge, edge functions, storage, there's a bunch of services surrounding it that you need to maintain. We try to make it as simple as possible by giving you as much configuration as you need, but it doesn't invalidate the scenario of you need to have digital ocean pods. I don't know if they call them bots, droplets, that's it. You need yeah, you need the droplet for this, for that, for that you need to connect everything. There's some effort into that that's probably more expensive than for example, the the pro tier, which probably will cover
most of the cases. I think that's the biggest problem is people think that it's easy to do this, this kind of stuff. And I think there's a, I think there's a fallacy here, which is if I open source it, people will deploy them by themselves. But most of the people don't want to handle that for imagine that you have your open source product selling at $20.00 a month. That's way cheaper than I don't know.
Now I have a droplet. Now I have this. Now I need to do the networking. Now I need to do everything else around it to actually make it work. Yeah, exactly. Well, like I, I'm a big fan of plausible for analytics. Yeah, and they, they have the same model, right. But you start to look into it and hosting your own analytic server. It's just a lot easier to integrate what they offer. Exactly. It's, it's always that idea of you need to balance hours of work and how much you cost.
So let's imagine an average salary of, I don't know, 100K that divided by hours dedicated to that work. You probably have paid, you probably would have paid one year of of a pro tier, for example. And that's the kind of thing that people should measure and understand that probably it's not that big of a problem to open source and just be there and even open sourcing. Imagine that you open source a project and people actually deploy them by deploy it by themselves.
And then they see it's really easy to maintain it to to kind of keep it up. They see that they're just spending a lot of time on it. OK, it's better to switch to the cloud version of it. OK, cool, easy. Just change the URL, change the API key, potentially give us whatever you need to migrate and you're done. Meaning that even to for customer acquiring kind can kind of be a big benefit because then they'll see, OK, I'm taking too much time managing this while I could be just paying $25 and be done with. It Yeah, they finally see the
benefit. Of yeah. Yeah, letting, letting you hold the the reins. Yeah, takes more than anything. Yeah, for sure. Well I think people underestimate the amount of work behind like just DevOps alone and server setup and maintenance and. Yeah, I that's actually a good segue for one of the things that we've talked a bit about before starting the stream was distribution and the leaks here and all of that. And we can actually go in a bit
into that because it's one of the pains that real time has to suffer. Yeah, just like keeping data synced and everything across every node. Yeah, I I'm not too familiar because like I feel like most of my projects I haven't had they're, they're not big enough, right. So I think a big benefit, but also I don't get to experience the headaches of a distributed systems right, is you can vertically scale a lot before
you need to do anything else. And then like when speed and other things become issues around the the world, you have to. Be able to have to distribute we suffer with those problems. For example, with AWS is actually not bad. We for example from London to Sydney, since they have a lot of money and underground cables, it basically takes 203 hundred milliseconds for something to reach the other side of the world, which it's quite impressive. But honestly more impressive for
me is the fact that Elixir basically is able to connect all of those regions without any problem. That's the other big win that we see. To give you a bit of context, we're deployed in AWS. We're using Farlite, I think that's the name of it, of Fargate, one of those from AWS, which basically just ramp UPS a bunch of a bunch of pods. It's basically managed Kubernetes. And we have, if I'm not mistaken, 6 regions. So we have two in the US, two in
Europe, 2 in Asia. Yeah, I think that's it, each one of them. The number of the number of nodes depends, but it's if I'm not mistaken, in the US we have 3 per per region. So US is 1 and US West one if I'm not mistaken. So yeah, in total we have not that many nodes because as you've mentioned, we can actually scale up vertically quite well. It's more a case of redundancy and being sure that, yeah, we don't drop messages. The beauty of it is all of those
nodes are connected. So imagine that. Why we are we doing this? We want to be as close as possible to your database. Since we are just postgres and we want to consume information from your database. The best way to do it is the node needs to be as close as possible to your database. And so if you ramp up database from supervise on the US, it wouldn't make sense for the customer to do the full round trip of I connect real time via websocket. This node connects to your
database, goes back and just keeps doing this loop, which is but way bigger and it would need more connections against the tenant database. Potentially you'd have dozens of connections just to cater a couple of users. So what real time does is we connect to the closest database you have, we consume from that, and then we broadcast to every Elixir nodes that's connected to that machine.
Which means that. So imagine user A as a database on the US. User B is connecting from Europe. They connect to the web socket in Europe, which makes the round trip way faster for them. The user in the US connects to the node in the US, but whenever a change happens, the node from the US sends the information, broadcast information to the node in Europe, which then broadcasts to the connected user in in Europe.
This makes everything really fast and we can see that improvement easily because then you're not using. Go ahead, go ahead. Sorry, when you, So when you have all your different nodes in different regions, what kind of latency are you seeing between changes? Like what kind, what kind of systems do you have to put in place to make sure like synchronization of data and stuff since everything is real time? Like someone in Asia changes maybe the same thing that I
change at the same time And like how do you handle things like that, like race conditions or? Most of it again, since we're since it's only one node connecting it, that kind of fixes a lot of the problems, right? Yeah. Because since there's only one consumption nodes that that node then broadcasts to everyone everything else. OK. It kind of works really well. Plus, since we're using Elixir, there's a module from Erlin called RPC, and we basically use that for communication. And it does, it works really
well. It's basically just do something in another node and it just works. It's extremely useful. And to give you another example of the RPC usage you mentioned that again using the user in Europe tries to connect to something in the US, we we try to optimize the number of connections we do so we only keep alive the connection for 5 minutes. If no user appears after 5 minutes, we just disconnect from the database because we don't want to consume resources from
the user. It's annoying for them, it's annoying for us, it's annoying for everyone to just keep that hanging post W connection, so we kill it. But now imagine that we need to a user connects to the to from Europe to a database that is in the US. What happens then is we basically from a node, the Elixir nodes in Europe, we send an RPC call to the node in the US, the right node in the US to actually connect to the database, and it does this automatically via RPC.
OK. So it's it's overpowered and all of it without any special kind of Lib. The only Lib we use for that is special. We can go into that in a bit, but other than that special that I'll probably mention in a bit. Everything else is just pure Elixir, pure Erlang, nothing different. And other than that also Phoenix Pubsub that uses the PG nodes, which is basically a registry of processes that you can send
messages and register to topics and so on. Again, another Erlang super power more than anything. That kind of, we can talk about that a little bit that kind of falls into the topic of like event driven architecture. And I'm sure with Super Bass that's what you're doing a lot 1 just communicating with Postgres and then all your distributed nodes, correct? Yeah, yeah. So again, most of the the communication is done via pops
up. So it's always subscribe to this topic, send it. And again, that's something Elixir, mainly Phoenix with the the PG module abstracts really well, because then it's a question of I want to subscribe to this channel and I want to broadcast. We also use events for our internal usage where basically say, OK, there's a maintenance thing which is cash invalidation. For example, we use cash X Cash X is the distributed cash that that that Lib that's again is
made in Elixir and a lot of it is just our length. We use cache X to distribute the cache across nodes. And when we need to invalidate something, we just broadcast the message, consume that message and each node will say, OK, cool, now it's time to invalidate the cache in cache X done. It becomes really simple to just do this kind of operations because again, Phoenix pub sub is there and even if not PG is there. It's it's really powerful. And again, it's fully event
driven in the sense of there's a giant server that will receive an undelee info at some point as long as you subscribe to it. And that again, it's just it's, it's easy compared to everything else I've seen in the past. It's just way, way simpler. So a lot of super basis superpowers you're just inheriting from Erlang essentially completely. To give you another example, there's a really good module, this is a lid for Merlin called SYN, which is we use it as
eventually consistent name registry. So as you know, you have the normal registry where you just want to register your process with a specific name. For example, when you do dynamic supervisor or something like that. CN is kind of the distributed approach for that. So imagine you will need a, a name registry that can be shared across the globe to ensure that you only have one process for that one specific use case, which is the usage of I want one process connected to the tenant
database, to the database of the user. And that's how we do it. It's basically every node will know that OK, there's a process for this. Who do I need to contact? It's this guy. This guy will talk with the database. And again, this needs to be eventually consistent, consistent. Otherwise if you use something like global or easy or something like that, it would need to reach to that point. So potentially we'd have more errors than anything. And there it's one of the points where scalability and distribution becomes a problem.
It's when you have this distances and you expect, OK, my web socket shouldn't take 200 milliseconds to connect. When you enter in a site with a web socket, it should be instant. Then eventually consistency will help you in that regard where eventually that that connection will happen. But when it happens, it's it the user is already there. So you kind of take advantage of some of the latency for your advantage. And you don't need to, yeah, you don't need to rely on synchronous elements to actually achieve it, which is extremely
useful. And I do advise to check out the talk from some WhatsApp developers. They had a really good talk about using what they've learned about using RPC in A11. No, sorry, 1000 node cluster, something like that. OK. And even they said something along the lines of the first thing we did was disable global because global was reaching its limits, so can you? Can you explain what what global
means a little bit for everyone? So yeah, global, it's the. It's the same as the process registry, but completely distributed across all nodes. Oh, OK. Yeah, yeah, yeah, yeah. Gotcha. It's that when there's a way for you to also in dynamic supervisor, you can say I want to register via global and you give it the the the tuple and it basically says OK, I've registered it. That's that's interesting that that they hit limitations at 10,000 on that or is there is
there a reason for it? They had, well, it's WhatsApp, they had the turn of load and I think when they were bought by Facebook, it kind of goes a bit into that. They stopped to be able to scale that much vertically because they're now under Facebook servers. They had more limitations. They even mentioned that before they were using, I think it's open BSD, they were using and they had to switch to Debian. So they had a bunch of limitations on the move to Facebook that actually made them
not be able to scale vertically. And they have to scale way more vertically, vertically, horizontally, sorry, which meant more nodes, which means that every nodes, if they're all connected, there's a lot of networking happening there across multiple regions, across multiple data centers, some failing, some not failing. So there's a big Vance of data going around. And again, connections, since everything is connecting to everything, it kind of becomes, I don't know that's. Actually, I feel like that is a
really good example of why it's like so much more powerful to vertically scale versus horizontally scale, at least for like the Beam VM, you know, like that's. I can give you, I can give you an example that for in our case, our machines are quite powerful, but they're not the top end thing. But we still have, we are completely over capacity honestly, not over capacity,
sorry, over provisions. We just want to be sure that the service doesn't fail basically. But it's, I remember, yeah, I think it was Pinterest, they mentioned that they went from I don't know how many servers to two or three servers. And most of it was just for resiliency. It's basically if one server goes down for some reason, the load balancer knows how to point to something else. And even on that story you have stuff like how easy it is. So in other languages, if you, if you try to do a cluster, what
do you do? It's you might scale horizontally, but you'll need the message buffer in the middle, some sort of Rabbit MQ or Kafka or some magic. Usually you have a Redis that needs to be distributed. And then you need to deal with Redis distribution plus Rabbit distribution plus your servers because your language is not made to actually scale in that way. It's made to scale vertically while it's not ready for that. And that's when you get the auxiliary systems, the the full
industry of Rabbit, MQS, Kafkas, Reddies, memcache, a bunch of things while in Elixir with the only thing we have is full squares. That's it. It's what Sasa Yurik and Dennis talk that that table of other languages. I want to do cash reddies what we what we use in Elixir ETS cache X you choose basically. Yeah, exactly. I want to do distribution, other languages, Kubernetes, nomad, whatever you've got to delix
your world, then you'll just do node connect. That's it. Yeah. Well, that's why like DevOps becomes such a it's it's your sole career. Like there's so many technologies you have to know when you start a distributed system with like a node JS app, like it's insane. Like the complexity behind it is so much. It is, it is. And again, Elixir kind of removes a lot of those layers and that for me, I honestly believe it's one of the biggest wins.
As I mentioned, we are, we do use Kubernetes in a way because AWS kind of forces forces us to do because we want to use Fargate which is much easier to deploy than I want to provision an EC2 instance and do all the VPNs required and all of the AWS suite of products. Not going to say that probably we won't do it in the future, but I don't think it's worth the development time at the moment. Again, that win, lose kind of situation. My, I always have this concern and maybe like I am being dramatic, but I always worry
about the when you step away from micro services like AWS, you have a lot more development costs because you kind of you get so tied in and interconnected, you're like stuck. Yeah, in in our scenario, it's not that difficult. Again, it's basically a Docker image. Since we don't have first of all, we don't do micro services real time. It's a monolith that is able to. So that's another tenant of of supervisors that I really like. Basically we have a rule that
whenever you develop a system, it should be an independent system. It might well it might and it will probably use Postgres most likely, but it shouldn't be coupled to supervise. You shouldn't say I need supervise to run my service. If you're doing that, that's that project won't go up. That project will be killed as soon as possible because again, we want to do modular elements that connect to post res and not modular elements that connect to supervise. Smart.
I like that. It's really good because then your development also focus on that approach of OK, I I really want a piece of a puzzle that is modular and imagine that for some reason real time is not worth it and supervise kills it. It's possible. It's completely feasible. At that point, no other products from supervise will depend on it. Meaning that you have this decoupled element that could die without any problem. So you you don't have that tight coupling with your own services. So it's not a micro service, micro service per SE.
It's just a module you connect against, supervise. And it's a really, it's a really smart move. I never thought it in that sense before joining Superbase. But doing this kind of modular service, it's way smarter because again, you can, you can you decouple your products from your from everything else. It's stupidly powerful. I really really like it. So you're kind of looking at every feature that Superbase Superbase adds as a module versus a feature that's getting put in a giant monolith project.
Exactly. And we even do, we kind of do it as a separate product almost. You have supervised and you have supervised real time. You have supervised and you have supervised auth every we need to connect really well or better yet, supervised really needs to know what to handle us, but we shouldn't try to do the other way around. You know what right? It's if our API is good for supervisor, it will be good for someone else. And that's the goal we should achieve it's everyone else
should be able to use this easily and you can use real time without supervisor. You just do insert a tenant. This is my database run it that's it. And again, this also helps a lot on the on the element of deployment, right? CICD kind of flows because then it you also package everything as a single thing. It's this is my Docker container done here, here it is. This is the end bars you need to configure. Done. It just becomes way easier to do this kind of stuff. Yeah, no, I really like that
that decoupling method. Now it has me thinking about my projects and I need to approach some of them a little different. Yeah, it will. You'll always fall into the sense of there will be a monolith in the middle, which is in this case supervised. The the supervised repo that will know how to communicate with that modular element. But for that repo, imagine again real time gets deleted. For them, it's a code delete of all the APIs that are called
real time, the UI. But technically that's it. The world continues to go around because there's no big dependencies on it. I like that. Well, you were a big part of the real time project, right? Yeah. So the real time project was started actually by our CEOI think that was, that was his first project for supervise. That's our CEO. And I think our CTO kind of were working on this idea of bulk consumption and they chose Elixir.
Then I think it they hired people, supervise, got some money and they were able to OK, now we're going to do off real time will go to a proper team and real time started. So on that development we had Chase, we had Stars and we had Winbow. So 3 developers from supervised and they were the ones starting and ramping up the project. And then on both of real time for the last year and something around that. OK, awesome, 'cause I know what
kind of got my attention to like wanting you to come on the podcast was you shared an example of a feature you just finished with real time I believe, and I'm trying to remember what it was now, 'cause. My brain, yeah, it's the authorization, authorization layer. OK, Yeah. So you want to you want to explain what you did there and like any big hurdles you ran into using Elixir or anything that you had overcome? Honestly, the biggest hurdle was not in the the Elixir side again, Oh, there was, there was
one hurdle there. There is one word hurdle. We are not able to use Ecto. We need to use post Grex directly because we're doing some stuff that it's a bit more well closer to the to the post Grex Postgres protocol and queries and Ecto does not abstract as we need. Plus we we would need to manage a lot of Vecto instance well. We can only have one Ecto instance, meaning that we'd need to do repo dot with dynamic which is a way to kind of let
let Ecto take over another connection, but we'd need to do that for thousands of databases that are connection connected. So we just. It isn't. Again. It's tricky, but it isn't because again, since Post Grex, post Grex itself, the basis of Vecto with Postgres, it's really well constructed. It's really solid. There's not a lot of problems using it. It's more the size of you need to build queries almost by hand. I think that's the biggest
problem. Fortunately, we actually had the pen test and we passed so. That's good. I was, I was going to say like, that's the scariest part for developers if they're writing their own queries. Yeah. It's really scary because I just. Had I had Michael Lubis on again? Yeah, I think it was just last week. Yeah, yeah. But yeah, he's paraxial. And we were talking about that like basically, like if you're not using Ecto in your Phoenix projects, gotta rethink your life. No, avoid it. Avoid, avoid running away from
Ecto. I I fully agree with that. I fully, I'm fully on that boat. Unfortunately, we had some caveats for this product that we're not not able to do. Well, yeah, you're doing a little bit of a different thing too and you're kind of providing a very low level service and. Yeah, yeah, that's the tricky part. So the idea of the the feature itself beforehand, real time, if you wanted to do the Pusher kind of service where you just connect to Websocket and receive and send messages, there was no
good security around it. That's the reality. If you have the only way you could secure it, it's that classical computer engineer which is generated UI DV4 and hope no one, no one finds it. That's it. That's the only security we had. And of course users were not happy with that. It was a feature requested that we should protect our channels in some other way. So what we did is since we depend on Postgres for a lot of our things, including node discovery, we can also go a bit
into that afterwards, since we use Postgres for a lot of things, we decided, and there's another product from supervisors that did this in the past, which is storage. So basically they use RLS as a way to verify authorization of the assets you can access. So imagine that you have a picture of yourself and you say I don't want anyone else other than your e-mail to access this one. So that's basically we did something similar for real time.
What we do is we when you connect, upon connection we get your JWT token as a user, we'll load it to the database, all the claims that are important for this and all of that. So you can actually use it in a query. And then you set up a non or less policy query where you say OK I for the topic XI only want users with this role to connect and if you're able to do that then the websocket gets
upgraded, you connect and you can receive messages. Otherwise the socket will be killed completely. OK. Which is good for us because then we don't spend resources on that specific connection, plus we secure the channel automatically. Yeah, and I love that. That's awesome. It it it's kind of tricky because we actually need to add messages. There's a table that we kind of need to emulate for a bit, that there's something there so we can test is this user able to access it, yes or no.
If they're not, then we basically kill the connection. OK, but. So you have a like a temporary no authenticated web socket connection and then. You yeah, in this case, no, no, because it it never, it never reaches the web socket upgrade. So you have an HTTP, you have the HTTP one O 1. I think that's the upgrades call sign something like that. The status code you have that it reaches Phoenix. Phoenix goes through cowboy.
Still we haven't upgraded to Bandit. It goes through cowboy. Cowboy tries to do the normal flow of how do I upgrade this websocket? It goes through the flow of is this user XY and Z goes against RLS policies. It reaches a point of this user doesn't have permissions to kill this process and it goes back. So you you wrote like a plug to enter a plug that it like. OK, yeah. And for if you guys are new to Elixir, plugs are very similar to like like middleware and
other things. They can intercept your connections a little bit. Yeah. Wreck. So yeah, very cool. I love that. And so that was your how long have you worked at Superbase? Is that kind of your first project? No, no, no. I've worked at supervise. I think it will be two years in November, something like that. I did AI did a couple of things. So before this, what did I do? There's a supervise bought another company called Log Flare dot app, which was built by
Chase. It also uses Elixir. And there I did. So we use Bigquery on log flare, but this for self hosting is a pain. It's a big pain for you to kind of, OK, I want to self host or I want to run it locally with logs. So what do you need to do? You'd need to have a big query key and that alone kills local development, for example. So one of the efforts I had to help out with was instead of basically connect the log flare kind of ingestion, transform
that into Postscript. That's basically what I had to do. And there I started with a really convoluted solution. But in that scenario we were able to run away from that later with some contributions from another member of the team. And that's an example of repo with dynamic. So basically removed a bunch of really bad code. I did honestly not in hindsight to actually use Ecto and it worked really well and but that
was one of one of the things I did. I also did JRP. Sorry, no tell ingestion for log flare. So basically just consume open telemetry with log flare. That one is still under development. There's some caveats we need to to iron out, mainly also with the interface, because log flare at the moment shows a lot of logs we don't have to trace view that would need probably would be needed and other elements around it. And that's also was not that
difficult. The difficult part was actually load balancers of Google Cloud because since Open Telemetry uses JRPC and that JRPC uses HTTP 2 to keep a connection alive, load balancers start to mess a bit when it comes to that. But yeah, I've I've worked with several things. I'm trying to remember more things on real the real real time side, but my time has been so focused on on this specific feature that I don't remember
anything else other than what I'm working on at the moment. Yeah, I get that. My brain. Yeah, goes to Bush. Yeah. And then when you go to look at old projects you like, who wrote this code? Yeah, and then you find out it was you. That's me daily. There was actually another fun one which was at the beginning we had a bunch of problems where sometimes the the database it's not available yet. So let's imagine that the the person has changed to the compute instance or does
something that basically blocks the database from doing actions. And we did have a problem of user connects to the websockets and after a bit they get disconnected or they see errors or something like that. And the that happened when the database wasn't ready to actually start consuming information. So one of the things we did was, yeah, just add a layer of let's check if the connection is available. And if it's available, let's keep that connection on the process memory.
So we can basically distribute it to whoever needs it. And that's one of the things that uses SIM. OK, this might be I might be like going completely off off topic here, but it just entered my head if like so I don't use super base if I'm creating like a a new schema, how do how do I handle like my data migrations and things like that with super Bass? Is it through a dashboard or like? What no you can use.
You can use migrations. So for example, echo migrations would work because you connect directly to the database. OK, cool. That's nice. So every yeah, it's the same as using postgres from your docker container kind. Of gotcha. OK, cool. Because I always were like, I like I know we talked about this briefly. I got a bad taste in my mouth because I, I used Firebase like pretty much when it like first came out and I at first I thought it was the coolest thing ever. This was before I started like working on back ends and like
understanding how databases work and all of that. So I was like, this is magical. I can just build my front end iOS app and connect and then you quickly run into fast limitations, at least with Firebase. So I kind of like abandoned those systems. To be fair, they they were revolutionary for their time that what they brought was they were insane that being able to launch that and getting this, the the scale they got completely justified. But yeah, I I do believe that
it's better when you use something that already existed was rest in this case. And if you open source it even better because then you can really simplify a lot the level of your your clients. Yeah, it's just a better paradigm of development. Yeah, I, I think like, yeah, I, I, I don't want to, I'm not trying to trash Firebase because I do think it was like a really, it was really awesome. I think they just kind of lack in the ability to customize like
customizable things. So you outgrow it. You can outgrow it really quickly. Yeah, yeah, yeah, yeah, you can. You can. And part of that is also due to the the storage, the kind of storage they have being I think it's closer to document storage. And stuff like that doesn't help because most I've worked in companies that use Mongo for example and Mongo DB. Again, really good, really useful until you reach a point of how do I join stuff. Yeah, Mongo. DB. It's like the the go to for like
it's the cool start up solution, right? And it's nice because you don't have the the structure you have right? You can just like add new tables, you don't have to worry about migrations and all. Of that until until you have to worry about them. Until you have to worry about. Well, until you want migrations, right? Exactly. I think they're really good products until a certain scale, right? If you have a team of three engineers that know how to communicate between each other, then honestly go with a simpler solution.
Probably you don't need. You don't need a schema, That's fine. You can also do no schema on on Postgres, and at least then you have a way to migrate out of it. But again, if that's your cup of tea, completely fine. You'll do you. Well, yeah, you could leverage, you could leverage just Postgres air handling, right, Instead of using like Ecto or schemas or the change that I I suppose. You could go through the Pines if you want to, basically. Yeah, I don't think people understand how good they have it
with Ecto, that's all. No, no, no, no. Yeah, again, from a large amount of experience on other languages, Ecto has been the best because I've worked with Hibernate, I've worked with active records, I've worked with whatever Jungle gives you. I've worked with a bunch of Orms and I hated all of them because I've discovered really quickly that modelling your your domain to your database it's not always
the best idea. Ecto gives you the best of all worlds, kind of. Because yeah, you can still get your model really close to the database, but then you can start to dvate if needed. With embedded fields. You don't need to OK my I, I don't want to expose everything in my object. That's fine. You just write the scheme as you want. Even if your migration as 1000 fields, if your object only needs 10, you can have those 10 and nothing else. So that coupling of your object structure and your database
structure, it's extremely useful and something that has been a lot of people Juke for example, for Java also did this and it was way better, a way better experience. And it's just just a pattern that works really well. Plus that decoupling also helps on the query sides. I love the fact that we have flexible querying that can be attached to the, to your schema or really quickly can be completely detached. And you can do I, I just want to
select one field. Why do I need everything? Yeah. Exactly. So good. Well, and just like the speed of postgres queries is amazing. Too. Oh, yeah, yeah, yeah, yeah. It's just. Magically get that like I don't, I'm not going to act like I know what's going on there, but I I like the performance. Yeah, it's, and again, it's since it's all done behind reps whenever you have a Rep Necto connection, you actually have a connection pool. That connection pool is managed
for you. You never have to deal with it until the day you'll see OK, your connection. You're you're taking too long to check out connections. Easy, just increase the pool and you don't need to kind of do any kind of tuning other than increase the pool. That's it. It's it's just becomes a really powerful option. So with only I don't want to put an RM, it's not an RM. It's just the best live I've used for database connections easily.
Yeah, So what happens to you? Like, let's say tomorrow Elixir doesn't exist anymore. What would you do with yourself? I'll go to world Languor Gleam. I'll just no I if the beam stopped existing, I'd probably I'd still keep the functional paradigm for sure. I probably run to close your arms and and just feel the embrace of closure or even try to go for F#. I'll just I just want to keep
the closure, the functional programming on my side because it's the the the paradigm that really quick with me. I agree and Elixir was my first taste of functional programming and I think it forces you. Like I think a lot of people you either have like an engineering brain where you naturally break processes and like tasks apart step to step. But I think when people don't have that they struggle learning how to program, especially in object oriented programming.
And I think functional almost forces you to think that way. So I feel like the ability to pick up a programming would be a lot faster if you start on a functional language. I do agree, and some universities actually do that. For example in Portugal I think 3 universities actually start with Lisps and Scheme if I'm not mistaken and they actually do functional programming as a first language, which is. And again I do fully agree with you, the fact the way functional programming makes you think it's what transformations do I need
to apply? What functions do I need to input into this to result in that? What what do I need to do to the meat to become a sausage basically? Everything you're doing in a mutable language, like you should be writing functions like you do with functional programming, right? But you end up doing all these nasty things and you have these functions that do multiple things and you just make very complicated things happen. And you're, you're not.
You're changing global data over and over, and you're doing all these nasty bad habits that you don't realize are as bad as they are until it's a problem. And you can see people really want to do functional programming, even JS and TypeScript. There's a lot of discussions of I want to do XY and Z in a functional way, I want to do a pipeline of transformations. What do I need to do? But then it becomes that issue of the language is not built for that intent. So for example, I remember some years ago we had the front end that was using immutable dot JS
and there was actually a memory leak because of it, where since we were trying to do functional programming, the memory just bloated completely because there were objects that kept piling up and piling up. Oh, I see, because it was kind of just like a wrapper. To clone, clone. Yeah. Oh, Dang, yeah, bro. But yeah, I don't know, like I don't think I ever want to go back because I think it it just introduces nasty habits.
Yeah, yeah, yeah. And even, for example, state management isn't easy and state management in Elixir, I could say it is, it's easy, but it's also not easy because you need, there's multiple paradigms you can use. You can use ETS as a global storage, you can use the process memory, you can use agents, you can use persistent term. There's multiple facets of storage state storage in memory for Elixir and none of the every.
It kind of shows how difficult this problem is. You need multiple ways of doing it, but at least you web those tools. If I need a bag of things that needs to be accessed by any process, I have ETS. If I need to do that but I need that to be distributed, I have Magnesia. There's a bunch of tools within the the language itself and the beam that simplify everything. So yeah, like if I have to live Elixir, I'll be really sad, yeah. I would too.
I'd be I'd probably like become a photographer like. No, I'll go. I'll go with the farmer route. I'll probably just farming. Just I could, I could do that too. That would be a dream. Big lot of land and just disappear. Yeah, I'll just go. I'm done. Yeah, I was. Yo, yeah. If you're new to Elixir too, avoid. I know people are, I get hated on this because I know like a big reason people come to Elixir is OTP, Genservers, all that stuff. But until you understand the
functional paradigm, well, don't touch processes and things 'cause you're gonna start using them for the wrong, wrong reasons, 'cause you're gonna want, you're gonna want global state. So you're gonna just do something nasty and do something that you shouldn't be doing? That's true. And, and that's a really good call out because the biggest issue I've seen in in a lot of companies that try to adopt Elixir is everything becomes a Genserver. Everything becomes a Genserver until someone has that light bulb moment of why am I doing
this? Why do I need to start a process for this? This could be just a pipeline of transformations and get out. That's it. Well, like you know, I I like created a like a my like first project with Elixer. It was a marketplace for personal trainers to sell courses and things, but so it was like there was a lot going on, video streaming, all of that stuff, but I didn't write a Genserver.
For. 2 1/2 years, like I was just, yeah, I was just using Elixir and you know, figuring that out because I was still trying to force weird object oriented things into my project. So it was probably good I didn't touch 10 servers or processes. How many behaviors and how many depth protocols did you try? I think I started on behaviors. Yeah, it was bad. That's the first thing. Everyone that can comes from
from object oriented will always go for the. This could be an interface. How do I do that, you know? Well, and it's really hard too. I struggled with the mind shift because you're like, OK, I know how to do it in JavaScript now how do I find the equivalent? And like a lot of times you have to accept there's just not an equivalent. There's just the functional way. Exactly, and it's tricky to do that jump. There was actually, I can't
remember the surname Queen. She's a really good Elixir developer. She has a talk in YouTube, something like Atlas of Protocols, something like that. And I really like the way she she presented that talk because it kind of what what's done in that talk. It's they've used Elixir protocols, which struck really closely to what Golang does the duct typing from Golang.
And you can it's actually a really powerful abstraction that really gets close to object oriented because then you can do similar to what go does. You can say something along the lines of I have a post res connection. Cool. What's my implementation to connect to post to to just do DB connect if it's the post res structure and then you do the implementation. OK, for post res I know that I need to do post Grex. But now let's imagine that you have a structure that defines the connection information for MySQL you could do the same and
but you keep that interface of. I have something called DB connection dot start. How does that dot start? How is it implemented for Oscars? How it is implemented for MySQL? So it really becomes close to what Golang does and it opens another door of if you are from Object Orient and then you want to try Elixir. You could use protocols actually and it will probably be closer to home than using behaviors. It's quite interesting. So it's, yeah, it's see, I also have AI have trouble remembering
how to do things in like Swift and JavaScript now too. But it would be very close to interfaces then at that point, right? Yeah, yeah, yeah, yeah. But it's quite fun. Yeah, no, we actually have a question that might be a fun one to answer. How does Elixir's Beam VM optimize memory and CPU usage during high concurrency? So first of all, memory. It's quite interesting. Again, being a functional
programming language, this is probably a fact that it's not that well publicized, but it should be. Erlang is built with the functional paradigm, so every element of it, every structure is actually a rope structure. Basically, it's just constructive. It's a tree of changes, and it knows how to prune those changes when they're no longer referenced. And that alone is a big performance improvement in terms of memory that for example, the one I've mentioned of JS and immutable JS is not able to do because you clone the full
object, you clone the full element with Turlang you are able to do this in a memory efficient way because of that basically knows how to prune the tree of changes until you reach a certain point. So it's it's called rope structures if I'm not mistaken. And it's really good. The other cool thing in terms of memory, it's cool and not cool each process, since it has its own, its own thing, it's its own wrapped process. It's just a, a beautiful package
of ET memory, stack memory, everything memory. And that means that each process does have an impact on your memory. So you could actually overextend and store too much in the process. And I've seen this happen. And for that you should optimize and say, OK, in my process, I should only store, for example, my ID, my reference, my smaller elements, and not full blown structures full of lists and stuff like that. You should be really careful on what you actually give the
process because otherwise you'll probably reach your memory really fast. So that's one of the caveats. It's really cool because if you keep that abstraction of everything is within this box, I have this beautiful box with my compute and my memory and everything. But that box can expand really fast if you're not careful about your starting unit. So that's one caveat of processes. Still, they are really if if you actually see the amount of memory they use, it's really small until you add your stuff. So again, Erlang optimized this
really, really far because Erlang was used in systems that were not powerful. The idea was really to be used as. Well, like processes alone are very tiny like. That's why. That's why Erlang the BEAM can flex like millions of processes concurrently. Exactly, right, exactly. And to to like engineers back in what? When was Erlang like 79? I don't know. I think it's starting 90 something I. Think. It has.
It has been open source since the 90s. I think it's something like that. OK, so, but engineers back then like you guys, they were so smart because I'm so I'm, I'm in, I'm I'm reading through this architecture book for creating like multiplayer, like MMO game servers. And we lost good engineers somewhere along the way. So we got to bring that back because these guys were building like tribes and World of
Warcraft and things on like 24 kilobyte a second Internet connections and you barely had like latency and issues. Like it is so impressive what they could accomplish back then. Yeah, and we cry with 100 megabytes a second I. Know we, we now we just, you know, faster Internet, more RAM and we just keep throwing, throwing power and resources at our problems. Memory leak just. More RAM guys. I'll just give it more RAM.
There's actually a really good flex from Erlang that shows all processes, for example, are really lean. The Nerves project the fact that you can actually run Erlang, a version of Erlang, in bare bones. Like an embedded. Raspberry Pi and embedded circuit. There's even smaller than Raspberry Pi. You can run it with really low memory and it's still the BEAM, You still have some of the niceties of it, you still have processes and it's there and it shows that yeah, you don't need to go full blown big CPU to use Elixir or Erlang. The and the question also
mentioned the CPU. There's a really piece of magic in the BEAM, which is the way they did schedulers. And that for me is a dark magic. There's a full Erlang talk about it, but the idea is if you if you open there's one tool within the the repple called observer. If you do colon observer dot start, it will show basically a dashboard for for the BIM VM.
And if you move it to there's a list of processes that are running and you'll see something called reductions. If I'm not mistaken. What it does, it's basically the the the scheduler understands what's the process that's using more reductions and allocates more time of CPU for those and knows how to turn off processes. So imagine, imagine kind of bringing it to the infrastructure world. Imagine scale to 0. You have processes that are able to just disappear from the CPU until they are called, and this
is done automatically with some magic from the BEAM. But the idea is if a certain process has been not doing anything for a while, what the Erlang does is shut down that process. It will keep the state, it will keep everything, and on the 1st message it will OK, I need to wake up this process with almost zero. There's it's less than nanoseconds. It will wake up that process, do the processing it needs, and imagine that after 10 seconds it doesn't do anything.
OK, I'll kill it. And that's why, for example, Elixir is really good for millions and millions of processes, because it's really good with this distribution of compute time. It's really good that this process is doing way more than this. I'll allocate more CPU to for this one to finish the task, and I'll keep giving a bit of CPU to the others. And you're able to do a lot with it. Plus it also takes over the full CPU. You don't need to. I was having this conversation recently. It's like a built in load
balancer. For exactly. Yeah, it's beautiful. I was talking with this recently with a couple of friends, which is again, I've worked in the Rails world and most of the times to scale up Rails, what do you need is basically fork the full process. It's, you have inside the a server, you have 10 instances of Rails running. I'm not sure if it's like this anymore, but at least from what I've understood, it's still a bit like this, but correct me if I'm wrong and I hope it changed a bit. But before it was, there's a
fork, there's a fork, there's a fork. And it's basically the full OS process. And that actually takes a lot of resources, right? If you're basically loading everything and probably you don't need to load everything, processes are that in a way leaner way. And it's it's almost an abstraction on top of your operating system. That's how I feel at least. And again, there's a lot of correlations between the infrastructure world and Beam. It's like you've said, it's you have a load balancer that knows how to distribute work. You will have a garbage
collector that basically goes process by process and says you're not using this, get out. There's a scale to 0 component that knows, OK, the scheduler knows that this guy isn't doing anything, so stop giving it resources if it doesn't need it to. And again, there's a lot of optimizations like that and the Yogi team, they're just insanely good. It's I don't even know what kind of magic they did. It's like you said, there's
engineers that are just way above genius. I I don't understand what they did, but it's beautiful. Yeah, I've accepted that I'm not one of those. I'm really good at using. Tools. Of other smart people. But I know my limitations, you know? But Erlang's debut, Tamir said it was 1986. I should remember that because it's a year younger than me. But 86? So it's about to do, what, 30 years in a couple of years?
38 years. Yeah. So, yeah, it's we're talking about the language. That's the other thing that I disagree with a lot of comments, which is have you used it in production? Who is using it in production? Well, the roots of the BVM have been used in production since 86. It's it's older than JDM. Well, it was, it was our phone system. Phone systems essentially, right? So. So it was our phone system. Cisco actually said that 96
percent, 96% of the traffic, the traffic worldwide for their routers actually goes through Erlang. So their routers actually had Erlang in the embedded in it. There was also Call of Duty. Infinity Ward actually used Erlang for their servers. There's a dark paper hidden somewhere from Devcon from 2000 and something Nintendo used Erlang with Ajabert and notification systems.
Pepsi uses it. There's a, that's the the caveat of it, which we're talking about generations of developers that that actually have used it. And people kind of insist that no, no one uses this specific thing. And honestly, it's kind of a lie. Probably they don't use Elixir, but Thurlang itself has been used for the longest time. It's a really solid language. If you don't want to do Elixir to Whirlang, it's good anyway. It's a really good language. And again, it's just the VM
itself. Again, it's older than JVM because Java was developed in the 90s. It's older than JavaScript because JavaScript was developed by Netscape if I'm not mistaken at 96 or 94 or something like that. Yeah, I think 94 sounds about. Right, right. I think it was something like that. So from all the languages we use and say you don't use it in broad. Well, actually Erlang is the oldest probably that we that. And let's be honest, JavaScript shouldn't have gone as far as it has. There's hope it was them I
guess, but but yeah, I, I, I do believe that there's a bit of a, a, a sunken cost fallacy that and that makes sense. Honestly. You, you don't want to get to a company and when you arrive there, I want to rewrite everything in a leaks here. There's a big reason not to do that, of course, which is there's costs to that. How much how how long does it take to migrate the whole system? But it reaches a point of, again, sunken cost fallacy of it's making money.
It's been like this for three years. It's full of bugs. We spend more time fixing bugs than actually doing development, but it's making money. At that point, you kind of need to think about it and go, should I refactor it? Should I change it? Even if you keep the same stack. Yeah, just. Think about that. That's the worst cycle, too. And like I've been on teams where you know, the you can't afford to do a full rewrite and you're sitting there instead of implementing new features, you're fixing bugs and then the
like to, to add new features. It's almost impossible because of like certain code architecture and things that are already happening. So you get in this weird paradigm where new features take four times longer than they should, and then you introduce more bugs. And then you have that bug that keeps popping up again and again after you fix it. That's the worst. That's, and again, that's another thing where I where I truly believe that functional programming kind of helps because a lot of the bugs I've seen in my my life were most of
them was global state. That's normally what it is. You have a. Yeah, you have side effects. Usually you have a side effect and a race condition that's really hard to replicate, and you don't run into it enough, but you run into it enough that it's a problem. Exactly. And again, most of the bugs I've fixed in my life probably were due to that bad state management changes that happened in a in a time you didn't expect. And yeah, it it's tough that happens because the world is not
doesn't use a single clock. It's different everywhere it. Actually reminds me of a really nasty bug the like the last like iOS job that I had. We had a well I inherited a crazy codebase that took me. I don't even think I I knew everything that was going on with it and I was there like 3 years, but I was trying to fix a bug. So I was tracking down things, doing putting logs everywhere, and the biggest mistake I made was to assume a Singleton was a
Singleton. And when I finally discovered that it wasn't implementing as a Singleton, I found out that we were creating like thousands of processes and we couldn't figure out why our state was getting out of sync. And like, sometimes it wasn't sync, sometimes it wasn't because we weren't controlling what instance of the Singleton we were calling. It was such a nightmare. That that, that that has a special element of evil calling a Singleton and not being a Singleton, that's special.
I know, and to like you would assume like and when you like looked at it, it was set up as a Singleton. Like it should be good to go. But something I don't remember what it was, but I had to do like a minor tweak and then found out it was actually like a a Swift related bug. And then once we once we figured out why the Singleton wasn't implementing, we fixed the major problem. But it was one of those things that was horrible. I was like, I was like looking at a memory map and I was like,
we have like it. It was just like a non-stop Infinity growing singletons, right. And I like that's also a big problem with like how powerful phones are and our computers like things like that. Like that's essentially a really bad memory leak. Yeah, yeah, yeah it. Is they're they're hard to find sometimes. They're hard to find, they're difficult to replicate, and they might take one minute or one hour to actually. Reach that point exactly and.
That that's really difficult when you have for example, long running processes. I've worked in companies where the memory leak existed and it was the job of someone to restart the machine. Oh gosh, yeah. Because it was a long running process. And now imagine this for a data pipeline where you're just constantly ingesting data. You cannot stop and you have memory leaks everywhere, or you even just have one memory leak. It's hell on earth. That's why, again, there's a lot of vates against VMS. That's one of the things that
VMS do really well. And for example, Go also does it really well. The fact that you don't need to do memory management. For me it's almost mandatory in a language. Yeah, it it's not fun to have to deal with garbage collecting manually, Yeah. Yeah, at least for 90% of the problems in the world that we try to solve that there's no need for full blown memory control basically. And again, Elixir really shines
on that because it's something you never think about. Basically it's you create a struct. No, there's no malloc, no free, no nothing. Yeah, exactly. Plus the fact that it's almost 40 year olds VM, it's highly optimized for that. It's highly optimized for memory. Again, it just shows how good Joe Armstrong and the other guys did the VM that they did. It's insanely good. Yeah, it's incredible. Honestly, we are very lucky.
Yeah, completely. I don't know if you want to circle back around, but I know you wanted to talk about dynamic nodes are. Yeah. So we can actually talk a bit about node discovery. Yeah, Node discover that was it. One of the things that people see kind of as a deterrent to not use the leaks here in a clustered way is actually no discovery.
Chris Mccart did already an awesome job with this that he released DNS cluster, which is and it comes with Phoenix. If you do mix Phoenix, mix Phoenix install, it will come with the DNS cluster Lib and it's just name discovery with, well, DNS. So if you set up everything correctly, you just need to say point me, point me to this, this, and this address and the node automatically connects.
We couldn't do this with the West because we don't have name discovery for the the nodes itself. We're basically using IPD 6. So what we did was instead of using that, we used Leap Cluster, which is a great leap to actually connect Elixir nodes. And we do Leap Cluster with our own adapter that we've released open source, which is using Postgres. Postgres has the listen notify commands where you can basically broadcast using Postgres and you use that to listen.
So we when we ramp up a node, we start that listening module of I'm waiting for a message from the reminder of my of my cluster. The other nodes basically understand something new is trying to connect. They send their IP via Postgres and the node that tried to join just knows to OK, I need to connect to this, to this, to this, to this, to this. So again, another abstraction that in other languages would be I need Kubernetes, I need to set
up Helm. I think that's Helm that does the orchestration of service, ABC, etcetera. You kind of go around all of that. It's nodes connecting to nodes via IP connections, TCP connections purely. And again, it shows that even those elements are quite easy. They're not easy. They're close, closest to easy. They're not a big a big problem. And again, if you use, for example, if you have name discovery on your nodes, for example, fly does have name
discovery. So they have names for each one of your machines. You can just do the DNS clustering for service discovery and they'll basically automatically connect and reconnect if they die. It's extremely useful. It's it's basically zero costs for the Elixir side. And one of the advantages here is, again, if you look into the WhatsApp conversation, the WhatsApp presentation I've talked about earlier, they actually do this for they have specialized notes.
So we imagine you have a cluster of Elixir machines. They're all connected, they're all happy. They're all really happy with what with what they're doing. But one does mathematics, the other does grammar, the other one does AI, whatever. What you can do is actually, since you can name them and you can group them in, in clusters of things they can do, you can actually say, OK, I'm a web worker, I want to do a grammar thing. OK, then call the grammar cluster and let one of the nodes pick the job and do it. Cool, they'll do it.
They'll return the answer. So you can kind of do specialized nodes. You can do node balancing between them of when someone sends a message you can do it. Even a really simple thing where you say OK my CPU load is 80 -, 60 -, 40 cool. Then I send I'll send it to the 40, the one that has 40 CPU loads. Is that something you have to manage or is it? That that would be something you need to manage, yeah. OK. But again, it's kind of low cost ish because then it's just RPC calls going back and forward. You could do OK, me as the web web guy, I'm going to send to
the grammar guy. What's your load 8040 something cool. The note that responded with the less I'll send the RPC call. I really want to do focused on this task. So and and we're talking about potentially 10 lines of code to actually do this because it's just messages going back and forward quite easily. Which is wild because that just shows you the efficiency you can have on a team to just staying in like the Beam VM or like
Elixir in Phoenix. You can go a lot further with fewer developers. Which is. Great for startups, you know. Again, I'm I'm currently managing a system, I'm doing support, I'm doing development, I'm doing client leaves and I'm I'm basically doing also planning of what's the next feature and stuff like that. I have my manager and we basically are async and I tell him, look, I need help with XNZI ask another two colleagues for code reviews basically and they'll code review everything.
But other than that, I'm basically alone maintaining it. OK, how many Elixir developers at super base? We don't have a lot. So we have 123, my manager for 5th and a fifth one that is joining and I think that's it. I think it's in the company 6 people. Oh no, actually now it's more. There's another one that knows
there. We've had two, two or three people that sign from snaplets and they also know Elixir. So we kind of doubled the number of people that know Elixir in the company. Yeah, that's awesome. But like you can, you're probably all getting a ton done though because. Of Oh yeah, yeah, yeah, yeah, yeah. Especially if you're like you said, you're kind of siloed on your projects. So I'm assuming that's how every Elixir developer is, then they all have their own. Projects, everyone is kind of everyone is doing their own thing. And again, for example, one of our projects, it's called
Supervisor. Supervisor is a connection Pooler for Postgres and it's many thousands and thousands and thousands of active clients. It's in scientifically almost every connection made against supervisor, it's going through that connection Pooler. And at the moment it's a single developer doing it. We're getting the second developer there to kind of help speed up and even maintenance work. But again, it's insane what you
can do with a single developer if you are on the right step, which we do believe we are for this kind of use case. Yeah, I mean, I tell everyone too that if you're a single dev, build your product in the pedal stack, you know, completely, completely, you can accomplish so much. Yeah. And we haven't, we don't touch that much in live view because if we actually needed to do front end stuff, live view also helps with a lot. For example, Log Flare, which is the the company that supervised
bot, the only company supervised bot, which is basically a logging service. We do use live view and we use it with React, live React, something like that. And again, that single developer is able to do front end work, is able to do back end work. And live view is a big chunk of OK. I can remove a lot of things from my from my world, including state management, because since state management is done on the server, it's done with good primitives, it's done with, I want to keep this in the process
memory, I want to keep this in ETS, etcetera, etcetera. You remove a lot of the barriers for front end developments. That's why I really think live view is one of the best obstructions that came out in the last years. And everyone else is kind of also looking into it as yeah, they're right. That's why we have live wire for PHP turbo and dot wire for rails and they just keep appearing. Yeah for sure. Well I mean the speed of the server side rendering and not fully updating everything is
live views. You know. Yeah, I always avoided. So I was an iOS developer, but then I kind of transformed to back end development with APIs and all that and I avoided front end web development. You should play it again. You should. Play it again because I hated it but then yeah, I started it again because my YouTube channel everyone wanted me to do like a live views, live view stuff. So I kind of like I I'd created like a gist clone and it's me kind of learning live view as I.
Build a project. But like it's great, like I enjoy like my my weakest part of front end development is like just knowing tailwind, honestly. But then every everything else is so easy. I, I I'm in the same field, basically whenever I do live view, I have one, one side with PS code, the other side with tailwind ducks. Yeah, that's. That's that sounds about right. But yeah, Tailwind is like my slow down for sure.
Everything else is so easy. Yeah. And for example, I'm, I'm kind of building a side project with a friend at the moment, of course using live view. And I the the biggest problem is exactly that when you need to do UI, the biggest problem is not the live view part, it's styling it. That's the annoying part. Now, yeah, my. Patience, my patience with styling and then like nothing works the same in Safari. I was like how do web developers deal with this on a daily basis? I hate it. It's basically acceptance.
I, I, I think it gets to a point of OK, yeah, we're not using this as a feature. Let's move to something else and then. Yeah, exactly like it. Like, yeah, 'cause I built now like Elixir mentor.com, that's live view, hired gun apps.com that's live view. And I have a bunch of new clients now 'cause I built like a a website hosting platform. Oh, nice in Phoenix and it's it's working fantastic. And so now I have all these
websites that are built in live view and they're they're all working great. So it's awesome. Yeah, no pain, right? Yeah, no pain. I have, I have a small block of my own and it's really small, no traffic or nothing. But I haven't touched the server for, I don't know, one year. That's amazing, I think. And it doesn't go down at all. And that's one of the things that, for example, real time, we also see the advantage. I'm the one maintaining real time. I might be speaking too much because usually when a person a
person says this there, there will be an incident just. Knock on wood, really quick. Yeah, you won't. But The thing is, there's a lot of self healing elements to it, right? That's the IT actually brings to another problem we actually had. That could be an interesting discussion. But since we Erlang gives you supervisors and processes and whatsoever all of that, the the idea of the supervision tree of I know how to self heal. It's extremely, extremely, extremely valuable.
I think it says as daily almost for sure, because any error or bug that the system doesn't know how to interpret, it just kills the process and brings it back up and that's it. And itself heals most of the time we did have. And now comes the interesting part and one of the caveats of the of using Postgreqs instead of Vecto, which was since we are starting the connection using postgreqs, it's actually using Postgres is a layer of multiple things.
One of them is DB connection. DB connection is actually the thing connecting to the database. Postgres is a wrapper on top of that, and what was happening was on the module where we check if the tenant database is alive, we do. We open a Postgres connection, we try to do something. OK, it worked. We tried to run migrations and for that we use actor with dynamic. So there's some caveats there, but since it kills the connection, we can do it. But yeah, it tried to run the migrations.
Migrations failed for some reason and it would go in a loop and in a loop and in a loop. So at some points we'd see just a spike on the number of processes created. The problem was, there's multiple ways for you to shut down a process, and this is probably an important lesson for anyone trying to do. Processes. So you kind of you had like a runaway, runaway process just getting kind of like my Singleton problem, but with processes. Similar to your Singleton problem. Similar to the immutable JS of
just creating stuff for the beam. Yeah, yeah. But. It didn't kill the server. What happened was it spiked the usage for that specific client. It didn't kill the service, but it killed the database because it just created so many connections against the database that it kept failing and failing and failing WE real time and the beam doesn't flinch. And then you had kind of a waterfall effect though probably where all those processes, DB connections were failing.
Yes or no and it was just creating more and more and more but the good thing is it kind of self heals on the server. It killed the tenant database and that was the biggest problem and that's how we detected the problem. Was stupidly simple to fix and it was just they usually. Are. Yeah, it's read the read the manual. I don't want to curse, but yeah, read the manual was there. If you look into the Genserver documentation, you actually look into terminating the server and
you have two ways of doing it. During the init call back and during the end will continue and in every process. So you can, you can return OK and the state basically OK continue and whatever step you want to do continue. And if you want to stop you do a tuple of stop, colon and normal or shut down. Normal doesn't kill the the child processes, shut down kills the full tree and that was the only bug. So basically the fix was changing one line, slamming my head against the table and
saying next time read the manual before doing anything and then that's it. Yeah, well, it always is something like that, right? It is. It is. It's always that colon, that atom that we didn't know. It's just again naive, naively thinking that it solves everything. I can write a book about my naive thinking until that's where you learn everything right? You need that. You need. Yeah. You need to bang your head. No one, no one will ever be perfect coding I bet.
I hope I continue working in programming for the longest time and AI doesn't steal my job and I keep working with Elixir and whatsoever. But I know that if that's my career in the future, in 30 years, I'll, I'll still do really stupid mistakes. It's part of the human nature to do mistakes like you just. Won't do ones you've already made. Well. Hopefully. Well, yeah, we'll. See. Or you'll be like, oh shoot, I remember I did this 20 years ago exactly. But it'll be faster at solving it.
It shows, but it shows that there's consequences with choosing Elixir, there's consequences of. There's still things you need to know about. All things work, but again, it's a difference between one line of code basically changing the tuple and OK, now I need to backtrack and Is it on Redis? Is it on Rabbit MQ? Is it on Postgres? Is it on the rail server one? Is it on rail? You need to to find a bug in a
ton of abstractions while in Elixir. If something blows up in real time, there's only two things, either it's Postgres or Elixir. And the the visibility tools for Elixir are really good. So it kind of becomes easy. OK, I see that there's a ramp up in processes. What could have triggered that? I go into into live dashboard, which we use. So we actually use live dashboard for us and I've even added a tab to do process stamp of everything. It's I've added the custom tab
of give me all the your length terms and download the file telling me this is the full process tree. So I can debug it locally and understand what's creating too much processes, what's the tree looking like? So even even to find a bug, there's really easy ways for you to do it versus I don't know, like I can't even remember profiling tools for other for other languages. That work in production well I think like web dev in general usually sucks for profiling tools. Yeah, it's tricky. Yeah, you either you only
profile it on the browser. Exactly. Then it's too late. And then like now, Xcode had really good tools, but Xcode is a conversation of why you hate Xcode for numerous other reasons. But I will say like, yeah, debugging with Elixir, I actually that would make really good YouTube content going through some of that, like how to see all your processes, how to see what's happening. It would because again, it it it feels like a dark magic, but if you look into it, it's the
easiest thing ever for to get to get the process done. It's basically process list and Erlang. Erlang. It's not binary to to turn to binary. So it's 22 simple commands and it will dump you a list of tuples. It's ugly, but it's able you're able to to do work on it and that's it. And it's it's not that difficult to do and you can even develop tools around it.
Imagine that you want a tool suite of I want to understand all my supervision tree works and grows and does things. Then you could even have a Cron process that just dumps this to, I don't know, with servers like whatever just dumps and you can look, OK, I see that during this time of day there's a lot of processes. So maybe it's not a good time for deployment. You can even do processes around it. So it's quite interesting what you can do and really low codes. It's not a lot of a lot of code to get this information. That's actually really smart,
like dynamically do process or tasks around how many processes are running. Yeah, yeah. And it can simplify a lot of things. For example, from those processes, I can, I can tell you that at this time of day I have X amount of connected users via websockets because what they are using, it's cowboy. So I just need to count the number of processes that I have, the spec of cowboy and that's it. So there's a bunch of small things you can do, even analytics on top of it. There are just quick helpers
that you can have in a, in a module. You can even do it in. I just do like Cron jobs right And just assume no one, not as many people are using my services at like 24 AM or whatever it is and you know, you just run your tasks. But I really like the the dynamic approach you could actually approach. It could be a. If you have a Cron job you could sell, you could tell that's OK. My thresholds to do this task is 10 connected users. Then it's not a problem. OK, check how many connections connected users exist.
If it's more than ten stop. Then we will do it at another time. Yeah, I love that. That's a great idea. See, now I have more work to do and. To give you a bit more work, there's also the approach of odd code reloading, which is a world that it's awesome. And I need to like I I'm aware of it but I have not used it. Supervisor the the one of our things uses it because since it's a connection pool, you
cannot kill the connection pool of a customer willingly, right? So we actually. Well, you shouldn't you? Can you shouldn't? You shouldn't. You can, but you shouldn't. It will open tickets and it's just annoying for the customer. Yeah. Yeah. And The thing is, so Staz, one of the developers here at Supervise, he came from the early world and he's just magical. He actually developed the full thing on his own where
supervisor, when he when he wants to update supervisor, he checks if the connection is alive. If the connection is alive, don't do anything. When the connection goes down, it basically reloads the module for that specific process. So then the user doesn't get disconnected, but that the next time they connect they'll already have the new version of the of the module. You can do a dance, a dance of dynamic loading, dynamically loading modules with the states being moved from 1:00 to the other. It's it's again magic that gives
you. With like now that I have like my little website hosting platform, I need to do that. That would be awesome. You could say 0 down, 0 downtime, almost high availability, there's no maintenance maintenance window because everything can be done dynamically. And for example for the hosting, if it's a hosting hosting website, probably if you just do autcode reloading, they wouldn't even notice, right? Mostly as well, it wouldn't update the module till no one's
connected to that specific module, right? Yeah, yeah. Or you could just update them all and since you're using live view they would just remount and continue their life. It will depend on what you want to do, because if they're using live view and doing dynamic stuff then you'd want to retain the state because there might be state within that live view that you don't want to mess with it. Well, there's both. So I would say the majority of my websites are just static so that it doesn't matter as much there. But I do have, I do have live
view stuff for like blogs, podcasts, things like that. In those scenarios, yeah, you can still look into, OK, I I'll retain the state and even move the state. You can tell that my recipe to move from version one to version 2 is I'll grab the state, I'll transform the state in this way and I'll push it to the version 2 and that's it. And Stars is basically doing that. He's doing some state management of, I'm going from this flow to this, from this module to this module in versioning.
And this is how you do it. This is how you transition to that. It's quite complex, quite, quite complex. And we, I really want to do it to real time because it's one of another app that would benefit from it. But again, it it will take time because it's not an easy. It's not an easy, yeah. I might have to reach out to you and start talking to you about it. When? Because I feel like that because I also need I also need to explore this issue. Honestly, because this is actually something I need to figure out in relatively soon so
I should dive into it, it would be. Cool if you want. Like one of those things. It's just my list of features. Another one, right? Yeah. If you go to the app Signal blog, they have a really good, I think it's three articles about what code reloading. App signal it's. App Signal, yeah, they don't give you the state management part, but they'll give you the I want to dynamically deploy things and it's basically there's a tar ball of the new code you need to load into Erlang and they show you how to
do it. Awesome, I'm going to pull that up on my browser so I don't forget. It could be a good one for you to dive in a stream. One of my hundred. That would be a great actually I could probably I could attempt to work on it live. It's not a good idea. Yeah, well, the I think like Coding live is cool. You just have to accept that you're probably going to look like an idiot at some point. Oh yeah. Yeah, yeah, Yeah.
I think that's OK. It's something I'd really like to do. But again, I, I still, it's like you said, I'm a bit afraid of I'll how I will look. But at the end of the day, I, I think everyone, even the smartest person in the world will look stupid at some point. Yeah. So I mean, people might as well know what I look like off camera. When I come. We have a, We have a question I think we both can answer if I want to.
If I want to learn what you guys know, what would you guys recommend? I read the docs. Redo docs, but there's actually a good, really good website from a future guest of yours, Peter Holridge. Peter. 'S been on here in the past too. He's he's awesome. I've worked with him at remote and it was my team LinkedIn. He's really good. There's a website calledrunelixir.com that's a really good start. The usual read the docs is also
useful because this in other languages almost is like an insult and giving you go away. I don't care. But in reality in Elixir it it changes completely if you. Elixir docs are usually really well done. I mean obviously depending if it's a it's a, if it's a library, maybe maybe not. But like the core docs are amazing. Yeah, and Ecto, even Ecto has really strong docks if you look into the tab on the so there's a space kind of a better element. And if you go to guides, Ecto as
its RAC as its Elixir as its Phoenix as them. So basically the main things you want for again for the 99% of your problems that you want to solve, those libs will give you a really good guide on what you need to do to achieve it so. And I also know a really good YouTube channel called. Elixer Mentor? Yeah, there's also that and that's the other part. I have great like I have a great basics playlist that like goes through types and like all the
stuff that you have in other languages. But we do examples and I write them out all on Elixir. So you learn like the pipe operator and immutability through examples. And then like a couple months ago I started doing live streams where I read through the getting started guides, the metaprogramming guides, the anti pattern guides. So you're just reading documentation with me and then I sit there and try to figure it out? And even your tutorial about how to build gifts, that's probably also a great reference because then you'll see state persistency, you'll see live
view, you'll see a bunch of elements of how do you actually develop an app in Elixir? And you'll, you'll start to see, OK, how do I connect this with JS in my JS world? How do I do this? And then you end up seeing, OK, it's not that difficult. I just saw how to do gist in a couple of tutorials and it, it didn't feel difficult. And if you follow along then you'll start to to find the Alta complete stuff and then. What's wild, what's wild too is seems like a cool dude. Yeah, the Elixir mentor dude,
He's really cool. But what's wild is like when you're just building a live view app, you really, you have your context layer if you use Ecto, right? So you have your CRUD operations and everything's kind of just kind of magical and you have your front end update dynamically because you don't really have to think about much. So when you learn like the the basics of event handling and mount and all of that, it's like it seems almost too easy.
Yeah, it is. It is. For example, I have in my, I was exploring how to do live view and in my blog I wanted to do something different because that's another thing I probably advise for people that want to learn. It's just do stuff. Everyone has its own learning way. So that's also a caveat. I, for example, don't read books because I'm too lazy and I get lost in words. So I have white technical books. So my way of learning is doing stuff and I wanted to try out live view.
And one of the things I did was just have a in my blog, I have a small bookmark thing and it's dynamic. If you go up and down, every other user that's in the website will see it. So and it's basically Phoenix broadcast. And I go through the blog explaining how to do it. And again, I only learned it because I did it. It's it uses Phoenix pub sub, it uses hooks from live view and again, it's just learn by doing is a really good approach, at least for for me.
I am. I am that way too. I will. I mean, I read a little bit like especially there is like a lot of limitations in Elixir. It's getting better, but it's hard to find specific topics. So if I need to learn something specific, I'll read like. I rarely will read a technical book from cover to cover, but I will go into what I need, you know, 'cause yeah, technical books will put you to sleep real quick. Yeah, but building a project is definitely the best way 'cause
even if you build it wrong, you'll eventually learn you built it wrong and you go back and fix things. Yeah, exactly, exactly. You went every bug, every toe you stub against the wall, everything you do in a in a in your application will be a learning experience without risk. And I do believe that's the best way to learn. But again, learn at your own at your. Own yeah, whatever works for you. Like people love watching me read documentation. I don't.
I personally wouldn't tune into myself reading documentation, but it's a lot of fun when people like interact with me while I'm doing it. Again, because they probably will see it with different in a different way. It's kind of an audio book. Some people connect with audio books, so it becomes easier for them to also absorb that knowledge. I think like conversation based learning is good too, right? Like us talking right now, Like I've learned a lot today and unfortunately now I have more things to do. But but but like just having
conversations with other engineers, you can learn a lot. Yeah, yeah. For example, I got lucky to present at Elixir Conf this year. And no doubt the best part about the conference is I wouldn't even say the presenting part. That's cool and all, but the best part is now I can actually mingle with people from the ecosystem I like. And you end up again, like we're having this conversation now and now we'll get out of here and need to code for the next couple of hours and open tabs and close
tabs and whatever. When you go to a conference, it's exactly the same. You will get out of there just full of ideas, full of I need to do this and that and whatsoever just to try stuff because you get completely hyped. The conversation will fill you full of theory, right? And then you have to go home and figure out how to implement. That exactly exactly. Yeah, but that's like, that's the best part, right? Because like, how many times are you so close to a problem you can't solve it and you're just beating your head against the wall and then just describing
your partner or your problem to another person? You. Solve the problem in that before you're even done and they even open their mouth like I'm an idiot. Like I do it this way. Exactly. Yeah, just talking about it makes your brain, well, piece together things in a different way. Yeah, and pull requests. Reviewing other people's code is huge. Yep, Yep, Yep, Yep. And again, open sourcing. That's one of the reasons why it's open sourcing is so good. You end up with really useful discussions.
When you're brand new, when you're learning a new language, dive into open source projects and code and you're going to like, you might not understand what you're reading. And I think that's OK because I actually think it took me a while to understand everything going on. When you see a really well written project, like I didn't really understand, you know, under score, under score module and I didn't really understand that was just passing in a module name and things like that. But when you start seeing that stuff and like reusability stuff
throughout a code base, you learn a lot. Yeah, and not not only that, it's you shouldn't be afraid of even if it's copy pasting, that's fine because for sure you'll get to a point of stuff like there's already a process with this name. Usually that's the under score under score module. under score under score pitfall is when people try to name their process with the same name as the module. You'll end up seeing that there and you go, why is it complaining about this? And then you'll see, OK, there's already a module called, there's
already a process with this name, which is the module name. So then you connect the pieces of oh damn, this just is a macro to give me the process name. It's again by hitting your wall against the code that you'll end up discovering a lot of this stuff. Yeah, and I remember like I when I first learned of Jens servers, I was like, all right, I'm going to try this out. And I was like, I couldn't. I just couldn't understand it. I was like, I this doesn't make sense to me. Why am I statically creating a
process this will never work? Like it's not ideal. But then I learned about dynamic supervisors and jenservers and, and then, and then you Start learning about how you have to have good dynamic names so you can call that process. And it's like you kind of go down a rabbit hole and you force yourself to learn things that you didn't. Know yeah and again most of it is in the docs which is. The other the docs are amazing. The I will say just go through the docs and if you want to hear the docs you know read in my voice, head over to my YouTube. Exactly.
Exactly. But awesome, you know, we've been going for like 2 hours. This it goes quick, man. Felipe, thank you so much for coming on and joining me. This was a lot of fun. I don't know if I should thank you because I have so much more work to do now. Yeah, you. You should insult me. Just say no. You've messed up my schedule completely. Yeah, now I like ADHD brain has. All these tasks. I had to get done.
But now, if anything, I'm the one that that wants to, to thank you. And again, I really think that that this kind of conversation and this kind of of of, of show, let's call it, it's important because people need to be aware of Elixir is using production. What's the caveats of using it, using it in production? There's a bunch of things that usually are not that well talked about. And this is the kind of place where this can be be talked about. And it's important that this happens. Well, I also think it's important for people to know when you're picking a tech
stack, especially if you're starting a product or a company, it there's not, you're not just picking a tool because you like that tool. You need to know your limitations and requirements of your project and I will say Elixir fits most of them but there are going to be limitations. Oh yeah, don't try to do a game in Elixir. I'm like very tempted though to try. You can, but if you want to do a game like computer game really. Yeah.
I think it will be tricky. There's no good Vulcan drivers and stuff like that. Just giving, just saying that I, I did explore that really eye level and I said, Nah, I'm going to lose too much of my life here. Oh, I might have missed a question. Let me see. Did I miss the answer to macro powered dynamic? Macro powered dynamic naming? Let me. Look if it is. What about dynamic descriptive naming similar to the via tuple
but macro powered to take name from a spec? I don't know if I understand. It don't forget on that scenario, don't forget that macros are are compile time, meaning that probably you might be able to do something with that, but I'm not sure if it would work for that. The best way for at least for naming. If you're starting the project, use the global registry and just give it a couple of your module and some attributes of a key.
Registries are also really good there's. I see. I understand the question now. Yeah. What was it? Let me read it again. What about dynamic descriptive naming? Similar to via tuple, but macro powered to take a name from a spec. So yeah, I think you'd you'd want to use global naming or like you'd have to. Have some? You'd have to have a little bit of like a config file of some sort. Yeah, then registries and and
global would be probably the best way because again, since since since you're already in runtime and macro is only on compile time, you'd probably be able to do a macro that generates the name based on whatever you need. But at that point you you might just want to go with, with registries, with global, with sin again, with other ways of registering your, your client, your process name.
Yeah, awesome. All right, guys. Thank you everyone that tuned in. Thank you so much. I hope everyone has a good weekend and thank you again Felipe for sharing. No worries, all your experience and mind with us, I appreciate it. Bye, bye. Thank you so much. See you.
Francesco Cesarini, founder of Erlang Solutions, and Allen Wyma, hosts of BEAM There, Done That, join Jacob for a live crossover of both podcasts. They trade origin stories, compare what the Erlang and Elixir...
Jason Cohen, founder of WP Engine and Smart Bear, joins Jacob to talk about his new book Hidden Multipliers. They dig into why engineers avoid marketing, the onboarding math behind SaaS trials, finding your ideal...
Filipe Cabaço, team lead on Realtime at Supabase, returns after two years to talk about his side projects: Vitro, a browser for every AI agent with a replayable timeline of what each one did, and Ampoule, which packs an...
Peter Ullrich returns to talk about Pushin.eu, the European GitHub alternative he's building in Elixir. Five months in, it has about 700 confirmed registrations after going viral on Hacker News, and Peter walks through...
Nathan Hessler, organizer of ExMex and RBQ Conf, is back four weeks out from ExMex 2026 in Austin. We cover MCing Rails World, how he picks speakers and keynotes for a single track, what running a Ruby conference taught...