Unfortunately that’s not something that you can do. Postgres doesn’t support foreign key references across databases. If you want to use foreign keys the tables need to be inside the same database.
When building distributed systems you typically accept that you get weaker guarantees when it comes to foreign key constraints. For most applications that trade-off is worthwhile.