{"id":14957684,"url":"https://github.com/naturalcycles/grafana-lib","last_synced_at":"2026-01-15T22:45:28.517Z","repository":{"id":40285316,"uuid":"268375703","full_name":"NaturalCycles/grafana-lib","owner":"NaturalCycles","description":"Exposes CommonDB as Grafana Json Datasource (express middleware)","archived":false,"fork":false,"pushed_at":"2022-12-07T18:05:21.000Z","size":872,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T22:30:03.394Z","etag":null,"topics":["commondb","expressjs","grafana"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NaturalCycles.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-31T22:34:51.000Z","updated_at":"2021-11-06T14:15:50.000Z","dependencies_parsed_at":"2023-01-24T20:15:16.271Z","dependency_job_id":null,"html_url":"https://github.com/NaturalCycles/grafana-lib","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fgrafana-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fgrafana-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fgrafana-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fgrafana-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NaturalCycles","download_url":"https://codeload.github.com/NaturalCycles/grafana-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135147,"owners_count":20889421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commondb","expressjs","grafana"],"created_at":"2024-09-24T13:15:20.612Z","updated_at":"2026-01-15T22:45:28.482Z","avatar_url":"https://github.com/NaturalCycles.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## @naturalcycles/grafana-lib\n\n\u003e Exposes CommonDB as [Grafana Json Datasource](https://github.com/simPod/grafana-json-datasource)\n\u003e (express middleware)\n\n[![npm](https://img.shields.io/npm/v/@naturalcycles/grafana-lib/latest.svg)](https://www.npmjs.com/package/@naturalcycles/grafana-lib)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\n# Example\n\n```typescript\nimport { createDefaultApp, startServer } from '@naturalcycles/backend-lib'\nimport { FileDB } from '@naturalcycles/db-lib/dist/adapter/file'\nimport { GithubPersistencePlugin } from '@naturalcycles/github-db'\nimport { createGrafanaJsonDatasourceHandler } from '@naturalcycles/grafana-lib'\nimport { pHang } from '@naturalcycles/js-lib'\nimport { runScript } from '@naturalcycles/nodejs-lib/dist/script'\n\nrunScript(async () =\u003e {\n  // 1. Have your CommonDB ready\n  export const githubDB = new FileDB({\n    plugin: new GithubPersistencePlugin({\n      repo: 'NaturalCycles/github-db',\n      forcePush: false,\n    }),\n  })\n\n  // 2. Create grafanaHandler\n  const grafanaHandler = createGrafanaJsonDatasourceHandler({\n    db: githubDB,\n  })\n\n  // 3. Run Express server with grafanaHandler on 'http://localhost:8400/'\n  await startServer({\n    port: 8400,\n    expressApp: createDefaultApp({\n      resources: [grafanaHandler],\n    }),\n  })\n\n  await pHang()\n})\n```\n\nThis simple Express server with Grafana middleware allows to connect to it via Grafana UI as \"Json\nDatasource\".\n\n![Grafana Json Datasource](./media/grafana1.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalcycles%2Fgrafana-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaturalcycles%2Fgrafana-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalcycles%2Fgrafana-lib/lists"}