Upstash provides a serverless Redis database, which can be used as a key-value store of up to 1mb with a free account.
- 1. Create an Upstash account
- 2. Create a database
- 3. Add REST credentials to Val Town Secrets
- 4. Set some data!
- 5. Saving JSON
- 6. Further resources
1. Create an Upstash account
2. 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.
3. Add REST credentials to Val Town Secrets
- Go to val.town/settings/secrets
- For
UPSTASH_REDIS_REST_URL
and theUPSTASH_REDIS_REST_TOKEN
each: - Click New secret.
- Set the names to
upstashURL
andupstashToken
, respectively - Copy & paste in the value
- Click Add
Upstash:
Val Town:
4. Set some data!
If you set it up correctly, you should be able to copy & paste this Val and have it return the same results from your own Upstash database
5. Saving JSON
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.
6. Further resources
Thanks to @mattx for contributions to this resource!