Skip to main content

ZTeraDB Configuration Guide

This guide explains how to configure the ZTeraDB Node.js client using the ZTeraDBConfig object.


๐ŸŽฏ What is ZTeraDBConfig?

ZTeraDBConfig is a JavaScript object that contains all the authentication and environment settings required to connect your application to ZTeraDB Server.

It is required for every ZTeraDB connection.


๐Ÿงฉ Full Structure

const ZTeraDBConfig = {
clientKey: "string",
accessKey: "string",
secretKey: "string",
databaseID: "string",
env: "dev | staging | qa | prod",
responseDataType: "json",
options: {
connectionPool: {
min: 0,
max: 0
}
}
};

๐Ÿ”Ž Field-by-field Explanation

๐Ÿ”‘ clientKeyโ€‹

  • Your unique ZTeraDB account key.
  • Get it from: Dashboard โ†’ Security Credentials.

๐Ÿ” accessKeyโ€‹

  • Required for authenticating outgoing requests.
  • You can create multiple accessKeys.
  • Only one active access key is allowed at a time.

๐Ÿงฉ secretKeyโ€‹

  • Secret signature key used to verify request authenticity.
  • You will only see it once when creating it.
  • Keep it safe and never commit it to Git.

๐Ÿ—„ databaseIDโ€‹

  • Unique ID of your ZTeraDB database.
  • Example: "7K3WHGOJKJJEJ3PFJM407QO25F".

๐ŸŒ envโ€‹

Defines which ZTeraDB environment your database belongs to.

Allowed values:

  • dev -> Development Environment
  • staging -> Staging Environment
  • qa -> QA Environment
  • prod -> Production Environment

๐Ÿ“ฆ responseDataTypeโ€‹

  • Currently only "json" is supported.
  • More formats may be added later.

โš™๏ธ options.connectionPoolโ€‹

You can control automatic connection pooling:

FieldMeaning
minMinimum number of connections ZTeraDB keeps open
maxMaximum number of connections allowed

If not set โ†’ ZTeraDB manages connections automatically.

options: {
connectionPool: {
min: 2,
max: 10
}
}

๐Ÿงช Complete Example

const ZTeraDBConfig = {
clientKey: "<Your ZTeraDB client key>",
accessKey: "<Your ZTeraDB access key>",
secretKey: "<Your ZTeraDB secret key>",
databaseID: "<Your ZTeraDB database id>",
env: "dev",
responseDataType: "json",
options: {
connectionPool: {
min: 1,
max: 5
}
}
};

โš ๏ธ Common Mistakes (Read This!)

โŒ Using wrong environment name
โœ” Use only: "dev", "staging", "qa", "prod"

โŒ Missing secretKey
โœ” Ensure .env contains all required fields

โŒ Storing keys in GitHub
โœ” Put all keys in .env only


๐ŸŽ‰ You are ready to create a connection!

Continue to:
๐Ÿ‘‰ zteradb-connection.md