mssantosdev

mssantosdev

Phoenix Blog Post: LiveMatch: Building a Real-Time App for Soccer with Phoenix LiveView

This post is a guide on how Norba and I are building LiveMatch, a real-time app for soccer to follow multiple games in one place.

Most Liked

Morzaram

Morzaram

Wow, thank you for such an in-depth article. Love the usage of the videos, diagrams, and extensive code snippets of how you implemented this. Thank you!

What do you feel was the hardest part of this?
Do you feel that there could be any best practices taken from the project?

ndrean

ndrean

Sad you forecast a final Brasil Spain…

mssantosdev

mssantosdev

Thank you, @Morzaram!

What do you feel was the hardest part of this?

The most challenging part of the project so far was the Match Transmission Engine. Building it with to match all the requirements took us some time. It was rewarding because we did it entirely using the “Elixir way” - processes, supervisors etc. Also, we can easily port the engine to other sports.

We’re still working on the Distribution piece to have it working 100%, and it’s being a complex thing to do too.

Do you feel that there could be any best practices taken from the project?

I believe there are some things:

  • Reusability in the frontend with Phoenix.Components;
  • Organizing the code in Contexts, and delegating the code to “sub-contexts” from the main module of the application;
  • Communication across processes with PubSub. This + LiveViews is basically where all the magic happens;
  • An Examples module. We don’t talk about it in the post, but we have a module in the app called LiveMatch.Examples, with the main responsibility of guiding the developers on how the app works. We have functions there that populate the database with teams and matches, start and stop matches etc. It teaches how the app works by using it, like a live documentation. We grabbed the idea from Designing Elixir Systems with OTP. The simulations happening at LiveMatch are built using the Examples module.

Maybe @norbajunior can help me with some other things regarding best-practices.

Sad you forecast a final Brasil Spain…

@ndrean, after Brazil x Cameroon, I’m not so sure about that final anymore. :melting_face:

Where Next?

Popular in Blog Posts Top

ErlangSolutions
Hey all, it’s Erlang Solutions. We released loads of Elixir content from our senior developers last week in celebration of ElixirConf US...
New
aymanosman
This is a very short article about using AWS Systems Manager Parameter Store to load secret configuration in a simple way.
New
brainlid
Livebook was created for machine learning in Elixir but Livebook isn’t limited to machine learning. I found it works really well for docu...
New
brainlid
You are storing some Phoenix LiveView state in the browser. You want to retrieve that saved state as early as possible to improve the use...
New
brainlid
On your LiveView page, you are using a custom component. You want to be able to pass HTML attributes into the component, but the componen...
New
AstonJ
Update: How to use the blogs section You can post in one of the Official Blog Posts threads (like this one), or, via Devtalk and a new t...
New
StuntProgrammer
Hey there! This is the first article in what I hope will be a nice series about how I built (and am building) Lofi Limo. If you have any ...
New
stryrckt
Support for AlpineJS in LiveView was added in 0.13.3 and it works fabulously. I just wrote a blog article about it and plan another one s...
New
AstonJ
Update: How to use the blogs section You can post in one of the Official Blog Posts threads (like this one), or, via Devtalk and a new t...
New
New

Other popular topics Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement