Learn how to route Node.js Prisma ORM database traffic through a QuotaGuard Static IP using QGTunnel.
N/A
docker build -t qg-static-prisma-example .
docker run -e QUOTAGUARDSTATIC_URL=... -e DATABASE_URL=... qg-static-prisma-exampleBe sure to set QUOTAGUARDSTATIC_URL to your HTTP proxy URL from the QuotaGuard Dashboard.
Important: Due to Prisma's architecture, you must use QGTunnel's direct tunnel endpoint rather than relying on transparent mode DNS overrides.
For example, if your original database URL is:
postgresql://user:pass@aws-0-us-east-1.pooler.supabase.com:6543/dbname
Use the tunnel endpoint instead:
postgresql://user:pass@127.0.0.1:16543/dbname
QGTunnel maps configured database endpoints to local ports based on your account's remote configuration.
docker build -t qg-static-prisma-example .
docker run -e QUOTAGUARDSTATIC_URL=... -e DATABASE_URL=... qg-static-prisma-example
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Test {
id Int @id @default(autoincrement())
}
const { PrismaClient } = require('@prisma/client')
async function main() {
try {
console.log('Testing Prisma connection through QGTunnel...')
// Create fresh client for each operation
const prisma = new PrismaClient()
// Test the connection
await prisma.$connect()
console.log('✅ Connected to database through QGTunnel')
await prisma.$disconnect()
console.log('✅ Connection closed successfully')
console.log('🎉 Prisma + QGTunnel proxy connection verified!')
} catch (error) {
console.error('❌ Connection failed:', error.message)
process.exit(1)
}
}
main()
FROM node:latest
WORKDIR /app
RUN curl https://s3.amazonaws.com/quotaguard/qgtunnel-latest.tar.gz | tar xz
COPY package*.json ./
COPY schema.prisma ./
COPY index.js ./
RUN npm install
RUN npx prisma generate
CMD ["bin/qgtunnel", "node", "index.js"]