NEW!
Web Dashboard
Isomorphic TypeScript client for PostgreSQL
Open source
Get a realtime view of your data
const sBox = await db.boxes.subscribeOne(
{ id: 1 },
{ select: { comment: 1 }},
box => {
infoDiv.innerText = JSON.stringify(box);
}
);
input.onkeyup = e => {
sBox.update({ comment: input.value });
}
Build responsive apps with minimal code
containerDiv -> drag here
const boxSync = db.boxes.syncOne(
{ id: 1 },
{},
box => {
boxDiv.style.left = box.x + "px";
boxDiv.style.top = box.y + "px";
}
);
containerDiv.onpointermove = e => {
boxSync.update({ x: e.offsetX - 30, y: e.offsetY - 100 });
}

Every read and write request will be completed according to your rules
// client.js
const sBox = db.boxes2.subscribe(
{ },
{ },
boxes => {
infoDiv.innerText = boxes.map(box => JSON.stringify(box)).join("\n")
}
);
input.onkeyup = async e => {
try {
await db.boxes2.update({}, { comment: input.value });
errorDiv.innerText = "";
} catch(err) {
errorDiv.innerText = JSON.stringify(err, null, 2);
}
}
// server.js
...
publish: (socket, db) => ({
// table
boxes2: {
// operation
select: {
// rules
fields: { id: 1, comment: 1 }, // Can only select these two fields
forcedFilter: { // Can only view public or own data
$or:[
{ socket_id: socket.id },
{ is_public: true }
]
},
},
// operation
update: {
// rules
fields: { socket_id: -1, is_public: -1 }, // Can update any field except "socket_id" and "is_public"
forcedFilter: { socket_id: socket.id }, // Can only update own data
validate: async (box) => { // Custom logic
const allowed = ["a", "b", "c"]
if(
box &&
box.comment &&
box.comment.split("").some(char =>
!allowed.includes(char.toLowerCase())
)
) {
throw `Only allowed characters: ${allowed}`;
}
return box;
}
},
}
}),
...
Generated types from database schema
WIP
-->
