InfinitaDB (a free database for roblox)

InfinitaDB a database designed for Roblox that is faster than Roblox Datastores and can be accessed anywhere.

Why should you use this?

Unlimited storage for 100% Free, unlike other databases i dont care about money i just enjoyed coding it.
if the place is deleted data is still there on the reuploaded version of your game.
data can be accessed way faster than roblox allows.
all datastore limits will no longer exist and you are able to perform requests faster.

notice: never share your access key as anyone will be able to set there data (access key cant be changed)

to get your database for free click:
HERE

The site will prompt you to remix the glitch project your url is your glitchprojectname.glitch.me
visit the site and it will give u the module and generate you a key

example:

local infinitedb = require(script.Parent.infinitadb)

local loaded = {}

local prefix = "data"

game:GetService("Players").PlayerAdded:Connect(function(plr)
	local lstats = script.leaderstats:Clone()
	lstats.Parent = plr
	local coins = infinitedb.Get(prefix..plr.UserId,"Coins")
	loaded[plr] = true
	lstats.coins.Value = coins
end)


game:GetService("Players").PlayerRemoving:Connect(function(plr)
	if not loaded[plr] then
		return
	end
	
	local lstats = plr.leaderstats
	local coins = infinitedb.Set(prefix..plr.UserId,"Coins",lstats.coins.Value)
	lstats.coins.Value = coins
	loaded[plr] = nil
end)

game:BindToClose(function()
	local function getloaded()
		local a = 0
		for i,v in pairs(loaded) do
			a += 1
		end
		return a
	end
	
	
	while getloaded() > 0 do
		task.wait(1)
	end
end)
6 Likes

What backend is this using? realtime database, firestorm, AWS?

6 Likes

it uses roblox open cloud and glitch memory it has the data in the glitch memory if its being updated after 10 seconds of no updates it sets, the source code is

ik it uses roblox database but it removes every limit using the extra code

const express = require("express");
const path = require("path");
const axios = require("axios");
const crypto = require("crypto");
const fs = require("fs");
const { v4: uuidv4 } = require("uuid");
const bodyparser = require("body-parser");
const app = express();

const universeid = process.env.universe;
const key = process.env.datakey;

function encodeBase64(data) {
  return Buffer.from(data).toString("base64");
}

function decodeBase64(data) {
  return Buffer.from(data, "base64");
}

function getunix() {
  const currentDate = new Date();
  const unixTimestamp = Math.floor(currentDate.getTime() / 1000);
  return unixTimestamp;
}

async function getAsync(value, name) {
  const res = await axios.get(
    `https://apis.roblox.com/datastores/v1/universes/${universeid}/standard-datastores/datastore/entries/entry`,
    {
      params: {
        datastoreName: name,
        entryKey: value,
      },

      headers: {
        "x-api-key": key,
      },
    }
  );
  let data = res.data;

  return data;
}

async function setAsync(value, name, write) {
  const jsonvalue = await JSON.stringify(write);
  const convertadd = await crypto
    .createHash("md5")
    .update(jsonvalue)
    .digest("base64");

  const res = await axios.post(
    `https://apis.roblox.com/datastores/v1/universes/${universeid}/standard-datastores/datastore/entries/entry`,
    write,
    {
      params: {
        datastoreName: name,
        entryKey: value,
      },

      headers: {
        "x-api-key": key,
        "content-md5": convertadd,
        "content-type": "application/json",
      },
    }
  );
  let data = res.data;

  return data;
}

app.use(express.json());
app.use(express.static(__dirname));

app.get("/", (req, res) => {
  res.sendFile(path.join(__dirname, "redirect.html"));
});

app.get("/get-started", (req, res) => {
  res.sendFile(path.join(__dirname, "Start.html"));
});

let cache = {};

function removeExpiredItems() {
  const currentTime = getunix();
  const keysToRemove = [];

  for (const entryKey in cache) {
    const entry = cache[entryKey];
    const entryTime = entry[1];

    if (currentTime - entryTime > 5) {
      keysToRemove.push(entryKey);
    }
  }

  keysToRemove.forEach((key) => {
    const info = key.split(";");
    const AccessKey = info[1];
    const entryKey = info[0];

    const cacheEntry = cache[key];
    const data = cacheEntry[0];
    const time = cacheEntry[1];

    delete cache[key];

    setAsync(entryKey, AccessKey, data);
    console.log("removed from mem");
  });
}

setInterval(removeExpiredItems, 10000);

let inc = [];

app.post("/increment", async (req, res) => {
  const body = req.body;
  let AccessKey = body["AccessKey"];
  let name = body["Name"];
  let key = body["Key"];
  let writedata = body["Write"];

  if (typeof writedata === "number" && !isNaN(writedata)) {
  } else {
    writedata = 1;
  }

  let entrykey = name + key;
  console.log(body);
  let set;
  let from = cache[entrykey + ";" + AccessKey];

  if (from) {
    if (typeof from[0] === "number" && !isNaN(from[0])) {
    } else {
      from[0] = 0;
    }

    writedata += from[0];
    from[0] = writedata;
    let u = getunix();
    from[1] = u;
    console.log("mem inc");
  } else {
    let got;
    try {
      if (inc[entrykey + AccessKey] == true) {
        res.sendStatus(500);
        return;
      }

      inc[entrykey + AccessKey] = true;
      got = await getAsync(entrykey, AccessKey);
    } catch (error) {
      got = 0;
    }

    if (typeof got === "number" && !isNaN(got)) {
    } else {
      got = 0;
    }

    writedata += got;

    set = await setAsync(entrykey, AccessKey, writedata);

    let u = getunix();
    let c = {
      [0]: writedata,
      [1]: u,
    };

    cache[entrykey + ";" + AccessKey] = c;
    delete inc[entrykey + AccessKey];
  }

  res.send({ writedata });
});

app.post("/set", async (req, res) => {
  const body = req.body;
  let AccessKey = body["AccessKey"];
  let name = body["Name"];
  let key = body["Key"];
  let writedata = body["Write"];

  let entrykey = name + key;
  console.log(body);
  let set;
  let from = cache[entrykey + ";" + AccessKey];

  if (from) {
    from[0] = writedata;
    let u = getunix();
    from[1] = u;
    console.log("mem set");
  } else {
    set = await setAsync(entrykey, AccessKey, writedata);

    let u = getunix();
    let c = {
      [0]: writedata,
      [1]: u,
    };

    cache[entrykey + ";" + AccessKey] = c;
  }

  res.send({ writedata });
});

app.post("/get", async (req, res) => {
  try {
    const body = req.body;
    let AccessKey = body["AccessKey"];
    let name = body["Name"];
    let key = body["Key"];

    let entrykey = name + key;
    console.log(body);
    let got;
    let from = cache[entrykey + ";" + AccessKey];

    if (from) {
      got = from[0];
      console.log("mem got");
    } else {
      got = await getAsync(entrykey, AccessKey);
    }

    res.status(200).send({ got });

    let u = getunix();
    let c = {
      [0]: got,
      [1]: u,
    };

    cache[entrykey + ";" + AccessKey] = c;
  } catch (error) {
    res.send("nil");
  }
});

app.listen(process.env.PORT || 3000, () => {
  console.log("Server is running");
});

4 Likes

I think your module is great, I love the motivation behind it. My only suggestion is you should mimic Roblox DataStoreService API completely and also add additional methods that are lacking from the original that the community is dying to get

3 Likes

glitch memory? not even saved in a disk? I dont think this is safe.

5 Likes

Is this stable, Cause when it come to data we have to be extremely careful - :disguised_face:

6 Likes

Hey what abt people spamming data causing trouble for every one else?

3 Likes

thats not how it works but whatever

ill look into a fix! thinking about making people remix it

1 Like

i edited it so now you have to remix it

1 Like

i mean if u update a key 2 times in less than 10 seconds it updates in the memory and sets after 10 seconds of 0 updates

1 Like

the issue is: not everyone have a glitch account :confused:

1 Like

its free to make one so that isnt really an issue

1 Like

what if you don’t have an email (you dont need an email to make a roblox account)

1 Like

then dont even bother making an account?

5 Likes