How to write a dashboard in Golang


(Vikram Rawat) #1

I want to learn and write dashboards in golang. Simmering like shiny and flask. What should I do. Please do reply I am a new bee.


(Christoph Berger) #2

If you are a newbie, start small. A whole Web framework is quite a mammoth task that can become quite complex, at several levels. (Just look at the feature list of Flask to see what I mean.)

Look at existing Go Web frameworks or toolchains, to see how they did it. (Buffalo comes to mind.)

If you are new to Go (and more so if you are new to programming in general), start with a small, simple, and narrowly focused project, to quickly get a first success. Then extend your project, or add other small projects, to steadily approach your goal.


(George Calianu) #3

A simple dashboard can use a web framework in frontend (eg. bootstrap) and Go in backend to serve the pages. I also suggest you to use html/template for showing pages.


(Vikram Rawat) #4

Thanks for the advice. I have started to learn d3 and buffalo. But I am not able to figure out how to change data dynamically or how the architecture should be.

I have always used shiny R for these jobs and I am trying to remove dependency on shiny server pro.

Could you please guide me what should I learn and how can I implement these things.

I know a little bit

  1. Html
  2. Css
  3. Js basics
  4. D3 basics
  5. Go basics
  6. Bootstrap and materialize css
  7. Buffalo basic

But I don’t know how to integrate them now. Please do reply. It’s a long journey I want to start ASAP.

If there are easy alternatives. Let me know I am willing to learn.


(Vikram Rawat) #6

I know how to run a buffalo app on desktop. I have done it a couple of times already.

I am not talking about desktop per se. I mean how should somebody create a web app which is a dashboard where you can show different graphs to different people.


(Vikram Rawat) #8

Thanks for replying @nurmi-labs but non of them explains the steps of writing a dashboard. It’s like a bunch of codes scattered across which I don’t understand.

I just want to know if you need to write a full fledged dashboard.

What steps would you take care of
what topics to you need to know
And how would you arrange it.

I don’t need any code. I need structure and libraries to use.


(Ignacio Gómez) #10

@vikram-rawat, I’d go with @christophberger’s advise: check your own knowledge and what’s already been written out. There are plenty of tutorials dealing with stuff like this. Some may fit, some may not, and most may be simple enough not to take in account what you are trying to do, but knowing the basic constructs may give you a huge lift towards your goal. And if those do, then we are glad to help with any issue you may encounter on the way.

Then I’d ask this: what do you mean by a dashboard? Are you thinking in a wordpress-like dashboard that abstracts coding from people building web pages (instead of having them write code)? Do you mean a Grafana like dashboard that allows you to select some data source and then build graphs/widgets/etc. over the data? Do you mean a general purpose CRUD style dashboard for an admin to build on? Etc. An answer to those questions may help you, and at the same time may help us to better respond.


(Vikram Rawat) #11

I am trying to get into data visualisation. I mean an analytical dashboard with bunch of tabs and graphs and regression lines and stuff.

Some geo data and all graphs connected to one another. Something you would do in tableau, power BI and R.

Real time updation of graphs from querying the new data from database.

I am still a learner and not from CS background. I am trying to learn things in bits and pieces and not able to connect them at a single place.

I would like to know if any of you have done something similar or how would you do it. And which libraries would recommend. So that I can learn it.

I don’t have any particular use case I am just trying to learn it.


(George Calianu) #12

Your aplication is something between a clasic one and a SPA. I will summarize the steps i think you need to release your project:

  • Write a server for your application. A simple http listener, some handlers, authenticaton, take care about sessions, maybe a middleware :thinking:, add a file server (important :point_up:), eventually use gorilla/mux) for routing.
  • Write some nested templates (in Go) to show the frontend. Here probably you need a login page and a dashboard template (bootstrap or whatever). Tip: Be careful at template delimiters when you work with frontend frameworks!
  • Write some api endpoints in backend to access the data (http handlers).
  • Query the endpoints periodically and update the frontend (you can use Angular $http directive to do this easy but is not mandatory, use whatever you know better).

(Vikram Rawat) #13

Thanks a lot

I will start it and let you know if I need any help. Thanks again


(Christoph Berger) #14

Web frameworks are not my area of expertise. What I know about Flask or Shiny is nothing more than I have read on their respective homepages.

The point I tried to make in my initial response is that you ask a couple of “big” questions (like, how the architecture should be) that have no single answer, let alone can be answered in a few lines inside a forum thread. Better break the problem down to get smaller and more specific questions for which you can find the answers more easily.


(Vikram Rawat) #15

Thanks for the reply

I don’t know what steps are needed so how can I break them into smaller chunks. But I have got some directions to look for. Once I understand more about it I would surely follow your advice.


(Kristoffer Berdal) #16

If you like functional languages, I quite like Elm for coding frontend stuff… Just started learning about it yesterday, but many of the things I like about Go are present in Elm as well :slight_smile: It’s purely for frontend development, as an alternative to Javascript.


(Vikram Rawat) #17

But javascript has more libraries to make my life easier.


(Robert Sung Wook Shin) #18

Does your mention means how to create rest-api?
If yes, could you try see below links?