Skip to content

Quickstart Guide

Prerequisites

Before installing NexusDB, ensure you have the following:

  • Node.js 18+ or Python 3.10+
  • At least 2GB free RAM
  • macOS, Linux, or Windows with WSL2

Installation

Install NexusDB globally using npm:

npm install -g @nexusdb/cli
nexusdb init my-project
cd my-project

Or with pip:

pip install nexusdb
nexusdb init my-project

Start the Server

Launch the development server with hot reload:

nexusdb dev --port 4200

You should see output like:

NexusDB v3.2.1 running at http://localhost:4200
Admin dashboard: http://localhost:4200/admin
API endpoint: http://localhost:4200/api/v1

Create Your First Collection

Open a new terminal and create a collection:

nexusdb collection create users --schema schema.json

Define a schema in schema.json:

{
  "name": "users",
  "fields": [
    { "name": "email", "type": "string", "unique": true },
    { "name": "name", "type": "string" },
    { "name": "role", "type": "enum", "values": ["admin", "editor", "viewer"] },
    { "name": "created_at", "type": "datetime", "auto": true }
  ]
}

Insert Data

const { NexusDB } = require("@nexusdb/client");

const db = new NexusDB("http://localhost:4200");

await db.collection("users").insert({
  email: "jane@example.com",
  name: "Jane Doe",
  role: "admin"
});

Query Data

const admins = await db.collection("users")
  .where("role", "==", "admin")
  .orderBy("created_at", "desc")
  .limit(10)
  .get();

console.log(admins);

Next Steps

Now that you have NexusDB running, explore: