Create a Database
Constructor parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
GUI |
boolean | false |
Enable the web GUI on localhost:27018 |
RootName |
string | "AxioDB" |
Custom root folder name |
CustomPath |
string | current directory | Custom storage path |
TCP |
boolean | false |
Enable the AxioDBCloud TCP server on port 27019 |
TCPAuth |
boolean | false |
Require username/password (same RBAC users as the GUI) on TCP connections |
Basic instance, with GUI#
const { AxioDB } = require("axiodb");
const db = new AxioDB({ GUI: true });
console.log("AxioDB instance created with GUI at localhost:27018");Without GUI (production)#
const db = new AxioDB({ GUI: false });Custom name and path#
const db = new AxioDB({ GUI: true, RootName: "MyCustomDB", CustomPath: "./data" });TCP server with authentication#
const db = new AxioDB({
TCP: true,
TCPAuth: true,
RootName: "MyCustomDB",
CustomPath: "./data"
});Multiple databases#
const userDB = await db.createDB("UsersDB");
const productsDB = await db.createDB("ProductsDB");Important: only one AxioDB instance is allowed per application — it's a singleton. The GUI starts automatically on localhost:27018 when enabled, and each database can hold multiple collections.