Unleash the future of data management with the ultimate platform for secure, scalable, and dynamic data operations. Power the next generation of applications by combining advanced encryption, revolutionary real-time querying, and seamless synchronization to create an ecosystem where data transforms into action. Effortlessly manage hierarchical structures, deploy groundbreaking queries, and enable unparalleled collaboration with robust integration capabilities. Build enterprise solutions, real-time dashboards, or futuristic IoT systems with a cosmic cornerstone for data innovation.
Package Exports
@trap_stevo/star-vault
Readme
π @trap_stevo/star-vault
Unleash the future of data management with the ultimate platform for secure, scalable, and dynamic data operations. Power the next generation of applications by combining advanced encryption, revolutionary real-time querying, and seamless synchronization to create an ecosystem where data transforms into action.
π Features
π Optional Encryption β Secure sensitive data at rest with SecurityCore
βοΈ Sharded Storage Engine β Efficiently scales writes across shards
π§ In-Memory Caching β High-speed read layer with StarCache
π Write-Ahead Logging β Resilient logs with rotation and retention policies
π Advanced Query Engine β Chainable and expressive queries with filtering, search, sorting, and spatial support
π Real-Time Event Emission β Listen to data changes with fine-grained control
π‘οΈ Authentication Layer β Optional handler to authorize every operation
π Collection Wildcards β Seamlessly operate across multiple collections
Soft-deletes a record by filtering it out and overwriting the collection. Returns { id, deleted: true }.
β Sync
π Query Engine
Chainable query builder for filtering and searching collection data.
vault.query("collection").where({key:"value"})// Filters by key-value pairs.search("field","text")// Text search within a specific field.recent("timestamp","7d")// Gets records from the last 7 days.near("location",{lat:0,lng:0},50)// Geospatial filter within 50 units.sort({name:1})// Sorts by a field (1 = asc, -1 = desc).select(["id","name"])// Selects specific fields.limit(10)// Limits results.offset(0)// Skips first N records.filterBy(record=> record.active)// Filters with custom function.execute(exactCollection =false)// Run the query with optional strict collection matching
Method
Description
Sync/Async
query(collection)
Begins a query on the specified collection. Returns a chainable builder.
β Sync
where(criteria)
Filters records by matching key-value pairs.
β Sync
search(field, text)
Performs a text search within a specified field.
β Sync
recent(field, duration)
Filters records based on recency (e.g., "7d" = 7 days).
β Sync
near(field, center, radius)
Filters based on proximity to a location object { lat, lng }.
β Sync
sort(criteria)
Sorts the results by one or more fields.
β Sync
select(fields)
Selects only the specified fields for output.
β Sync
limit(number)
Restricts the number of records returned.
β Sync
offset(number)
Skips a number of records (used for pagination).
β Sync
filterBy(fn)
Filters using a custom function on each record.
β Sync
callback(fn)
Adds a side effect or transformation hook before execution.
β Sync
execute(exactCollection = false)
Run the query. If true, match only the exact collection name; otherwise, include related subcollections.
β Sync
getByID(collection, id)
Shortcut to retrieve a single record by ID.
β Sync
range(min, max)
Static helper to return an inclusive array of numbers in a range.
β Sync
π‘οΈ Authentication
All methods below require authOptions configuration and are used for session/user management.
StarVault transcends traditional data systemsβoffering a full-fledged database engine and cosmic foundation that propels secure, reactive, and intelligent data-driven architectures.