104 points bashtian 2 hours ago 53 comments
I always had the problem that building HTML pages is really simple now, but trying to save data required hosting it somewhere, and sharing it afterwards was not easy. Over the last few months, I've been building an app called Capsule (it’s also the file extension name) written in Rust with Tauri 2.0 that allows packing an HTML app and its data into a single SQLite file.
The HTML file and any related assets are directly embedded in the database. User data can either be saved as a localStorage key/value store or via a MongoDB-inspired collections API as documents, saved in a table in the file. You can also save other assets, like PDF files or images, directly in the database to keep different documents together. All data can be easily exported to CSV or JSON if needed.
Privacy and security were a big priority for me, so documents cannot do anything out of the box. They don’t have direct access to the file system and they require permission to access the internet. The permission model is still something I’m working to improve. Capsule documents can also use local or remote AI models for document specific AI features.
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.
I’m planning to open up the file format specification for the 1.0 version of the app so other apps can read or write Capsule files.
You can try it out in the web preview at https://withcapsule.app/preview with pre-built templates or use any AI provider of your choice to create a custom, Capsule-optimized app by using the following prompt:
"Please read the app wizard instructions at https://withcapsule.app/prompt.txt and help me design an app.“
I’m still working on the file format but there are migrations for each new version, so data should never be lost when using newer versions of the app in the future. Please let me know if you have any ideas or use cases where this might make sense or does not work.
andai 2 hours ago | parent
How would I know if I need this, vs something else?
bashtian 1 hour ago | parent
lewisjoe 2 hours ago | parent
Isn't html/css a better distribution mechanism as most computers already have the tech to run them?
bashtian 1 hour ago | parent
paweladamczuk 1 hour ago | parent
yoz 44 minutes ago | parent
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(['<!DOCTYPE html>\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.Jonovono 18 minutes ago | parent
Saw it on HN a few weeks back
alexis2b 1 hour ago | parent
Dwedit 1 hour ago | parent
Hence 200MB applications that are complete copies of the Chromium browser to run under 1MB of actual web code.
throw101010 1 hour ago | parent
I've experienced the same limits building small tools for myself and friends that I wanted to contain in a single HTML file without external dependencies... but I understand why the same project without these restrictions could easily become malware, and ones that could be easily propagated.
derpyzza 8 minutes ago | parent
lukasbm 1 hour ago | parent
ProfDreamer 45 minutes ago | parent
pmkary 2 hours ago | parent
eleventen 1 hour ago | parent
https://developer.mozilla.org/en-US/docs/Web/API/File_System...
bashtian 1 hour ago | parent
ramon156 47 minutes ago | parent
al_borland 11 minutes ago | parent
That feels like a big barrier, almost like a Java runtime.
eleventen 5 minutes ago | parent
I prefer worse UX for the sake of standards and zero install, but many people would prefer the opposite. I don't think Capsule is intended for the HN crowd.
zackify 1 hour ago | parent
gadders 1 hour ago | parent
I'm having Lotus Notes flashbacks.
dgf18 1 hour ago | parent
lolakutty 1 hour ago | parent
bashtian 55 minutes ago | parent
lolakutty 7 minutes ago | parent
>Keeping the data schemaless makes it also easier for merging data or importing data from a CSV.
Not sure how it makes easier. There is always an implicit or explicit schema. IMHO explicit is often better.
fdeth 1 hour ago | parent
blamestross 1 hour ago | parent
bashtian 59 minutes ago | parent
redog 1 hour ago | parent
jawns 53 minutes ago | parent
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 would think the state would change at least occasionally, because otherwise there's little reason to use a DB.
Alternatively, you can just host it on the web, the DB state dynamically updates, and it's automatically available to anyone with app access. Isn't that a lot simpler?
Reviving1514 27 minutes ago | parent
Concurrent editing wouldn't work, though.
latexr 16 minutes ago | parent
You’re glossing over the recurring cost and annoyance of dealing with the hosting and having to secure the data. This way you just share and it’s local.
Sure, if you have to share data between people, your points are valid. But this seems like a way to build apps geared for individual users, like a notes or recipes app.
tamimio 52 minutes ago | parent
bashtian 29 minutes ago | parent
thederf 51 minutes ago | parent
https://github.com/JoshTheDerf/uapp
Demo apps and games: https://thederf.com/uapp/demo/
windsurfer 40 minutes ago | parent
sigmonsays 44 minutes ago | parent
You're gonna end up having to build a complex state sync system to a central DB anyways...
olaulailadila 42 minutes ago | parent
derpyzza 11 minutes ago | parent
dzink 42 minutes ago | parent
razerbeans 38 minutes ago | parent
> 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?
rc-1140 26 minutes ago | parent
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.
Jonovono 22 minutes ago | parent
thesurlydev 16 minutes ago | parent
rglover 1 minute ago | parent
The whole shift to SaaS has decimated software quality and has made most tasks a nightmare to complete (or at best, an obstacle course of multiple tools and "upgrades" and other bs).
domh 8 minutes ago | parent
Do you have any plans to do merging of two versions of the same app? E.g. I send a todo list to someone, they mark some things as done and send it back to me. Will that merge into my copy if I've added some more items or would it open as a "fresh" app?