This is not just a fancy client, it's a complete DBMS which is completely written in NodeJS with type declarations and documentation to ease developer's introduction to the amazing world of SavanahDB
It is a NoSQL meaning you can store data flexibly in the JSON format but it can also be used to establish deep relations between tables, have groups in the filter, join data from different tables!
Let's create a Social Network with this Database :
First, let's start a server to receive and process requests via various clients
import { Server } from 'savanahdb'
let server = new Server({
path: '/var/db/',
masterKey: 'ksKkharaudjwnwbduxnsn5yahahhwwsmma' // 64-bit key to encrypt important configurations
})
And that's it! Run it with pm2
You have your own server running now!
We connect to it using a client :
import { Client } from 'savanahdb';
let client = new Client({
user : "randomusr",
pass : "fdASDFajd9awjef98awjefioawjeasdf"
})
let db = client.db('network')
let users = db.table('users')
let posts = db.table('posts')
First, you store the User Document when they sign up:
users.insert({
name : 'John Adam',
city : 'New York',
tier : 'Silver',
prem : true,
id : 'usrOw9a0eif0923aewf'
})
Next you store two Posts they posted with reference to their id essentially establishing a relationship between the tables:
posts.insert({
usr : 'usrOw9a0eif0923aewf',
content : 'I love this network.'
})
// A Few Moments Later..
posts.insert({
usr : 'usrOw9a0eif0923aewf',
content : "Nvm, I don't know anymore"
})
Now when someone visits the Orginal User's Profile to list the posts they have posted, you create a search like this :
let usr = await users.search('id == "usrOw9a0eif0923aewf"', {
join : {
posts : 'that.usr == this.id'
}
}
In this case the usr Document will be :
[{
name : 'John Adam',
city : 'New York',
tier : 'Silver',
prem : true,
id : 'usrOw9a0eif0923aewf',
posts : [{
usr : 'usrOw9a0eif0923aewf',
content : 'I love this network.'
},{
usr : 'usrOw9a0eif0923aewf',
content : "Nvm, I don't know anymore"
}]
}]
Extremely capable Software do check it out!!
It is available to check out for free here : https://www.npmjs.com/package/savanahdb
If you are interested in the development or would like to receive updates for the package, you can join the official Discord Server here : https://www.discord.com/invite/GBmMQd2xtB
Top comments (9)
Are there any benchmarks?
I will be updating the README of the npm package with benchmarks quite soon.
I have already benchmarked it against Mongodb what else should I add to the comparison?
Postgres or mariadb perhaps
Your npm link is broken!
Sorry! Fixed now. Thanks for pointing out
The syntax reminds me of prisma.
Keep up the good work!
What about BigData support?
Yes. With sharding and the concept of connecting multiple servers as a hive it should be able to process terabytes of data, be highly available and fast
I am working on a gitbook documentation to explain advanced concepts like sharding, hive, scaling and security with SavanahDB whenever it's ready it will linked in the readme. Future versions will be able to scale diagonally ( horizontally and vertically) on demand