π Satori Node.js SDK
Welcome to the official documentation for Satori Node.js SDK! πThis library allows you to interact easily and efficiently with the Satori database via WebSockets, supporting CRUD operations, real-time notifications, and advanced queries.
β¨ Main Features
- Ultra-fast CRUD operations β‘
- Advanced queries using
field_arrayπ - Real-time notifications π’
- Graph-like relations (vertices and references) πΈοΈ
- Data encryption and decryption π
π Installation
π Basic Usage
ποΈ CRUD Operations
Create Data
Read Data
Modify a Field
Delete Data
π§© Advanced Queries with field_array π
You can perform operations on multiple objects that meet certain conditions using the field_array field:
field_arrayis an array of conditions{ field, value }.- You can combine it with
one: trueto get only the first matching result.
π Real-time Notifications
Receive automatic updates when an object changes!πΈοΈ Relations and Graphs
You can create relationships between objects (vertices):π Encryption and Security
Easily encrypt and decrypt data:π§° Schema Class (Data Model)
You can use theSchema class to model your data in an object-oriented way:
set,delete,encrypt,setVertex,getVertex,deleteVertex,dfs- Array methods:
push,pop,splice,remove
π¦ Array Manipulation Methods
Below are the available methods to manipulate arrays in the Satori database using the Node.js client:πΉ push
Adds a value to an existing array in an object.- key: Object key.
- array: Name of the array.
- value: Value to add.
πΉ pop
Removes the last element from an array in an object.- key: Object key.
- array: Name of the array.
πΉ splice
Modifies an array in an object (for example, to cut or replace elements).- key: Object key.
- array: Name of the array.
πΉ remove
Removes a specific value from an array in an object.- key: Object key.
- array: Name of the array.
- value: Value to remove.
π€ AI Methods
Satori has AI features integrated that boost developers productivity.πΉ set_middleware
Make the LLM analyze incoming querys and decide if it must reject them, accept them or modify them.πΉ ann
Perform an Aproximate Nearest Neighbors search- key: Source object key.
- vector: Vector of f32 instead of key
- top_k: Number of nearest neighbors to return
πΉ query
Make querys in natural language- query: Your query in natural language.
- ref: The LLM backend. Must be
openai:model-nameorollama:model-name, if not specifiedopenai:gpt-4o-miniwill be used as default. If youβre using OpenAI as your backend you must specify theOPENAI_API_KEYenv variable.
πΉ ask
Ask question about your data in natural language- question: Your question in natural language.
- ref: The LLM backend. Must be
openai:model-nameorollama:model-name, if not specifiedopenai:gpt-4o-miniwill be used as default. If youβre using OpenAI as your backend you must specify theOPENAI_API_KEYenv variable.
Analytics
πΉ get_operations
Returns all operations executed on the database.πΉ get_access_frequency
Returns the number of times an object has been queried or accessed.Responses
All responses obbey the following pattern:ask
query
ann
π§ Key Concepts
- key: Unique identifier of the object.
- type: Object type (e.g., βuserβ).
- field_array: Advanced filters for bulk operations.
- notifications: Subscription to real-time changes.
- vertices: Graph-like relationships between objects.