Using postgreSQL client from a plugin

Hi ,

I’m attempting to use as detailed in the this link

I’m trying to add this to a plugin , however since it has multiple dist files and other npm dependencies i’m not sure how to import the npm package. I’m aware that npm install pg won’t work because Grafana doesnt have access to the local node_modules folder.

I have managed to do this with other single file dists by just adding them to the dist libs/ folder and then importing them with import * as modulefrom ‘./libs/modulename’ however this one is a little more complicated and i am struggling to find an answer.

Any help is greatly appreciated.

Don’t you need to run this in a node js environment?


Hi mefraimsson,

I have a similar use case.

Is it possible to run a node js environment as plugin in Grafana?



That’s not currently possible. We want to implement support for backend plugins and that will probably enable a writing a node js backend plugin for example. There’s an open issue tracking this feature. Please upvote that issue by giving a reaction of :+1: emoji to the top posts if you’re interested in this feature.


Thanks @mefraimsson ,

I believe you are correct thanks for the link to that issue … that sounds exactly like what we need. I may have to re think our approach to this issue until that feature is available. Perhaps run a nodeJS miniserver and communicate to it through the plugin.