Skip to main content

πŸ“š 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

If you are inserting a vector you must specify data to a [f32] and type to vector

πŸ—ƒοΈ CRUD Operations

Create Data

If you are inserting a vector you must specify data to a [f32] and type to vector

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_array is an array of conditions { field, value }.
  • You can combine it with one: true to 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):
And traverse the graph with DFS:

πŸ” Encryption and Security

Easily encrypt and decrypt data:

🧰 Schema Class (Data Model)

You can use the Schema class to model your data in an object-oriented way:
It includes useful methods such as:
  • 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-name or ollama:model-name, if not specified openai:gpt-4o-mini will be used as default. If you’re using OpenAI as your backend you must specify the OPENAI_API_KEY env variable.

πŸ”Ή ask

Ask question about your data in natural language
  • question: Your question in natural language.
  • ref: The LLM backend. Must be openai:model-name or ollama:model-name, if not specified openai:gpt-4o-mini will be used as default. If you’re using OpenAI as your backend you must specify the OPENAI_API_KEY env 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:
AI responses obbey a different patern:

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.

πŸ’¬ Questions or Suggestions?

Feel free to open an issue or contribute! With ❀️ from the Satori team.