logoalt Hacker News

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

237 pointsby bashtiantoday at 1:31 PM109 commentsview on HN

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.


Comments

mgtoday at 4:18 PM

> but trying to save data required hosting it somewhere

With the File System Access API, webpages nowadays can read and write local files just like desktop applications:

https://developer.chrome.com/docs/capabilities/web-apis/file...

Try this text editor for example:

https://googlechromelabs.github.io/text-editor/

It works nicely on Desktop and Mobile.

show 3 replies
nater5000today at 4:23 PM

I don't know, this seems like an idea that maybe works in a specific context being generalized past the point of the original idea making sense.

If the user needs to download a specific application to run this these web apps, then why not just send them that initial application in the first place? Why jump through the hoops of using Capsule when the same hoops can be jumped through to get to the same endpoint?

If this was a near-universally adopted application, then it'd make sense. But it's not, and the closest thing we have to that are browsers... which already do what you're describing?

Bundling data with the application makes sense, but is also only appropriate in pretty narrow circumstances. If I'm willing to ship my data with the web app, then I'll just embed the data in the HTML file. If the expectation is that the user will modify this data, then I don't think I'd want to ship it like this.

show 2 replies
zarrdoztoday at 7:38 PM

This would be great if it evolved in a universal format/spec/feature supported by all major browsers. Only then you'd have to deal with cross web engine compatibilities. And if capsules need to do something non-trivial then you need to consider all the security aspects of having system, file or network level access. Just like any executable. Otherwise with custom app to run capsules it feels like something that can be vibe coded with electron/nw.js rather easily.

But there is something compelling in the idea - there is need for an interactive smart document format that you can share around easily. Kind of like a next gen markdown derivative cross with jupyter notebook where you bundle data, live parametric visualizations, code, audio, video, asciicinema like playback, comments, metadata, file artifacts etc

jawnstoday at 3:14 PM

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 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?

show 2 replies
razerbeanstoday at 3:29 PM

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?

show 1 reply
thederftoday at 3:16 PM

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/

show 2 replies
m-p-3today at 4:29 PM

It kinda reminds me of MS Access, which ended up being a pain in the butt for IT departments, but also covered a need within some department with limited resources.

Really curious to see where this goes. Do you plan to open-source the client, or simply make the file specification open when stabilized?

show 1 reply
elevententoday at 2:16 PM

You can get a cheap approximation of this with chromium browsers + Filesystem API and a PWA manifest for that native-ish feel. AI has reignited my interest in building based 100% on browser native features.

https://developer.mozilla.org/en-US/docs/Web/API/File_System...

show 1 reply
veqqtoday at 5:40 PM

Decker works similarly to this (without the SQL-lite, but directly in the single flat html file which can be statically hosted or passed around, and includes an editor for itself!) https://github.com/JohnEarnest/Decker

lewisjoetoday at 2:06 PM

This is great. Curious: this requires users to have a host app installed on their machine that can read .capsule file right? Won't that be a point of friction for distribution?

Isn't html/css a better distribution mechanism as most computers already have the tech to run them?

show 3 replies
olaulailadilatoday at 3:25 PM

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

show 3 replies
probablyStimmedtoday at 8:37 PM

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?”

rc-1140today at 3:42 PM

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.

andaitoday at 2:05 PM

That's pretty cool. But who is this for? What problem does it actually solve?

How would I know if I need this, vs something else?

show 1 reply
thesurlydevtoday at 3:51 PM

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.

show 3 replies
domhtoday at 3:59 PM

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?

show 1 reply
redogtoday at 2:55 PM

This seems ripe for an injection attack. Can it be inspected before running?

gadderstoday at 2:29 PM

>>Capsule packs your entire app — UI, data, and everything — into a single portable .capsule file.

I'm having Lotus Notes flashbacks.

nzoschketoday at 4:45 PM

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

tomberttoday at 5:16 PM

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

4ndrewltoday at 8:12 PM

It's 1990s Microsoft Access but with AI

dzinktoday at 3:25 PM

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.

starcast2026today at 5:37 PM

Sorry I am confused. If you(u1) share a link (html page) with your friend (u2), they fill data/form, then it get saved in u2's desktop. How does u1 see it?

show 1 reply
Brajeshwartoday at 5:26 PM

Personally, you lost me at `.capsule`. I assume this is your format? Now, what happenss when you are not around or I don't have access to you when it is needed most?

manlymuppettoday at 6:20 PM

Is the file still fairly readable as plain text when opened with any old text editor? Is this asking too much?

xyreztoday at 4:38 PM

This sounds like a Smalltalk image, just without the self-modifying capability, which is what makes this whole idea of code+data in a single file so appealing IMHO.

dgf18today at 2:36 PM

Many big companies are starting now to test agentic coding to automate business processes. This could be a nice tool to distribute apps for workflows that aren't big enough to justify the operational overhed of maintaining a traditional web app backend. Nice!

writtenonetoday at 5:58 PM

This is proprietary. Yuck

smy20011today at 5:26 PM

Do you plan to open source it? Seems like a proprietary app & spec.

sigmonsaystoday at 3:23 PM

if state is best shared, why keep it w/ the code?

You're gonna end up having to build a complex state sync system to a central DB anyways...

uneeknametoday at 4:33 PM

Is this project open source?

Jonovonotoday at 3:45 PM

“Capsule.app” is damaged and can’t be opened. You should move it to the Trash.

lolakuttytoday at 2:37 PM

What is wrong with using IndexedDB?

saejoxtoday at 5:16 PM

like downloading exe files from the web. but we should invent something to catch bad actors putting bad stuff in them

bbstatstoday at 6:08 PM

this is great for the 'make a webapp for me and my family' thing

altern8today at 6:15 PM

Looks amazing, I don't know if this is legit or useful feedback, but I navigated away after reading "Generate & update apps using AI".

I'm so tired of AI everywhere and everything trying to sell to you because of AI this and AI that.

I think that at this point we assume AI will be available if it makes sense for the product, making it a selling point to me is like slapping "No cholesterol!" on lettuce.

fdethtoday at 2:45 PM

So, let’s do Visual Basic again, but this time with LLMs and web stuff.

tamimiotoday at 3:15 PM

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

show 1 reply
annrap1dtoday at 7:01 PM

Is this open source ?

xd1936today at 3:26 PM

"No cloud. No accounts. Just share it." close tab

show 3 replies
nininininotoday at 5:00 PM

I'm surprised to not see Pocketbase mentioned in this thread at all.

https://pocketbase.io/docs/

"PocketBase is an open source backend consisting of embedded database (SQLite) with realtime subscriptions, builtin auth management, convenient dashboard UI and simple REST-ish API. It can be used both as Go framework and as standalone application.

The easiest way to get started is to download the prebuilt minimal PocketBase executable"

rvztoday at 4:56 PM

Attackers / Malware Developers: "A document as a web app?, What could possibly go wrong?"

pmkarytoday at 2:07 PM

Really really nice

tonymettoday at 2:52 PM

is the idea this would be hosted or run locally (like Electron)?

blamestrosstoday at 2:51 PM

Seems very "packable into a standalone binary" but doesn't seem like that is a planned use case.

show 1 reply
zackifytoday at 2:19 PM

love this idea!

taohtoday at 8:25 PM

[dead]

bezkotoday at 2:12 PM

[flagged]

atikhabibtoday at 5:08 PM

[flagged]

🔗 View 5 more comments