Documentation
Get started with AirJSON in minutes
Quick Start
Install
npm install airjsonUsage
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 storeGET
/v1/storesList storesGET
/v1/stores/:idGet a storeDELETE
/v1/stores/:idDelete a storePOST
/v1/stores/:id/:collectionInsert document(s)GET
/v1/stores/:id/:collectionList documentsGET
/v1/stores/:id/:collection/:docIdGet documentPUT
/v1/stores/:id/:collection/:docIdReplace documentPATCH
/v1/stores/:id/:collection/:docIdPatch documentDELETE
/v1/stores/:id/:collection/:docIdDelete documentAPI Key Scopes
API keys are scoped to control access at different levels:
Account
aj_acc_xxxFull access to all stores and projects
Project
aj_proj_xxxAccess to all stores within one project
Store
aj_store_xxxAccess 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