⚡ MQZZ.DB Launch: Free 5 GB PostgreSQL 16 allocation now available with SSL & instant connection strings! Claim yours →
M
MQZZ.DB
Integration Cookbook

Database Connection Guides

Production connection snippets with SSL configurations for 12+ modern backend frameworks and environments.

Critical Security Guideline: Never hardcode database passwords in frontend JavaScript (React, Vue, Svelte) or mobile application source code (Flutter, Android, iOS). Always connect through a secure backend API that protects your PostgreSQL credentials.

Node.js Connection with node-postgres (`pg`)

Install via: npm install pg dotenv

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

const pool = new Pool({
  host: process.env.PG_HOST || 'sql.mqzz.site',
  port: process.env.PG_PORT || 5432,
  database: process.env.PG_DATABASE,
  user: process.env.PG_USER,
  password: process.env.PG_PASSWORD,
  ssl: {
    rejectUnauthorized: false // Required for SSL
  },
  max: 10 // Max connections within 20 limit
});

async function testConnection() {
  const client = await pool.connect();
  try {
    const res = await client.query('SELECT NOW() as server_time');
    console.log('Connected to MQZZ.DB:', res.rows[0].server_time);
  } finally {
    client.release();
  }
}
testConnection();