Connect to Postgresql


Is there anyway to connect to a local Postgresql database from Electron? I’ve tried to use node-postgres for it but Electron doesn’t seems to provide any bindings/API for it to be used?

Best regards,



node-postgres should work the same as if you were in a plain nodejs environment. You might need to use electron-rebuild to ensure you’re building with the nodejs/headers/etc appropriate to electron.


I found the problem. I needed to run node-postgres in the main process for it to work.