alishir

alishir

Hi all,

I’m planning to develop a website that displays analytics reports, similar to Cloudflare Radar 2.0 or Google Analytics. I’m currently in the process of selecting a tech stack.

I looked into Plausible because it closely aligns with my project, and I noticed that it uses React for the frontend. Now that LiveView has reached version 1.0, I’d like to hear your thoughts on the best tech stack for such a website.

Would a combination of LiveView and JavaScript graph libraries like D3 be sufficient, or should I consider using React for the frontend?

Thanks a lot for your suggestions!

Showing Posts 1 to 10

cmo

cmo

Integrating D3 with LiveView is pretty straight forward.

I’m sure you can do it any tech stack. Follow your heart, i.e. use LiveView.

BartOtten

BartOtten

Not sure you noticed, but in the end it’s d3.js after all

So just for the graph features, using React seems to me like an additional layer and most React chart libs are just abstractions over d3.

There is one benefit though: these abstractions give you the 80% for 20% effort. Unless you want something the abstraction does not support; then you have rewrite straight to d3 (my previous employee had to do so)

Advice 1
I would skip all the extra work, layers and extra deployment concerns and just go with straight d3 in LiveView. Integration is easy and you are not limited by whatever abstraction.

——

About React vs LiveView for a dashboard: not sure as I haven’t done anything remotely close to the use case with LiveView. (edit) But the Phoenix Analytics project chose React, maybe they can enlighten you on their decision:

Phoenix.LiveDashboard with Phoenix.LiveDashboard.PageBuilder seems to be a LiveView solution.

Advice 2
Please do notice there is a project for “Analytics ala Google” already. Might be better to work together than to start and alternative on your own.

kevinschweikert

kevinschweikert

We recently made some protoypes for a reporting dashboard and were comparing different charting options:

I personally liked the dev experience for VegaLite because the Elixir package gives you a nice way to build the JSON spec and it’s just a simple hook for every chart, because it gets configured via the spec. But it’s missing some interactions/animations and that’s why we settled on ECharts in the end for a nicer user experience. You can push the serialized data as JSON to the hook and have it render the chart.

Let me know if you’re interested in more!

cmo

cmo

@BartOtten isn’t the Phoenix Analytics project a React frontend?

@kevinschweikert I’ve used echarts for some dashboard and animation work but have migrated the complex stuff to d3 to get more control. echarts was great until I hit that wall. Having to define your formatters on the JS side when the rest was done on the Elixir side was a bit unfortunate too.

D3 is rather confusing to learn at first, though D3 in Action and observablehq are good resources. It is rather verbose on account of being so low level, but you can create exactly what you want.

BartOtten

BartOtten

I can’t imagine a response which causes me to dodge the bullet. Auch. Fixed my post :slight_smile:

alishir

alishir OP

Thank you all for your valuable suggestions and useful resource—they’ve been incredibly helpful!

BartOtten

BartOtten

Once you made the decision, please let us know the outcome and the key factors leading you to it in return. :slight_smile:

binarytemple

binarytemple

Charts.js is very simple and pragmatic and used by my favourite website monitoring tool uptime.com I don’t know if there’s any pre existing integration with livebook but I agree it should be straightforward to integrate.

An option I’m currently evaluating, because it seems reasonable and someone (@staxx) kindly wrote a liveview plugin, is Apexcharts

https://github.com/Stax3/live_charts
https://github.com/Stax3/live_charts_demo

Seems pretty well implemented, don’t know the author, but kudos.

garrison

garrison

As an alternative, I’d like to point out that this type of analytics app is very amenable to simple bar charts rendered entirely as a series of <div style="height: XX%;" />.

Obviously if you want more complex charts then you can go with D3 or similar, but for a prototype rectangles really are hard to beat.

pelopo

pelopo

I was trying out different libraries for charts too. My main concern was the final performance and latency.

I chose eCharts out of uPlot, chart.js and eCharts.

uPlot Is by far the fastest and has the smallest memory footprint, but it’s also quite limited in the types of charge you can use. It’s mostly time series. chart.js Is the second in terms of performance, But I could not find the functionality of brush or linked charts, so it’s not an option for me.

All these three libraries use canvas. eCharts can switch between canvas and SVG.

If you go with the pure D3, be ready for it to be slower than the rest because it can only use SVG.

Now I’m trying to battle and figure out whether to use SQLite with indexed tables or DuckDB for charts.
It’s a big mind bend for me in understanding whether to connect to the databases through a direct connection or if I need to use GenServers. AI seems to suggest that GenServers are part of best practices, But with me anticipating no more than 10,000 users for my app, I really don’t want to add any overhead to the app that is not needed.
I’m pretty new to Phoenix and it’s quite a lot of headache and hustle. But I hope it’s only in the beginning until my mind wraps around it.

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews