prisma & postgres v2

Hi there, wanted to migrate to v2 but a bit confused with these 2 variables to connect to my database with Prisma. What are their differences? DATABASE_URL DATABASE_PRIVATE_URL I have different 2 apps so I need to know which one to use to connect to my db: 1. Front-end that is deployed on vercel + my postgres db is on railway 2. Front-end in the same project as my postgres db on railway Project ID: 22b04948-a71a-4235-a2be-4e0ecedceee8
Solution:
but to answer your questions directly
Front-end that is deployed on vercel + my postgres db is on railway
use DATABASE_URL
Front-end in the same project as my postgres db on railway...
Jump to solution
7 Replies
Percy
Percy•6mo ago
Project ID: 22b04948-a71a-4235-a2be-4e0ecedceee8
Solution
Brody
Brody•6mo ago
but to answer your questions directly
Front-end that is deployed on vercel + my postgres db is on railway
use DATABASE_URL
Front-end in the same project as my postgres db on railway
use DATABASE_PRIVATE_URL
Syahmi Rafsanjani
Syahmi Rafsanjani•6mo ago
Thanks Brody, did some reading on the docs but a bit confused because I think I have read somewhere that egress can be cheaper if I use private url instead?
Brody
Brody•6mo ago
that is correct, although not just cheaper, you can eliminate all service to database egress costs by using the private network, but as the docs mention the private url can only be used for service to service (or database) communication within the same project
Syahmi Rafsanjani
Syahmi Rafsanjani•6mo ago
Cool! Thanks Brody for the explanation 🙂
Brody
Brody•6mo ago
no problem!