Simple owner-writable storage

I’m using Glitch to help my kids make websites for themselves, and I’d like to put together some pages that they can self-author. For example:

  • Let them make their own Eliza bot – no web programming, but I want them to be able to create their own conversation rules in the web page, and then for other people to be able to interact with their bot.
  • Paste notes or stories into a text box.
  • Let them make text-only pictures (Rogue-like).
  • Any kind of self-editing page.

It’s not enough to use localStorage because the whole point of doing this on a webpage is to share the results with everyone else. But setting up a server, with a database, and an authentication system seems like a lot of effort. On top of that I’d need authentication, because I don’t want anyone but the project owners (me and the kids) to be able to write data.

I’m imagining a simple JavaScript library and API that allows a project owner (and no one else) to save data to a specific location (maybe to keep things simpler only to a particular subdirectory, e.g., /storage/). The data could be fetched using fetch() (the data being public files).

I imagine an API like:

async function save(filename, data) {
  // Only the project owner can call this
  // data can be a blob, which is bytes plus a content type,
  // or an object, which would be serialized as JSON
  // Maybe filename is checked to make sure it matches the type of the data
  // Subdirectories ("somedata/example.json") are automatically created on save
}

async function canSave() { ... }

async function exists(filename) { ... }

async function list() {
  // Returns [{filename, contentType, length}, ...]
  // Subdirectories are automatically traversed
}

async function read(filename) {
  // Not much different than fetch(), 
  // though it returns a blob or object based on the content type
}

A simple key value store like Endb might work if make /storage/ run a get method on the database. Make sure to rate limit your database set method otherwise someone will spam it

3 Likes

Hi ian, welcome!

Maybe this is a dumb avenue of enquiry but humour me…

Why not just let them use Glitch as the editor? Approaching your use cases:

  1. Eliza - I haven’t looked at the format of what you feed Eliza but could you set up an Eliza site for them on Glitch that loads conversation rules from a simple behind-the-scenes file, and then let them use the Glitch editor to change that file collaboratively?
  2. Set up a simple markdown-to-html site for them and show them where to paste their stories into the markdown file?
  3. Set up an HTML site that reads from a directory of plain text files that they can edit (in Glitch), displays the content in <pre> tags and, optionally, uses AJAX to navigate from one picture to the next?
  4. The most basic self-editing page is to let them mess around with the README.md and see how it affects the output on the project page (glitch.com/~projectname), this way they can make words, pictures, formatting, without HTML

I hope these ideas help. I think you can get your kids going with this stuff without having to reinvent auth by simply using what Glitch provides.

Happy to continue the conversation about this, especially as I may have missed the point :slight_smile:

4 Likes

While this seems like a neat idea, this would take a while for Glitch to set up and there are a good deal of work arounds.

Why not teach your students SQL? I consider the SQL family of languages to be lifelong languages, meaning that they don’t become obsolete like many languages become overtime.

Endb is very easy to learn as it simplifies SQL.

You could even use something like JSONing, build by a community member @khalby786. It allows you to store data in .json files without the risk of corruption.

You could even go full in and teach them something like SQLite or MySQL, easy to get the hang of languages.

3 Likes
1 Like

I think you might have missed that these aren’t students per se but his kids… sounds like fairly little kids too. I think he’s just looking for a no-code way for these little ones to have fun with the web without having to learn any languages. That’s my reading :slight_smile:

2 Likes

How about website builders like Wix and Weebly? No code but create awesome websites and host it for free.

Hi @ianbicking - I think these are great ideas! We don’t bake libraries into Glitch code (we don’t want to lock folks’ apps in and have them only work on Glitch) but I think I (or anyone here in the forum!) may be able to build a good remixable app to abstract file creation/save. You can also find a bunch of ready to remix storage apps on glitch.com/storage.

As for the project-owners-only part, we know a lot of folks in here have been asking for something like a built-in glitch auth and all I can say for now is that we hear y’all loud and clear! :eyes::hammer_and_wrench:

7 Likes

Ok, something new is definitely coming up…sounds fishy

3 Likes

Programming can be cool too, but there’s lots of different ways to compose new and interesting things that can live on the web – my goal with this suggestion is to make it easier to build new composition tools in Glitch. It would be reasonable to move Eliza rules into a text file and edit it via the editor, but anything more WYSIWYG will be hard (images, positioned text, choose-your-own-adventure with nonlinear composition, map setup, etc).

@jenn: the library part of this might be distracting. The platform functionality I’m suggesting is the ability for an author to save resources from the browser where the author is logged in. So no second authentication system, no moderation issue (site content has all been composed by the site owner), practically no moving parts except for a chance to use Glitch to make editors to make Glitch sites.

Glitch auth would help, but it would be a lot more complicated and monolithic – everything turns into an app instead of an editor. Editors can coexist with each other (including with the built-in Glitch editor), but apps are jealous :wink:

Sorry, I must have misread :sweat_smile:

Ah so you mean more of a no/low-code offering besides the editor?

2 Likes

you know I’ve always wanted to make it possible to code node.js via a graph editor. nodejs has many modules and when you piece them together you make amazing things

oh, I actually didn’t realize this was a feature request until now

Hi, some users have made apps where you fill in a few fields and it simply builds a site from that.

@RiversideRocks ^^^^