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.

13 Likes

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?

4 Likes

Sad you forecast a final Brasil Spain…

4 Likes

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:

3 Likes