Live data from Hacker News

Show HN: Capsule – Single-file web apps that save their data into SQLite

withcapsule.app

31–40 of 175 posts

Re: Show HN: Capsule – Single-file web apps that save their data into SQLite

#31
post #5

Earlier quoted context omitted.

The problem is that you can't save the user data in way that you can click a single file, similar to a Word or Excel file. I you think a about it, a Excel spreadsheet is also just UI + data in a single file.

This is a frustration of mine as well, but I vaguely remember someone showing something on HN where the file could essentially save itself, I think they were using some file APIs for that... sadly I can't find the details anymore. But I keep running into the "HTML file opened locally can't update itself" issue repeatedly now that I build tools for myself with LLM agents.

The File System Access API can do this, and it works in local ("file:///") HTML files, but it's only currently supported in desktop Chromium browsers: https://caniuse.com/native-filesystem-api

However, every browser will let you download a new version of the HTML file and save it over the old one - yes, even from a local HTML file:

   const blob = new Blob(['\n' +
      document.documentElement.outerHTML], 
      { type: 'text/html' });
   const a = document.createElement('a');
   a.href = URL.createObjectURL(blob);
   a.download = 'mypage.html';
   a.click();
... but you need the user to do this for every update. So we're back to manual "Save" buttons.

Re: Show HN: Capsule – Single-file web apps that save their data into SQLite

#33
An idea for a killer feature: Make it so that auhors can expose their capsules to the internet, and the people whoe wants to use them(lets call them users) can type the name(lets call it address) of the caplsue into the app, and your program will pull that capsule in the the users device..

Re: Show HN: Capsule – Single-file web apps that save their data into SQLite

#36
post #28

I've been working on this exact idea, with sqlar as the "format specification". Works in the browser, and desktop + Android using Tauri. https://github.com/JoshTheDerf/uapp Demo apps and games: https://thederf.com/uapp/demo/

FYI requests from your demo are being blocked by CORS in Firefox and it never loads.

Re: Show HN: Capsule – Single-file web apps that save their data into SQLite

#37
I love this idea! One of the fallouts from widespread AI adoption that I've seen: They're very good at creating visual artifacts, but if you ever have to provide data in those artifacts, you don't really have a great way to share it without hard coding it.

> One downside with this approach is that multiple people working on it will create different copies. To make it possible to merge different copies of the same file, each data entry has a unique UUID and timestamp.

This was the first thing that popped up in my mind: Changes stemming from two sources and reconciling them. I see that you have a statement about how to handle data entry from different sources, but I don't see exactly how those are reconciled? For instance, if two users have a copy of the .capsule and make changes, then want to share their changes with the other, you have two individual .capsules with different data.

How do you merge them?

Re: Show HN: Capsule – Single-file web apps that save their data into SQLite

#38
post #27

New way to deliver viruses just dropped! Great idea but it can be abused for sure.

The HTML files does not have any permission to access anything on the file system. Ideally the whole app will be running inside a sandbox on desktop, for mobile apps this will be the default anyway.

Re: Show HN: Capsule – Single-file web apps that save their data into SQLite

#39
post #26

My take: If your app needs to update and preserve state (using SQLite or any other DB), it is probably not something you want to pass around as a bundled file. Or at least, it's extremely limiting, compared with hosting it somewhere on the web, which is not that hard to do these days. Think of the workflow: Any time the state changes, you need to email a new Capsule file to whoever else is using the app. And one woul…

Why not on a shared drive like dropbox?

Concurrent editing wouldn't work, though.

Re: Show HN: Capsule – Single-file web apps that save their data into SQLite

#40
This is a really cool and practical idea! Some of my first professional efforts out of college were writing Python mini-apps with Tkinter to replace "abused" Excel spreadsheets. One of my friends working in sales might benefit from something like this, I'll send it his way.

I don't know about the stability/market value of this if you intend to turn this into something that attempts to make money, however. Said friend is currently using stuff like Gemini to generate HTML mini-apps as well; while he's not storing anything in databases, he's able to generate receipts and other things for essentially free.

Post reply on HN