Dashborg Documentation / Docs / Getting Started

Getting Started

Initial Setup

To get started you’ll only need a Go/Python development environment, and the Dashborg SDK.

The Dashborg SDK is availble on github at https://github.com/sawka/dashborg-go-sdk.

go get github.com/sawka/dashborg-go-sdk

The Python SDK is availble on github at https://github.com/sawka/dashborg-python-sdk.

pip install dashborg-python-sdk

Dashborg Hello World

The code below is the complete code for your first Dashborg program. Copy and paste it into a new file (demo.go or demo.py).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
    "github.com/sawka/dashborg-go-sdk/pkg/dash"
    "github.com/sawka/dashborg-go-sdk/pkg/dashcloud"
)

const HTML = `
<app ui="dashborg">
    <h1>Hello World</h1>
</app>
`

func main() {
    config := &dashcloud.Config{ProcName: "hello-world", AnonAcc: true, AutoKeygen: true}
    client, _ := dashcloud.MakeClient(config)
    app, _ := client.OpenApp("hello-world")
    app.SetOfflineModeType(dash.OfflineModeEnable)
    app.SetHtml(HTML)
    client.WriteApp(app)
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import asyncio
import dashborg

async def root_handler(req):
    req.set_html("<panel><h1>Hello World</h1></panel>")

async def main():
    config = dashborg.Config(proc_name="demo", anon_acc=True, auto_keygen=True)
    await dashborg.start_proc_client(config)
    await dashborg.register_panel_handler("default", "/", root_handler)
    while True:
        await asyncio.sleep(1)

asyncio.run(main())

Now run the program:

go run demo.go
python demo.py

You should see output that looks similar to:

DashborgCloudClient KeyFile:dashborg-client.key CertFile:dashborg-client.crt AccId:[YOUR-ACCOUNT-ID] SHA-256:[YOUR-PUBLIC-KEY-SHA256]
DashborgCloudClient Connected, AccId:[YOUR-ACCOUNT-ID] Zone:default
DashborgCloudClient App Link [hello-world]: https://acc-[ACCID].console.dashborg.net/app/hello-world?jwt=[LONG-JWT-KEY]

Copy and paste your panel link (console.dashborg.net) into your browser to see your live dashboard!

Hello World Dashboard Panel

That’s it, you’ve created a new unregistered Dashborg account and defined your first Dashborg App!

All Dashborg apps require authentication. By default you account will require a valid JWT token (which is output when you Write or Connect your app). By default that JWT token will provide access to your account for 24-hours. To create a new token, re-run your app or call config.MakeAccountJWT().

JWT tokens are great for testing and debugging your first apps (or for integration with existing admin consoles), but password or user-login based authentication, which can be configured in the Dashborg UI, is much more convenient for end-users and production apps.