333 points bashtian 21 hours ago 141 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 20 hours ago | parent
How would I know if I need this, vs something else?
bashtian 20 hours ago | parent
lewisjoe 20 hours ago | parent
Isn't html/css a better distribution mechanism as most computers already have the tech to run them?
bashtian 20 hours ago | parent
paweladamczuk 19 hours ago | parent
yoz 19 hours 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 19 hours ago | parent
Saw it on HN a few weeks back
fallinditch 17 hours ago | parent
alexis2b 19 hours ago | parent
Dwedit 20 hours ago | parent
Hence 200MB applications that are complete copies of the Chromium browser to run under 1MB of actual web code.
throw101010 19 hours 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.
Dwedit 18 hours ago | parent
derpyzza 18 hours ago | parent
lukasbm 20 hours ago | parent
ProfDreamer 19 hours ago | parent
pmkary 20 hours ago | parent
eleventen 20 hours ago | parent
https://developer.mozilla.org/en-US/docs/Web/API/File_System...
bashtian 20 hours ago | parent
ramon156 19 hours ago | parent
al_borland 18 hours ago | parent
That feels like a big barrier, almost like a Java runtime.
eleventen 18 hours 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 20 hours ago | parent
gadders 20 hours ago | parent
I'm having Lotus Notes flashbacks.
p2detar 14 hours ago | parent
This capsule thing seems to store the design itself within the database, which is odd to me. I guess I don't get it at 100%.
dgf18 20 hours ago | parent
m-p-3 18 hours ago | parent
lolakutty 20 hours ago | parent
bashtian 19 hours ago | parent
lolakutty 18 hours 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 20 hours ago | parent
blamestross 19 hours ago | parent
bashtian 19 hours ago | parent
blamestross 17 hours ago | parent
I might just be hyper-defensive to any sort of vendor lock-in like a "viewer app".
tonymet 19 hours ago | parent
bashtian 19 hours ago | parent
tonymet 17 hours ago | parent
redog 19 hours ago | parent
jawns 19 hours 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 19 hours ago | parent
Concurrent editing wouldn't work, though.
teraflop 16 hours ago | parent
dizzard 15 hours ago | parent
If a capsule is a recipe, like in one of the examples, that’s pretty cool. If a capsule is a recipe _manager_, then I think it would get messy.
latexr 18 hours 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.
wwn_se 4 hours ago | parent
I do like apps that have sensible export formats though. Having control over my data is important.
latexr 1 hour ago | parent
Citation very much needed. Sharing a link, especially if you’re already at your computer where the app runs, very often means emailing the link.
> The cost of cloud storage is almost nothing
“Almost nothing” is not nothing. I really wished we stopped with this idea of “I can afford it, so everyone can too”. And you’re summarily ignoring the very important point of the annoyance (especially for someone inexperienced) and security aspects, which are huge.
> A notes app that don't sync between all devices is just a text editor to most.
Maybe for you. I recommend you observe more regular people.
Also, that is a single example, not representative of the whole.
lateatdesk 11 hours ago | parent
kaninricer 5 hours ago | parent
bithammerthunde 2 hours ago | parent
Tell any non-tech person that.
alwillis 57 minutes ago | parent
bithammerthunde 20 minutes ago | parent
tamimio 19 hours ago | parent
bashtian 19 hours ago | parent
thederf 19 hours ago | parent
https://github.com/JoshTheDerf/uapp
Demo apps and games: https://thederf.com/uapp/demo/
sigmonsays 19 hours ago | parent
You're gonna end up having to build a complex state sync system to a central DB anyways...
olaulailadila 19 hours ago | parent
dzink 19 hours ago | parent
xd1936 19 hours ago | parent
razerbeans 19 hours 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?
bashtian 18 hours ago | parent
wwn_se 4 hours ago | parent
rc-1140 19 hours 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 19 hours ago | parent
thesurlydev 18 hours ago | parent
rglover 18 hours 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).
dsparkman 18 hours ago | parent
explorigin 18 hours ago | parent
krapp 10 hours ago | parent
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.
domh 18 hours 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?
bashtian 17 hours ago | parent
orliesaurus 18 hours ago | parent
mg 18 hours ago | parent
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.
pspeter3 18 hours ago | parent
jg0r 17 hours ago | parent
Lord_Zero 16 hours ago | parent
realPubkey 2 hours ago | parent
emaro 18 hours ago | parent
simongray 17 hours ago | parent
maelito 17 hours ago | parent
tbrockman 16 hours ago | parent
simongray 15 hours ago | parent
whizzter 2 hours ago | parent
bithammerthunde 2 hours ago | parent
mg 1 hour ago | parent
window.showOpenFilePicker()
What Firefox supports is a "File System API" which creates something similar to the other old ways of storing data in a browser, like cookies and indexeddb. You cannot use it to edit normal files on your disk.This is my main gripe with Firefox. They force their users to either store everything in the cloud or go through the arcane "download" workflow where you have to manually save files.
DANmode 7 hours ago | parent
darkvertex 17 hours ago | parent
The File System Access API makes it possible.
nater5000 18 hours ago | parent
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.
pbronez 17 hours ago | parent
Bonus points for an intelligent way to manage these stored in OneDrive and other cloud folders. Easy to get corruption on SQLite files stored there.
crab_galaxy 17 hours ago | parent
dizzard 15 hours ago | parent
It’s self-hostable too. I’ve got a bunch of super niche todo lists and personal apps running on my home server with it.
bashtian 15 hours ago | parent
adrianwaj 16 hours ago | parent
They're like lightweight versions of https://github.com/kem-a/AppManager which is for AppImages.
Not a bad thing, but it's just another dependency and tied to an OS-specific base software install.
They could work well pre-installed on the Mecha Comet with a bunch of app files ready to launch.
Can the added layers guarantee a new level of security or privacy like zero telemetry or keyjacking? Protection from bad actors is a good thing while making things faster and easier overall. Browser extensions are a security risk, right?
Java applets were a good idea in the sense that so long as you had Java installed, the applet was just sitting there on a webpage. Finding and managing the apps is the problem, and using browser bookmarks is a decent solution to it. The web page should demo the app, and there can be an 'install local' button next to it. But at some point all these local versions need to be updated and then not be messed with like browser extensions can be. FanFare would be a decent name.
m-p-3 18 hours ago | parent
Really curious to see where this goes. Do you plan to open-source the client, or simply make the file specification open when stabilized?
bashtian 17 hours ago | parent
m-p-3 14 hours ago | parent
uneekname 18 hours ago | parent
xyrez 18 hours ago | parent
nzoschke 18 hours ago | parent
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...
rvz 17 hours ago | parent
ninininino 17 hours ago | parent
"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"
saejox 17 hours ago | parent
tombert 17 hours ago | parent
I always thought that there should be an easy way to export it, but I don't think that ever materialized.
smy20011 17 hours ago | parent
Brajeshwar 17 hours ago | parent
veqq 17 hours ago | parent
writtenone 16 hours ago | parent
bbstats 16 hours ago | parent
altern8 16 hours ago | parent
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.
manlymuppet 16 hours ago | parent
annrap1d 15 hours ago | parent
zarrdoz 15 hours ago | parent
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
4ndrewl 14 hours ago | parent
probablyStimmed 14 hours ago | parent
yuedongze 13 hours ago | parent
francislavoie 12 hours ago | parent
rupertsworld 12 hours ago | parent
andix 11 hours ago | parent
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.
xori 10 hours ago | parent
shepherdjerred 9 hours ago | parent
jayde2767 8 hours ago | parent
nbhankes 7 hours ago | parent
rtpg 5 hours ago | parent
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.
radicalbit 5 hours ago | parent
rramon 5 hours ago | parent
ezst 5 hours ago | parent
¹: https://app.triliumnotes.org/
²: https://developer.mozilla.org/en-US/docs/Web/API/File_System...
flossly 3 hours ago | parent
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.
whizzter 2 hours ago | parent
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.
molsongolden 2 hours ago | parent
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.
ra 1 hour ago | parent
ferflowhq 24 minutes ago | parent