When you create a new repl if you look to the left you will see a floppy disk icon in the menu bar. That’s Repl.it’s new key-value database, built into your repl!
To access the database, you can execute very, very simple curl commands or use a library.
Some replers have already made libraries to interact with the database such as:
Repl.it provides an official client for Go.
When you click on the floppy disk it should provide you with the some instructions. They will be summarized here as well:
curl $REPLIT_DB_URL -d '<key>=<value>'
You can find a key's value:
You can delete a key:
curl -XDELETE $REPLIT_DB_URL/<key>
You can list the keys:
curl $REPLIT_DB_URL --get -d 'prefix=<key> or curl "$REPLIT_DB_URL?prefix=<key>"
This is the environment variable we have created with your repl. It is the key that will allow you to access your database.
The clients listed above take care of using
REPLIT_DB_URL for you. But if you want to write your own client or use Database from a language that doesn't yet have a client, here are two examples:
import os print(os.getenv("REPLIT_DB_URL"))
REPLIT_DB_URL provides full access to your database. Therefore, you should take care not to expose it to the world or share it with people you don't trust.
The value of
REPLIT_DB_URL changes from time to time, so we recommend that you not copy it elsewhere. Subsequent reads by the same process will see the same value. We will restart your repl if we need to change it after it has been read.
The limits are currently:
There are rate limits that apply to all operations. You will receive an HTTP 429 if you exceed them. We recommend implementing an exponential backoff and retry to handle this case.