-
Notifications
You must be signed in to change notification settings - Fork 1
ReplDB+ aka ReplAPI.it Database Interface #42
-
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:
-
Install the package on a Repl (it has to be a Repl environment as part of security measures)
$ npm install replapi-it
-
Use the package in your code
import ReplAPI from 'replapi-it'; const replapi = ReplAPI({ username: 'your-username-here', experimentalFeatures: true, });
-
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 });
-
Set the createDatabaseFlag to true to avoid errors working with the database
// ... const replapi = ReplAPI({ username: 'your-username-here', experimentalFeatures: true, createDatabaseFlag: true }); // ...
-
Initialize the database
// ... async function myFunction() { await myDatabase.init(); } myFunction()
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 1
Replies: 2 comments 6 replies
-
@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.
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
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
Beta Was this translation helpful? Give feedback.
All reactions
-
Actually that will be a part of the Database.init() one-time-use function :)
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
For ReplDB+, do you plan on storing the data through Replit's database feature or through a file?
Beta Was this translation helpful? Give feedback.
All reactions
-
@BD103 ReplDB+ will be an overlay on the original ReplDB, so it will use Replit's database however not the package itself.
Beta Was this translation helpful? Give feedback.
All reactions
-
You can certainly check it out by looking in esm/src/classes/Database.mjs!
Beta Was this translation helpful? Give feedback.
All reactions
-
Got it!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1