How to link node.js app and postgresql?

I have a node.js application that builds successfully.

i want to link it with postresql which i posted also on

here are my settings for the postgres (this is a study project, so I don’t worry about posting this data):

here are my settings for the .env file:



here is my postgres connection settings in code:

export const AppDataSource = new DataSource({
  type: 'postgres',
  host: process.env.HOST,
  port: process.env.PORT,
  username: process.env.USER,
  password: process.env.PASSWORD,
  database: process.env.DB,
  entities: [Task],
  synchronize: false,

const port = process.env.PORT;

  .then(() => {
    console.log('Data Source has been initialized');
  .catch((err) => {
    console.error('Error!!! during Data Source initialization', err);

app.use('/', tasksRouter);

When I build I get this error:

Apparently, something is wrong with the database connection settings
what is the problem and how can i fix this error?

Could someone clarify one more question for me - can I place here on at the same time a site on react.js + a backend on node.js (which I described above)?

now I’m trying to link the frontend to react.js, which I posted on and the backend to node.js + postgres

can i place both frontend and backend here at the same time? if yes, how do i do it?


You’ve shared all the credentials for your database, so I would suggest deleting that instance and creating a new one if you haven’t done so already. Never share passwords with anyone and especially not on a public forum.

The logs screenshot shows you’ve used the full connection string as a “hostname”, which would be invalid. You can see how the connection string breakdown into host/user/password/etc in the docs.

If you’re connecting from another Render service in the same account & region, use the Internal Database URL. And then refer to the documentation of the database package you’re using to see how to configure it. Most will take the connection string URL.