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 Environmentstaging-> Staging Environmentqa-> QA Environmentprod-> Production Environment
๐ฆ responseDataTypeโ
- Currently only
"json"is supported. - More formats may be added later.
โ๏ธ options.connectionPoolโ
You can control automatic connection pooling:
| Field | Meaning |
|---|---|
min | Minimum number of connections ZTeraDB keeps open |
max | Maximum 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