A remote nodejs Cached sqlite Database Server, for you to have your perfect MAP Cache Saved and useable remotely.

Overview

Built with Love Made with Javascript

Discord server NPM version NPM downloads Get Started Now Patreon

npm installnfo

remote-sqlite-database

  • A remote nodejs Database using sqlite
  • It has auto-restore features
  • It is fast
  • It uses enmap aka sqlite
  • The clients are cached
  • Supports SHARDED Applications (like Discord Bots, which used enmap before)

Installation

npm install https://github.com/Tomato6966/remote-sqlite-database
npm install remote-sqlite-database

Usage

  1. Create the DB - Create a File-Folder-Project, at your CACHE-SERVER (it's a cache and db at the same time) and put in this Code:
Click to see the Code
{ console.log("DatabaseCacheServer ready and waiting for connections"); }) .on("serverError", (error) => { console.error("DatabaseCacheServer error, ERROR:\n", error, "\n---\n"); }) .on("serverClose", (reason) => { console.log("DatabaseCacheServer closed"); }) .on("serverConnect", (connection, payload) => { console.log("DatabaseCacheServer a Client Connected"); }) .on("serverDisconnect", (connection, reason) => { console.log("DatabaseCacheServer a Client Disconnected"); }) .on("serverMessage", (message) => { // console.log("DatabaseCacheServer, received a Message", message); }) .on("serverRequest", async (request, response, client) => { // console.log("DatabaseCacheRequest, received a Request", request); });">
const { remoteCacheServer } = require("remote-sqlite-database");

const Server = new remoteCacheServer({
    username: "TheUserNameForTheCacheServer",
    password: "ThePasswordForTheCacheServer",
    name: "databaseName",
    dataDir: "./path/to/database/",
    port: 4040, // Any port
    tls: true,
    debug: false // if enabled u see all the actions ;)
});
// Following Events are optional
Server
    .on("serverReady", () => {
        console.log("DatabaseCacheServer ready and waiting for connections");
    })
    .on("serverError", (error) => {
        console.error("DatabaseCacheServer error, ERROR:\n", error, "\n---\n");
    })
    .on("serverClose", (reason) => {
        console.log("DatabaseCacheServer closed");
    })
    .on("serverConnect", (connection, payload) => {
        console.log("DatabaseCacheServer a Client Connected");
    })
    .on("serverDisconnect", (connection, reason) => {
        console.log("DatabaseCacheServer a Client Disconnected");
    })
    .on("serverMessage", (message) => {
        // console.log("DatabaseCacheServer, received a Message", message);
    })
    .on("serverRequest", async (request, response, client) => {
        // console.log("DatabaseCacheRequest, received a Request", request);
    });
  1. To connect the cache do this:
Click to see the Code
key = "hello", path = "world.hi", db.get("hello") --> {world: {hi: "value"}} }); //keyPathing should be set to false, if you want to do "key.hello" as a key // following events are optional client .on("cacheReady", () => { console.log("DATABASECACHECLIENT ready and connected"); }) .on("cacheError", (error) => { console.error("DATABASECACHECLIENT error, ERROR:\n", error, "\n---\n"); }) .on("cacheClose", (reason) => { console.log("DATABASECACHECLIENT closed, REASON?:\n", reason, "\n---\n"); }) .on("cacheMessage", (message) => { console.log("message", message); }) .on("cacheRequest", async (request, response, client) => { console.log("REQUEST", request); }); // example usage async function yourProgram(){ await client.set("hi", "bye").then(console.log).catch(console.error); await client.get("hi").then(console.log).catch(console.error); await client.set("array", []).then(console.log).catch(console.error); await client.push("array", "element").then(console.log).catch(console.error); await client.push("array", "element2").then(console.log).catch(console.error); await client.size().then(console.log).catch(console.error); await client.get("array").then(console.log).catch(console.error); await client.all().then(console.log).catch(console.error); } yourProgram();">
const { remoteCacheClient } = require("remote-sqlite-database");
const client = new remoteCacheClient({
    username: "db_cache",
    password: "db_cache",
    host: "localhost",
    port: 5000,
    tls: true,
    keyPathing: true, // true|false ... enables if the key contains a "." that it's splitted to a path, e.g.: "hello.world.hi" --> key = "hello", path = "world.hi", db.get("hello") --> {world: {hi: "value"}}
}); 
//keyPathing should be set to false, if you want to do "key.hello" as a key

// following events are optional
client
    .on("cacheReady", () => {
        console.log("DATABASECACHECLIENT ready and connected");
    })
    .on("cacheError", (error) => {
        console.error("DATABASECACHECLIENT error, ERROR:\n", error, "\n---\n");
    })
    .on("cacheClose", (reason) => {
        console.log("DATABASECACHECLIENT closed, REASON?:\n", reason, "\n---\n");
    })
    .on("cacheMessage", (message) => {
        console.log("message", message);
    })
    .on("cacheRequest", async (request, response, client) => {
        console.log("REQUEST", request);
    });

// example usage
async function yourProgram(){
    await client.set("hi", "bye").then(console.log).catch(console.error);
    await client.get("hi").then(console.log).catch(console.error);
    await client.set("array", []).then(console.log).catch(console.error);
    await client.push("array", "element").then(console.log).catch(console.error);
    await client.push("array", "element2").then(console.log).catch(console.error);
    await client.size().then(console.log).catch(console.error);
    await client.get("array").then(console.log).catch(console.error);
    await client.all().then(console.log).catch(console.error);
}

yourProgram();

Methods (Functions) for the CACHE-CLIENT(s)

  • all "path"'s are optional
  • get(key, path) get any value from a key
  • set(key, path) set any value in a key
  • add(key, amount, path) add a number to a key/path
  • substract(key, amount, path) removes a number from a key/path
  • math(key, operator, amount, path) make a mathematical operation like adding, substracting multiplying etc.
  • push(key, element, path) add an element in an array
  • remove(key, element, path) remove an element out of an array
  • has(key, path) check if the key / key-path exists
  • delete(key, path) delete something
  • clear() clears the whole cache Map
  • all() / values() array of all values
  • entries() array of [key, value]
  • keys() array of all keys
  • ping() shows the ping
  • size() shows the cache-map-size
  • ensure(key, data, path) ensures data in the db

Events for the CACHE-SERVER

  • serverReady shows when the server is ready, you don't need to listen to it!
  • serverError shows when the server errors, you don't need to listen to it!
  • serverClose shows when the server closes, you don't need to listen to it!
  • serverConnect shows when a client connects, you don't need to listen to it!
  • serverDisconnect shows when a client disconnects, you don't need to listen to it!
  • serverMessage receives messages from a cache-client, you don't need to listen to it!
  • serverRequest received requets from a cache-client, used for sending the cache datas, you don't need to listen to it!

Events for the CACHE-Client(s)

  • cacheReady shows when the server is ready, you don't need to listen to it!
  • cacheError shows when the server errors, you don't need to listen to it!
  • cacheClose shows when the server closes, you don't need to listen to it!
  • cacheMessage receives messages from the cache-server, you don't need to listen to it!
  • cacheRequest receives requets from the cache-server, you don't need to listen to it!
Comments
  • Add to Milrato and more questions ?

    Add to Milrato and more questions ?

    If this better then quickmongo add this to milrato also is this like enmap database ? how do i create table to each section ? Is this work on sharded discord bots ? Is this database systeam use lot of resoruces ? Add Array method in enmap (get is more complicated to get array)

    opened by pasindu20 3
  • I cannot create databases on other hosts, only on my localhost.

    I cannot create databases on other hosts, only on my localhost.

    Once when I wanted to create some databases on a more powerful host, I got an error, I tried everything, but it wouldn't let me connect to my databases. I investigated a little about the error, but it was not clear to me what it meant. I was able to use my databases on a local host, but not on another hosting.

    opened by Caletayo 2
  • This database does not work with milrato

    This database does not work with milrato

    I tried to run the database for milrato shardeado and it does not work for me.

    I tried by all means to create one by one the tables that were talked about in a previous problem and they do not work. They do not save the data

    I put bot prefix prefix x!

    x!help does not work

    And it works with the prefix from before and the setups the same. I set up something like tickets and it tells me the bot. ❌ I have not found your configuration in the database.

    Any solution?

    opened by Caletayo 1
  • I need a short written course on how to use it.

    I need a short written course on how to use it.

    This database is very good, however, there are some things that I do not understand. If you could give me a fragment of the code of musicium or milrato with these databases it would be very good.

    If not, I need an explanation of how it works written. Advanced codes, use of the database, etc.

    opened by Caletayo 1
  • This database not work on milrato part 2

    This database not work on milrato part 2

    I tried to run the database for milrato shardeado and it does not work for me.

    I tried by all means to create one by one the tables that were talked about in a previous problem and they do not work. They do not save the data

    I put bot prefix prefix x!

    x!help does not work

    And it works with the prefix from before and the setups the same. I set up something like tickets and it tells me the bot. ❌ I have not found your configuration in the database.

    Any solution?

    CODE = Milrato with mongoDB

    opened by Caletayo 0
  • Client update

    Client update

    By this if you didn't provide the host then it will not give error insted it will tell user tht you have not mentioned the host so it has take 'localhost'

    opened by anishdevtech 0
Owner
Tomato6966
I am Tomato, around about 18, and a very good Discord Bot Developer, Dm me on Discord: Tomato#6966, to get one yourself!
Tomato6966
Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

DbGate 2k Dec 30, 2022
The nestjs cache module based on cache-manager & decorators 🍃

A progressive Node.js framework for building efficient and scalable server-side applications. zirus-cache zirus-cache for Nest.JS - simple and modern

Yakov Bobroff 4 May 9, 2022
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used

null 30.1k Jan 3, 2023
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite datab

MikroORM 5.4k Dec 31, 2022
Realm is a mobile database: an alternative to SQLite & key-value stores

Realm is a mobile database that runs directly inside phones, tablets or wearables. This project hosts the JavaScript versions of Realm. Currently we s

Realm 5.1k Jan 3, 2023
Bluzelle is a smart, in-memory data store. It can be used as a cache or as a database.

SwarmDB ABOUT SWARMDB Bluzelle brings together the sharing economy and token economy. Bluzelle enables people to rent out their computer storage space

Bluzelle 225 Dec 31, 2022
Streaming and playing on the Nintendo Switch remotely!

Switch-Stream This is a semi-convoluted application as a proof-of-concept that someone could play their Switch from a distance. A server is connected

Charles Zawacki 8 May 2, 2022
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server & SQLite

Prisma Quickstart • Website • Docs • Examples • Blog • Slack • Twitter • Prisma 1 What is Prisma? Prisma is a next-generation ORM that consists of the

Prisma 28k Jan 2, 2023
Explore, create and deploy your SQLite databases right from your browser. Quick and easy, no installation required.

SQLighter (under development, alpha code) SQLighter is a database explorer born for SQLite that helps you design and deploy your application database

sqlighter 11 Sep 20, 2022
🔥 Dreamy-db - A Powerful database for storing, accessing, and managing multiple database.

Dreamy-db About Dreamy-db - A Powerful database for storing, accessing, and managing multiple databases. A powerful node.js module that allows you to

Dreamy Developer 24 Dec 22, 2022
A Node.js ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud.

Dittorm A Node.js ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud. Installatio

Waline 21 Dec 25, 2022
DolphinDB JavaScript API is a JavaScript library that encapsulates the ability to operate the DolphinDB database, such as: connecting to the database, executing scripts, calling functions, uploading variables, etc.

DolphinDB JavaScript API English | 中文 Overview DolphinDB JavaScript API is a JavaScript library that encapsulates the ability to operate the DolphinDB

DolphinDB 6 Dec 12, 2022
A javascript library to run SQLite on the web.

SQLite compiled to JavaScript sql.js is a javascript SQL database. It allows you to create a relational database and query it entirely in the browser.

SQL.JS 11k Jan 7, 2023
WebAssembly SQLite with experimental support for browser storage extensions

wa-sqlite This is a WebAssembly build of SQLite with experimental support for writing SQLite virtual filesystems and virtual table modules completely

Roy Hashimoto 260 Jan 1, 2023
Ecommerce-backend-nestjs - Ecommerce app with Nestjs + Prisma ORM + GraphQL + SQLite

ECOMMERCE BACKEND NESTJS APP Nestjs + Prisma ORM + GraphQL + SQLite USER Create Account Login Product Create Product Get Products Get Product Search P

Rui Paulo Calei 5 Apr 6, 2022
Same as sqlite-tag but without the native sqlite3 module dependency

sqlite-tag-spawned Social Media Photo by Tomas Kirvėla on Unsplash The same sqlite-tag ease but without the native sqlite3 dependency, aiming to repla

Andrea Giammarchi 17 Nov 20, 2022
A lightweight way to cache on graphQL servers

cacheflowQL What is cacheflowQL? CacheflowQL is an npm package with complex caching algorithms that provide developers deep insights into their GraphQ

OSLabs Beta 53 Nov 16, 2022
Tools that eat glass so you don't have to

GlassEater Tools that eat glass so you don't have to. Docs coming soon... Features generates the most precise and optimal getProgramAccounts queries p

Goo 31 Sep 27, 2022