Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

ReplDB+ aka ReplAPI.it Database Interface #42

rayhanadev started this conversation in General Community
Discussion options

Hello! This discussion thread is to pitch ideas and ask questions about the upcoming ReplDB interface, ReplDB+, in ReplAPI.it! I wanted to hear some ideas about what to implement.

What is ReplDB+?

Unlike the original ReplDB, ReplDB+ is an opinionated, easy-to-use database built on top of the existing ReplDB setup. It will hopefully include many features that give ReplDB a feel similar to a modern database. Modeled after Cloud Firestore, ReplDB+ is a NoSQL database with collections that contain documents of data. It will have more expressive functions, ease-of-life methods, privacy features, and more!

- From the issue

I will update the issue with some progress every once in a while and push out the Database class under the experimental features flag. If you would like to test the Database class, do the following:

  1. Install the package on a Repl (it has to be a Repl environment as part of security measures)

    $ npm install replapi-it
  2. Use the package in your code

    import ReplAPI from 'replapi-it';
    const replapi = ReplAPI({
     username: 'your-username-here',
     experimentalFeatures: true,
    });
  3. Create a database using ReplAPI.it

    // ...
    const myDatabase = new replapi.Database(process.env.REPLIT_DB_URL, 'some-salt', {
     ...databaseOptions // Reference the issue for database options
    });
  4. Set the createDatabaseFlag to true to avoid errors working with the database

    // ...
    const replapi = ReplAPI({
     username: 'your-username-here',
     experimentalFeatures: true,
     createDatabaseFlag: true
    });
    // ...
  5. Initialize the database

    // ...
    async function myFunction() {
     await myDatabase.init();
    }
    myFunction()
  6. Use Database Functions! These are all asynchronous. For available functions, visit the issue.

The goal of this class is the make ReplDB easier to use for people on Replit! If you have any suggestions, please let me know in this issue or a thread below.

You must be logged in to vote

Replies: 2 comments 6 replies

Comment options

@rayhanadev I think it would be great if ReplAPI.it not only included ReplDB+, but also normal ReplDB. Based off of Coder100's and replits node client, we add a few more features but still give the developer access to the raw db.

You must be logged in to vote
3 replies
Comment options

rayhanadev May 12, 2021
Maintainer Author

Agreed, I plan on bundling the two into one class and allowing the user to decide which interface.

The main problem with allowing both in one Repl is using ReplDB means all security features are non-existant (i.e. ReplDB+ can determine if a particular Replit User has access to a database and give relevant permissions, however ReplDB allows access to the raw data). ReplAPI.it acts as a proxy and interface to a database, whereas ReplDB is just straight interfacing.

Comment options

maybe add like a thing on the .replapirc which says i agree to use the unsafe ReplDB features or something. Maybe a way to disable it

Comment options

rayhanadev May 12, 2021
Maintainer Author

Actually that will be a part of the Database.init() one-time-use function :)

Comment options

For ReplDB+, do you plan on storing the data through Replit's database feature or through a file?

You must be logged in to vote
3 replies
Comment options

rayhanadev May 17, 2021
Maintainer Author

@BD103 ReplDB+ will be an overlay on the original ReplDB, so it will use Replit's database however not the package itself.

Comment options

rayhanadev May 17, 2021
Maintainer Author

You can certainly check it out by looking in esm/src/classes/Database.mjs!

Comment options

Got it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /