Upstash provides a serverless Redis database, which can be used as a key-value store of up to 1mb with a free account.
Create an Upstash account
Create a database
- Click Create database
- Name: whatever you want.
- Type: Regional
- Region: Iowa (us-central1), because it’s closest to Val Town’s servers.
- Enable TLS for security.
Add REST credentials to Val Town environment variables
- Go to val.town/settings/environment-variables
- Click New env variable.
- Set the names to
- Copy & paste in the value
- Click Add
Set some data
If you set it up correctly, you should be able to Run this Val and have it return the same results from your own Upstash database
JSON is automatically stringified and parsed so you can set it and get it directly. You can store a JSON object of up to 1mb this way with a free acount.
Thanks to @mattx for contributions to this resource!