Skip to main content

Quick Start

Setup Server

Create new project:

mkdir myserver && cd myserver
npm init
npm install @socketdb/server

Create index.js file with:

import { SocketDBServer } from '@socketdb/server';


Run it with node index.js.

Setup Client

npm install @socketdb/client

To use SocketDB, you need to setup your frontend with a bundler (like rollup) that bundles your node_modules.

Then you can just import the client:

import { SocketDBClient } from '@socketdb/client';

Start client & connect to server

Then, in your frontend javascript, you can connect to the server like this:

const db = SocketDBClient();

db.get('some').set({ path: 'Hello World' });
// => Hello World

SocketDB has full typescript support. I recommend using typescript with SocketDB to get the benefits of code completion and type checking. For example you can add a Data Schema.