Documentation

Get started with AirJSON in minutes

Quick Start

Install
npm install airjson
Usage
import { AirJSON } from "airjson";

const db = new AirJSON({
  apiKey: "aj_store_your_key_here"
});

// Insert a document
const doc = await db.insert("my-store", "users", {
  name: "Alice",
  email: "alice@example.com"
});

// List documents
const users = await db.list("my-store", "users");

// Get a single document
const user = await db.get("my-store", "users", doc.id);

// Update a document
await db.update("my-store", "users", doc.id, {
  name: "Alice Smith",
  email: "alice@example.com"
});

// Delete a document
await db.delete("my-store", "users", doc.id);

REST API

All endpoints are available at api.airjson.com/v1. Authenticate with your API key in the Authorization: Bearer header.

POST
/v1/storesCreate a store
GET
/v1/storesList stores
GET
/v1/stores/:idGet a store
DELETE
/v1/stores/:idDelete a store
POST
/v1/stores/:id/:collectionInsert document(s)
GET
/v1/stores/:id/:collectionList documents
GET
/v1/stores/:id/:collection/:docIdGet document
PUT
/v1/stores/:id/:collection/:docIdReplace document
PATCH
/v1/stores/:id/:collection/:docIdPatch document
DELETE
/v1/stores/:id/:collection/:docIdDelete document

API Key Scopes

API keys are scoped to control access at different levels:

Account
aj_acc_xxx

Full access to all stores and projects

Project
aj_proj_xxx

Access to all stores within one project

Store
aj_store_xxx

Access to a single store only

CLI

Terminal
# Set your API key
export AIRJSON_API_KEY=aj_acc_xxx

# Create a store
airjson stores create my-store

# List stores
airjson stores list

# Insert a document
airjson docs insert -s <store-id> -c users -d '{"name":"Alice"}'

# List documents
airjson docs list -s <store-id> -c users