-
Notifications
You must be signed in to change notification settings - Fork 0
Home
David Pardini edited this page Apr 17, 2026
·
3 revisions
A framework-agnostic TypeScript data service that acts as a smart cache and observer hub. Any frontend or backend consumer can ask for a piece of data by key. The service fetches it, caches it, and pushes updates to every registered observer automatically.
- A consumer requests data by key
- If the data is cached and still valid, it is returned immediately
- If not, the service looks up the registered API definition for that key, makes the upstream call, maps the response, stores it, and notifies observers
- On every future change, all observers are notified automatically
| Mode | Description |
|---|---|
| Library Mode | Import directly into any frontend or Node app — runs in-process |
| Microservice Mode | Run as a standalone HTTP + WebSocket server — any client connects over the network |
The core logic is identical in both modes. Only the transport layer differs.
| Topic | Page |
|---|---|
| System overview and diagrams | Architecture |
| Getting up and running fast | Getting-Started |
| Full DataVault public API | API-Reference |
| Defining data sources | Definitions |
| Cache internals | Cache-Design |
| Storage backends | Storage-Adapters |
| REST, WebSocket, and polling | Transport-Types |
| Field mapping and transforms | Data-Mapping |
| HTTP and WebSocket protocol | Microservice-Mode |
| Design patterns used | Design-Patterns |
| Security features | Security |
| Running the test suite | Testing |
import { DataVault } from '@banditintinc/datavault';
const ds = new DataVault({ storage: 'indexeddb' });
ds.registerDefinition({
key: 'users',
url: 'https://api.example.com/users',
type: 'rest',
method: 'GET',
cacheTTL: 60_000,
mapping: { name: 'profile.displayName', email: 'contact.email' }
});
ds.get('users', {
id: 'UserList',
onUpdate: (data) => renderTable(data)
});- TypeScript 5.4
- Node 20
- Express 4 (microservice HTTP layer)
-
ws(microservice WebSocket layer) - Jest + ts-jest (tests)