A clojure mini-framework to build dashboards inspired by dashing.
A lot of plumbing work goes into building a dashboard. Setting up a dashboard involves the following challenges:
- Fetching data
- Scheduling data retrieval
- Transferring data to the client
- Visualizing
- Deployment
Data source, used for fetching data, is just a clojure function! The scheduler will run the function and broadcast the result to the client side as per the schedule. We take care of caching the data so that a client who joins later can immediately use the last results available.
In order to periodically update the dashboard with the latest data, every data source can optionally have a schedule. Data gets fetched and sent to the client at the configured intervals.
Here is an example configuration for a data source with schedule,
{
:name :sample-dashboard-stats
:read-fn :sample-dashboard.fetcher/fetch
:params ["multunus" "dashboard-clj"]
:schedule {
:in [0 :seconds]
:every [5 :minutes]}}
Sente is a great websocket library that we use to broadcast the data fetched by every data source to the clients. On the client side, we use re-frame, and the data will be cached on the client - this happens under the hood. The widgets will be re-rendered when data changes on the client side. So, no confguration is required here.
We are still trying to improve this part. We are shipping a basic layout(react grid layout) but not any widgets yet. We found that widgets and their look and feel vary greatly, and we are still pondering over a good common set of widgets to ship.
Since widgets are just reagent components, they are easy to create. Above all, tons of great libraries can be found here. In addition, the reagent cookbook talks in depth on how to setup common libraries.
We can host this dashboard on Heroku in no time! Read about it here.
![Screenshot] (https://db.tt/Z5WnyEpj)
dashboard-clj is maintained and funded by Multunus Software Pvt. Ltd. The names and logos for Multunus are trademarks of Multunus Software Pvt. Ltd.
We built this as part of learning Clojure in our 20% time. We will be supporting this library during our investment time and using it to create internal dashboards at Multunus.