If you’re using Fly’s managed Postgres: You could connect with the flyctl proxy
¹ command forwarding connections to the VM where the database process is up and running. Ref: Public URL / IP for Postgres Cluster - #15 by kurt Though people have run into issues with that setup: Connection timeout when trying to connect to Postgres cluster from outside fly
If you’re coming from the Heroku world, this guide might come in handy: Migrating from Heroku Postgres to Fly Postgres: A Complete Guide
If you are running your own db as a Fly app, you could make your db instance accessible over the public internet: Access fly.io database from Retool - #3 by sheharyar. This setup won’t work if you are using Postgres’ TLS (why), but eitherways, exercise caution.
¹ flyctl proxy
basically lets you forward connections from localhost
(typically, one’s PC) to within inside your Fly org’s 6pn (private network), from where all your Fly org’s VMs (app instances, db instances, redis instances, builder instances, machine instances) are accessible.