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

brainlid
Phoenix 1.7.0 brings a lot of new things when we run mix phx.gen my_app. These new and cool ways of doing things aren’t automatically bro...
New
fredwu
Hi folks, I wrote a blog post the other day on how I built my MVP in 3 months whilst having a day job, using Elixir/Phoenix/LiveView. Th...
New
marcelo
Long story short, over the past years we’ve been scaling our operation quite a lot at Unbabel. Most of our codebase is Python and some of...
New
New
bencoppock
I write about the frustration that can occur when dealing with string and atom-based keys in maps and how to (safely) translate string-ba...
New
brainlid
Jason Stiebs shows a couple ways for a LiveView to make it easy for users to click and copy an important value to their clipboard. He sho...
New
ConnorRigby
Just finished a post for Embedded Elixir and I thought it should be cross-posted here: I’ll update this thread as posts get published. ...
New
ragamuf
A little halloween hocus-pocus on the value proposition of having a reliable test suite in place. You are not scared, are you?
New
rrrene
In this series, we take a look at the different ways to organize, structure and execute a good “flow” in our Elixir programs. The latest...
New
gaggle
This post explores different ways to do test automation in Elixir, focusing on how to handle dependency injection — covering patterns, li...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
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
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
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
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
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
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

We're in Beta

About us Mission Statement