DataStoreService in NodeJS

A Node.js wrapper for interacting with the Roblox DataStore API.


![JavaScript Style Guide](upload://8DDQMwIzR9YKL7ANJeRiYiWu2yo.svg) ![Roblox API Discord](upload://hfXFqbV5ccJbyk0WfdNMICatJ0U.svg) ![NPM package](upload://68coDAb176ptReYcKx0GmWttP6e.svg) ![downloads](upload://lPPrNSapaSh3vcRzMQRncnhzgFG.svg)

AboutInstallationDocsCredits

About

RbxDataStoreService is a node module that That allows you to use DataStoreService outside of Roblox.
This project was created because people outside ROBLOX always want to use DataStoreService outside ROBLOX.

RbxDataStoreService allows you to do things you would normally do on the Roblox DataStoreService through a Node.js interface.
You can use RbxDataStoreService along with ROBLOX’s HttpService feature to create scripts that interact with the DataStoreService externally.

Installation

With node.js installed simply run:

# Run this to install RbxDataStoreService locally to your repository. 
$ npm install @mfd/rbxdatastoreservice --save

# Run this instead to install RbxDataStoreService globally so you can use it anywhere.
$ npm install @mfd/rbxdatastoreservice -g

That’s it!

Documentation

You can find the current RbxDataStoreService documentation here (Roblox Wiki) or here (API Reference)

Initial setup

  1. Run RbxDataStoreService.InitializeAsync with the parameters of Cookie and PlaceId. This will store your cookie internally and validate it, but will perform no cookie refresh automatically, it also requires that your cookie have the warning and be valid.
  2. While this works, Roblox .ROBLOSECURITY cookies expire after 30 years of first authenticating them.
  3. You need to store this new cookie somewhere - whether it be in a database, or a JSON file.

Note: By default, InitializeAsync will validate the cookie you provide by making a HTTP request.

Example

This example makes use of the new async-await syntax.

const RBX = require("@mfd/rbxdatastoreservice")
async function startApp () {
    await RBX.InitializeAsync("_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_...", 123)
    // Do everything else, calling functions and the like.
    let DataStoreService = RBX.DataStoreService;
    let DataStore = DataStoreService.GetDataStore('Test', 'global');
    let value = await DataStore.GetAsync('SomeKey');
    console.log(value);
}

Credits

  • nsg - ROBLOX Contractor for the engine team.
  • mfd - Other devs

So yeah, I made this, it is a wrapper for DataStoreServicec, but in JAVASCRIPT, I will make one for C++ and Python later.

33 Likes

So I am aware of the bugs it contains, working on fixes now, 2.0.0 will most likely be a stable build, right now clone the github repo and Typescript compile it, as that seems to be stable

This seems really useful considering how data is a big part of games, I do wish Roblox makes official datastore web apis soon

These are the official datastore apis

30 years? did you make a typo there? second, how does this work under the hood/internally, how does it manipulate the datastores from a Node project? third, the API reference link seems to be broken.

other than that, seems like an interesting project, I’ll be sure to give it a go when I eventually come around to developing a discord bot or anything like that.

It’s based on actual client code, and no I didn’t make a typo, they literally expire after 30 years
Just authenticated, and the max age was: Tue, 13-Dec-2050 22:49:03 GMT

how old is that account that you’re using right now?

Did you not read my message? I literally just said I authenticated it

no I mean, did you create the account whose cookie you’re using right now, right now?

Cookies are session based, when you log out it destroys that session therefore destroys that cookie. What I am saying is, the cookie will expire 30 years from the date you either signed up or logged in, or it will expire when you log out

And also, if you want to know how I am interacting with the DataStores, refer to this:
https://github.com/mfd-co/RbxDataStoreService/blob/master/src/Classes/DataStore.ts

ah, I misinterpreted the whole discussion, sorry about that. there are cookies as I like to call them, legacy cookies, they are cookies that, technically expire, as you said, after 30 years. new accounts tho, they do not have “legacy cookies”, and they obey the new refresh policy which causes them to reset every now and then, correct me if I’m wrong here.

that’s why I asked how old the account, whose cookie you’re using, is. I was just curious if it was an account with a legacy cookie, feel free to test this theory, by using an old accounts cookie, and a new one’s cookie, and checking how long they both last.

source: Guide to Scripting Bots | Javascript Tutorial | FunCaptcha and New Host Info - #109 by TechSpectrum

1 Like

Howdy! We found that the best work around is to simply go into Incognito, get the cookie, and close the browser.

Do not sign out of that session or get a cookie from a non-incognito mode.

Back when I mentioned “legacy cookies” at the time, it’s because I believe during the captcha change a lot of cookies got reset or something. But had you logged into the account session again it would refresh as normal. Every time you log in, Roblox will generate you a new cookie for a session, this is why not doing incognito can cause it to expire. If they detect a cookie, they will expire it early to refresh a new one.

1 Like

Yeah, so I fixed a few of the bugs that existed

1 Like

This is an epic resource to have, and I notice it doesn’t respect a limit since it looks to be outside of roblox?

1 Like

Can you elaborate on limit? I assume you mean it doesn’t adhere to a queing system

2 Likes

Yea, I was looking through the source and didn’t find much of a limit system anywhere so I assume there is no limit?

1 Like

No, but I can implement it if you want it to exist

1 Like

Great resource, opens up many possibilities! :smiley:

Like @LordMerc I was wondering about limits as well.
Limits per server are clearly described here but limits per game aren’t described as clearly (get limited if requested from “too many servers at once”).
Maybe you could do something with the error codes returned?

It does have limits in the DataSize, key length, scope length etc, but no queuing

1 Like