SyncLite 

BUILD ANYTHING SYNC ANYWHERE

OPEN-SOURCE Real-Time          LOW-Code          SECURE Scalable          Fault-Tolerant          Extensible          EXactly once semantics          No VENDOR LOCK-IN

SyncLITEDB - A SYNC-ENABLED APPLICATION DATABASE

While SyncLite Logger is embeddable in Java and Python applications, SyncLite DB steps in as a sync-enabled standalone database server, offering seamless data replication/consolidation and real-time sync for applications built in any programming language. SyncLite DB wraps popular embedded databases like SQLite, DuckDB, Apache Derby, H2, and HyperSQL, and allows your applications to connect via JSON-based SQL requests over HTTP.

Request and Response Structure: JSON-Based Interaction:

SyncLite DB uses a simple JSON format for receiving SQL commands and sending responses over HTTP. This makes it easy to integrate SyncLite DB with any programming language or system. Below is a detailed explanation of how the request and response structure works:

Request JSON Format :

{

    "db-type": "SQLITE",              // Specify database type: SQLITE, DUCKDB, DERBY, H2, HYPERSQL, SQLITE_APPENDER, DUCKDB_APPENDER, DERBY_APPENDER, H2_APPENDER, HYPERSQL_APPENDER, STREAMING

    "db-path": "C:\\synclite\\users\\bob\\synclite\\job1\\test.db",  // Database file path on the local file system.

    "synclite-logger-config": "C:\\synclite\\users\\bob\\synclite\\job1\\synclite_logger.conf",  // SyncLite Logger config file path

    "sql": "initialize",               // SQL command: initialize, close, begin, commit, rollback, <Any SQL statement as supported by the respective embedded database>

    "arguments": [[1, "one"], [2, "two"]],  // Optional arguments (a batch) to bind for a given prepared statement based sql statement as a JSON array, with each inner JSON array representing arguments to bind per record e.g. INSERT INTO t1 VALUES(? ,? ) 

    "txn-handle": "f47ac10b-58cc-4372-a567-0e02b2c3d479"  

    // Optional transaction handle if this sql operation is to be executed as part of transaction which has been started

}

JSON Response format from SyncLiteDB:

{

 "result" : true  // Operation result true/false  

 "message" : "Database initialized successfully"   // Server message for the executed operation 

 "txn-handle" : "f47ac10b-58cc-4372-a567-0e02b2c3d479"  // A unique transaction handle if the executed command was "begin". This handle must be passed for all subsequent sql operations to be excecuted as part of single transaction.

 "resultset" :  [{"a":1,"b":"one"},{"a":2,"b":"two"}]  // A JSON array, with each element being a JSON object containing <ColumnName, ColumnValue> pairs for sql queries returning resultset e.g. SELECT a, b FROM t1 

}


API Overview: Six APIs for Complete Data Management

Initialize database of the specified type at the specified path e.g. request JSON:

{     

  "db-type": "SQLITE",     

  "db-path": "C:\\synclite\\users\\bob\\synclite\\job1\\test.db",     

  "synclite-logger-config" : "C:\synclite\users\bob\synclite\job1\synclite_logger.conf"  

  "sql": "initialize" 

}

2. Execute SQL:

Execute a SQL statement as supported by underlying embedded database type e.g. request JSON:

{

  "db-path": "C:\\synclite\\users\\bob\\synclite\\job1\\test.db",     

  "sql": "insert into t1 values(?, ?)",

  "arguments" : "[[1, "one"], [2, "two"]]"

}

3. Begin Transaction

Begin a transaction e.g. request JSON:

{

  "db-path": "C:\\synclite\\users\\bob\\synclite\\job1\\test.db",     

  "sql": "begin" 

}

4. Commit Transaction

Commit transaction with specified transaction handle (as received from the SyncLite DB as a response for begin transaction request) e.g. request JSON:

{

  "db-path": "C:\\synclite\\users\\bob\\synclite\\job1\\test.db",     

  "txn-handle": "f47ac10b-58cc-4372-a567-0e02b2c3d479",

  "sql": "commit" 

}

5. Rollback Transaction

Rollback transaction with specified transaction handle (as received from the SyncLite DB as a response for begin transaction request) e.g. request JSON:

{

  "db-path": "C:\\synclite\\users\\bob\\synclite\\job1\\test.db", 

  "txn-handle": "f47ac10b-58cc-4372-a567-0e02b2c3d479",

  "sql": "rollback" 

}

6. Close DB

Close database with specified path e.g. Request JSON:

{     

  "db-path": "C:\\synclite\\users\\bob\\synclite\\job1\\test.db",     

  "sql": "close" 

}

With these simple yet powerful APIs, developers can perform any data management task, ensuring SyncLite DB fits smoothly into any application architecture.

Why SyncLiteDB?

SyncLite is redefining how developers approach real-time data replication and synchronization, offering vendor-agnostic, connection-agnostic, and scalable solutions that enable replication/consolidation of data from thousands of edge/desktop application instances into one or more centralized databases. It provides a simple, flexible framework : an embeddable Java library (JDBC Driver) synclite-logger for Java and Python applications and a standalone application database server synclite-db, for developers to build sync-enabled, fast, low-latency, low-cost, connection and vendor agnostic, data-driven applications across edge, desktop, and mobile environments.

Get Started 

Check out instructions to get started and code samples for SyncLiteDB Client for various programming languages : Java, Python, C#, C++, Go, Rust, Ruby, Node.js here: SyncLite/synclite-code-samples/synclite-db at main · syncliteio/SyncLite (github.com)