The official PingDartDB Node.js SDK gives you a powerful dynamic query builder that connects directly to your local MySQL or PostgreSQL database — with zero network overhead, encrypted offline key validation, nested table joins, and geospatial search built right in.
Unlike cloud database services, PingDartDB Node SDK works directly with your own MySQL or Postgres database running anywhere — localhost, your VPS, or any managed host.
You just install the package, paste in your PingDart SDK key (which validates your licence offline using AES-256 decryption), and start running powerful queries through a clean JSON-based API — no raw SQL, no ORM setup, no migrations needed.
const PingDartDB = require('pingdartdb-node');
// Your PingDart SDK key
const db = new PingDartDB('pd_YOUR_SDK_KEY_HERE', {
host: 'localhost', // or your VPS IP / RDS endpoint
user: 'root',
password: 'your_db_password',
database: 'my_application',
type: 'mysql' // or 'postgres'
});
// Connect once at startup
await db.connect();
// Now use the full query builder...
const users = await db.table('users').read({
conditions: { status: 'active' },
pagination: { page: 1, limit: 10 }
});
console.log(users.data);
// → [{ id: 1, name: 'Alice', status: 'active' }]No setup friction. No boilerplate. Just clean queries from day one.
Your SDK key is decrypted locally using AES-256. Free tier never touches our servers. Queries go straight from your app to your database.
Read, insert, update, delete, and count records using a simple JSON-based API. Supports operators like >, <, !=, BETWEEN, IN, and LIKE.
Use the 'margedata' engine to join multiple tables recursively — users → orders → order_items — all in one clean query, returned as nested JSON.
Find nearby records using the Haversine formula. Just pass lat, lng, and radius in km. Perfect for delivery apps, store finders, and ride apps.
Paid tier keys are verified asynchronously in the background on connect(), so your app never blocks. License expiry errors surface gracefully.
Seamlessly switch between databases without touching your query logic. We translate JSON → SQL for you, handling dialect differences automatically.
Insert hundreds of records in one call using bulk insert. All records are batched into a single optimized SQL query for maximum efficiency.
Start building immediately with a free SDK key. Free tier is validated completely offline — no network calls, no limits on queries per second.
Every method is documented with real code examples, expected responses, and error codes. Visit /doc/sdk for the full interactive guide.
No matter what you need to do — read, write, update, delete, or do geospatial queries — the syntax is always the same simple pattern.
// Fetch active users with their orders
const results = await db.table('users').read({
conditions: { status: 'active' },
search: { name: 'john' }, // LIKE search
orderBy: 'created_at DESC',
pagination: { page: 1, limit: 20 },
// Deep join — fetch related orders
margedata: [
{
target_table: 'orders',
target_column: 'user_id',
target_value: 'id',
target_label: 'user_orders',
margedata: [ // Nested join!
{
target_table: 'order_items',
target_column: 'order_id',
target_value: 'id',
target_label: 'items'
}
]
}
]
});
console.log(results.data);
// { id: 1, name: 'John', user_orders: [{ id: 101, items: [...] }] }{
"success": true,
"data": [
{ "id": 1, "name": "Alice", "status": "active", "user_orders": [...] }
],
"totalCount": 1,
"totalPages": 1
}Follow these steps exactly to generate your key and connect your database.
Press the green 'Create SDK Key' button. A modal will appear asking for an App Name (e.g. 'My Node App') and the tier — choose Free for local offline use, or Pro for remote database sync.
Your key will be shown once and looks like: pd_AbcXyz123....encryptedPayload. Copy it immediately and store it in your .env file as PINGDART_SDK_KEY. Never commit it to git!
PINGDART_SDK_KEY=pd_YourKeyHereRun the install command and initialize the SDK in your project using the key from your .env file.
npm install pingdartdb-node
const db = new PingDartDB(process.env.PINGDART_SDK_KEY, {
host: 'localhost', user: 'root',
password: 'pass', database: 'mydb',
type: 'mysql'
});
await db.connect();