Top
Best
New

Posted by bashtian 20 hours ago

Show HN: Capsule – Single-file web apps that save their data into SQLite(withcapsule.app)
Hey HN,

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.

327 points | 136 commentspage 3
redog 19 hours ago|
This seems ripe for an injection attack. Can it be inspected before running?
thesurlydev 18 hours ago||
With the battle of AI versus human agency raging I have a prediction that local-first desktop apps are going to make a comeback. It's nice to see something like this make it easier.
rglover 18 hours ago||
I agree and would love to see a shift back to what we had circa ~2009-2010: high quality, desktop and platform-specific apps that you could just pay for once (the best variant for everyone being an app that works indefinitely, but only receives updates if you renew your license every year).

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).

Watchtrail 12 hours ago||
[flagged]
explorigin 17 hours ago|||
In preparation for the upcoming [Android lockdown](https://keepandroidopen.org/) I've started vibe-coding some PWAs for apps that I like so I can have a webby version of them with no ads and no Google/iOS lock-in. I like this, it feels like a good direction.
dsparkman 17 hours ago|||
I know that I personally have a handful of personal local only apps under development, that in the past I would have reached for a web solution.
krapp 9 hours ago||
It's depressing that everyone decided Electron was the final form of all applications and that native apps were dead until AI came along, and if native apps come back it will only be as vibe-coded slop. It's like we've just moved from once circle of hell into another.

Also Show HN is supposed to be for posting code that the community can discuss and play with. Plain advertisements and landing pages aren't allowed.

francislavoie 11 hours ago||
I've been doing this with bun lately, single file app with built in SQLite. JS runtime which serves the app with SSR, websockets, and all that good stuff. The binary size is not that small, but that's usually worth the convenience.
tombert 16 hours ago||
I remember a million years ago, when I was writing apps with Cordova/Phonegap, I would use Web SQL to do all my storage [1]. This kind of reminds me of that.

I always thought that there should be an easy way to export it, but I don't think that ever materialized.

[1] https://en.wikipedia.org/wiki/Web_SQL_Database

domh 18 hours ago||
I wish there was a way to see the underlying HTML/JS and schema of these container files. Maybe you can on the desktop app? But it would be cool to see what's happening under the hood.

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?

bashtian 16 hours ago|
Merging works already but is a little bit hidden under the data editor function in the Capsule edit menu. Currently the last record update wins, but a merge UI is planed to do manual conflict resolving.
nzoschke 17 hours ago||
Looks neat. Shuffling artifacts around is more important than ever with all the agentic web sites and apps we are making.

Im finding a lot of success embedding metadata and data in SQLite files for music management.

Having a spec for a single file with a schema, version, metadata and binary blobs is super easy to shuffle around.

Agents crush reading and writing the data and writing tools around the spec.

All of a sudden things like backup, sharing and dedupe are snapping into place for my music library.

More thoughts here: https://deadca7.com/blog/deadca7-open-music-database-specifi...

dzink 18 hours ago||
Looks useful, but the Mac download shows "“Capsule” is damaged and can’t be opened. You should eject the disk image." and then you realize it could be ripe for malicious payloads as well.
rupertsworld 11 hours ago||
This reminds me a little bit of https://webtil.es/, which can be either bundled standalone files or hosted, and add a special secure execution context.
rtpg 5 hours ago||
I feel like this is close to a good idea.

What I would want to see is a version of this that lets me write an app that can write to the DB through an API, and then have a google drive-esque "host this for me" thing.

A focus on local-first really misses the point IMO. Like sure it's good it can be run locally, but really most people have a distribution problem. Be a distribution solution!

The thing I would do involves having the hosting just be available by dropping the capsule into the google drive/dropbox-y thing, and then having it be that you can just copy/paste the file to someone _and it carries over the data and everything by default_.

For a lot of people the "thing" is the app + the data. Sometimes you want to decouple them but a lot of times you don't want to.

I think it would be very rare for someone to want to share the single-file bundle just without data.

probablyStimmed 13 hours ago|
I like that there are so many haters who don’t get it or don’t think it’s useful and then there are 5 or so very similar projects in various stages of development listed in the comments. It’s giving “what if I don’t like beans?”
More comments...