64 / 5.000 How can I work with a local database in the backend?

I am trying to use docker to create using postgreSQL but it is not working

Try to expose your database in your local machine with Ngrok, that will generate a link accessible from the internet and use it on your idx workspace

  1. install ngrok in your local machine
  2. expose your postrges port: ngrok tcp 5432

ngrok will forward your local port to a URL like this: tcp://0.tcp.ngrok.io:5432
now use that link as a connection string to your database in idx worspace

there is no way to use docker in IDX?

Docker is indeed fully supported on IDX, to enable it, just add this line to your dev.nix file:

services.docker.enable = true;

This will install docker cli as well as launch the docker daemon inside your workspace.

4 Likes