Hacker news

  • Top
  • New
  • Past
  • Ask
  • Show
  • Jobs

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

379 points by bashtian 5 days ago | 167 comments | View on ycombinator

mg 5 days ago |

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

ezst 4 days ago |

For the curious, the note taking app Trilium has a "standalone" mode¹, built on top of OPFS² and sqlite OPFS persistence, such that your notes (~web pages here) are stored in sqlite locally, offline-available, optionally syncing with a remote, while being a pure local web app (after the app assets have been downloaded once). If you want to take your whole personal notes/wiki/pkms for offline access on a device you don't own/have install rights, that's the only way I know. I suspect that OP could have gone this route instead had he known about it?

¹: https://app.triliumnotes.org/

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

³: https://sqlite.org/wasm/doc/trunk/persistence.md#opfs

nater5000 5 days ago |

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.

jawns 5 days ago |

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?

thederf 5 days ago |

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/

eleventen 5 days ago |

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

razerbeans 5 days ago |

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?

zarrdoz 5 days ago |

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

m-p-3 5 days ago |

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?

olaulailadila 5 days ago |

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

lewisjoe 5 days ago |

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?

andai 5 days ago |

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?

veqq 5 days ago |

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

andix 4 days ago |

I really like the idea. It's so easy to create small tools with AI now, but hard to install them as local apps or share them.

But I'm missing a few relevant features:

1. syncing data and apps (capsules) between my devices. not necessarily over a single SaaS, but maybe p2p or some existing service

2. I think data and apps should be separated, I might want to share an app with someone else without sharing the data

3. Apps should support updates, install the same app again and just replace the code for the existing app, but keep the data. Also share updates either as a file or publish apps to a repo (just a folder of files on a public http server or github repo)

Both keeping data in sync between devices and providing offline capabilities is hard, I know.

redog 5 days ago |

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

sago350 3 days ago |

I’ve been experimenting with Capsule and really like the concept.

I confirmed that external REST APIs work from Capsule via fetch(). I’d like to use Capsule as a lightweight/offline client for Claris FileMaker Server, but FileMaker Data API does not support CORS or OPTIONS preflight requests, so a direct request currently fails with TypeError: Load failed.

Would you consider providing a native HTTP API through the Capsule/Tauri host, e.g. capsule.http.request()?

That would allow:

Capsule → Native HTTP → FileMaker Data API

without requiring a separate proxy server, while still allowing Capsule to control network access through its permission system.

I think this would be useful beyond FileMaker too — for internal/legacy REST APIs, NAS devices, IoT devices, and other local-network APIs without browser-compatible CORS support.

The idea of a self-contained Capsule app that works offline, stores data locally, and syncs directly with an existing business system when online is especially interesting to me.

rc-1140 5 days ago |

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.

gadders 5 days ago |

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

I'm having Lotus Notes flashbacks.

shamsalom94 about 17 hours ago |

https://upshot.fyi/

solves the storage issue

thesurlydev 5 days 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.

xyrez 5 days ago |

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.

domh 5 days 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?

tombert 5 days 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

francislavoie 4 days 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.

dgf18 5 days ago |

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!

flossly 4 days ago |

I miss from the home page a link to github and/or a description of it's license and/or some code of an actual capsule app (what backend language is used? -- I have no clue and cannot find out) and/or does this bundle Node?

While I wish your project success and like the simplicity of Sqlite; I prefer to start with Postgres. PG has many of the benefits (x-platform, free, embeddable, etc) that sqlite has, but also provides an industrial strength db in case you need to scale at some point, or want to use more complicated constructs.

nzoschke 5 days 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...

rramon 4 days ago |

Whats the advantage over plain single html files/apps using colocated css and use the browser/web view local storage? Those could be saved as PWAs or not?

dzink 5 days 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.

ninininino 5 days ago |

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"

whizzter 4 days ago |

I was literally thinking of building something similar this summer, one requirement I had however was that it should be runnable/shareable over the web (it's web-tech after all).

My use case was storing a family tree with data/app that could be shared, and family members they would be able to add to it and later merge also.

Ie, it's a webpage you can dump anywhere, then download/edit locally.

undefined 4 days ago |

undefined

cush 4 days ago |

It seems a bit ridiculous but there’s definitely something here. I have been really enjoying building similar single-file prototypes with agents. They seem to have no trouble dealing with all the code being piled in one big file and you can skip all the complexity, time, and token cost of of bundling.

eternityforest 3 days ago |

I've always wanted something like this!

But I'd want to see some kind of clouds storage sync to actually use it for anything practical.

Maybe it could include YJS, with agents taught to use it, and save/load them to Google Docs?

soltanov 4 days ago |

I really like this idea. It will be useful for local first users for simple applications. Is it open source? If yes, can you share the link? if not, how can we send templates under our name? are there any template or app marketplace? @bashtian

molsongolden 4 days ago |

Adding to the chorus of “this looks like X old thing”.

This reminds me of Clipper/dBase software tools. One of my favorite pieces of software was a tiny program file + flat-file .dbf for storage. Drag and drop the folder to install or share.

rupertsworld 4 days 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.

lolakutty 5 days ago |

What is wrong with using IndexedDB?

admiralrohan 4 days ago |

Interesting concept. Looks like zip replacement. UX improveemnt. I have one concern, can my machine natively read capsule file format? Else no one would open the shared files.

probablyStimmed 5 days 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?”

tamimio 5 days ago |

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

ferflowhq 4 days ago |

Love the UI. Simple and clean. Html instead of full app is nice idea. Make online sharing for collaboration edit, but yep need cloud storage.

Brajeshwar 5 days ago |

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?

starcast2026 5 days ago |

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?

sigmonsays 5 days ago |

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

manlymuppet 5 days ago |

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

anderspetersson 4 days ago |

How do I build apps that save data to the .capsule file, beyond the templates?

blamestross 5 days ago |

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

rvz 5 days ago |

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

shepherdjerred 4 days ago |

nbhankes 4 days ago |

This is great. My initial thought is to create a zettel for my research projects.

undefined 4 days ago |

undefined

radicalbit 4 days ago |

i built something similar back in 2013, but it used to keep the persistent state in the url params (obv not a good storage backend), and you would get a super long url to share over facebook haha

Jonovono 5 days ago |

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

uneekname 5 days ago |

Is this project open source?

smy20011 5 days ago |

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

fdeth 5 days ago |

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

writtenone 5 days ago |

This is proprietary. Yuck

tonymet 5 days ago |

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

rtpg 4 days 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.

yuedongze 5 days ago |

We are so back. I remember ActiveX in the old days

undefined 5 days ago |

undefined

4ndrewl 5 days ago |

It's 1990s Microsoft Access but with AI

saejox 5 days ago |

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

MattCruikshank 4 days ago |

Neat!

Another way to achieve something like this is Cosmopolitan C Compiler, Actually Portable Executables. For example, Redbean. (Jart, all of your certs are bad! I can't open your websites any more!) http://justine.lol/

It's a binary that can run on Windows, Mac, Linux, and it is also a zip file. The application can read the zip file and on several systems (not Windows), it can self-modify the zip file. Including hosting SQLite inside the ZIP file.

jayde2767 4 days ago |

Was Capsule written in Capsule?

edwardbonnett 4 days ago |

could see this being handy for a little game with the save bundled in

bbstats 5 days ago |

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

altern8 5 days ago |

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.

xd1936 5 days ago |

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

pmkary 5 days ago |

Really really nice

xori 4 days ago |

my-bookreport-v2-final-final-done.capsule

annrap1d 5 days ago |

Is this open source ?

zackify 5 days ago |

love this idea!

Studui81Labs 1 day ago |

[flagged]

p32929 3 days ago |

[flagged]

mrhcon 3 days ago |

[flagged]

Studui81Labs 3 days ago |

[flagged]

eliauelkouby 4 days ago |

[flagged]

bezko 5 days ago |

[flagged]

forest_brothers 4 days ago |

[flagged]

tinyutil 5 days ago |

[flagged]

atikhabib 5 days ago |

[flagged]

diyzt43bj about 18 hours ago |

[flagged]

taoh 5 days ago |

[dead]

vancekai 5 days ago |

[dead]

JonathanCross 5 days ago |

[dead]

DarmokTanagra 5 days ago |

[dead]

orliesaurus 5 days ago |

Is this a durable object? /s