Connecting via Node.js

First, install node-postgres for your node project.

npm install pg

Then sign in to and click "Connect" to get your connection info.


Using that information, you can connect to and query either yours or anyone else's public repo. Try copying the code below and swapping out the connection information.

const { Client } = require('pg');

// Create a client using the connection information provided on
const client = new Client({
    user: 'adam_demo_db_connection',
    host: '',
    database: 'bitdotio',
    password: 'C1GL_Z9Qthisisfake6XghrkhcW',
    port: 5432,

client.query('SELECT * FROM "terrybit/real-estate"."real_estate";', (err, res) => {
    console.table(res.rows); // you could also just console.log, but console.table is neat :)

Now run the program using node and you should see the rows you requested printed out in the console.

node main.js

Did this page help you?