Personal Vault — Encrypted Archive on a $0 Budget
A photo, video and document archive that costs nothing to run: an end-to-end-encrypted document vault, a self-hosted photo engine, verified backups and a live health dashboard, each with its failure modes written down.
- Next.js 16
- TypeScript
- Web Crypto
- Supabase
- Oracle Cloud
- Ansible
- restic
- Tailscale
- Playwright
Private by design — the live link shows the sign-in screen.
The brief
Every photo, video and important document in one place, every original kept in at least two, for no more than a dollar a year. Those constraints fight each other, and most of the work was deciding which one gives way where — then writing the decision down.
It is four components in one monorepo. Only one of them is a web app, and the most important engineering decision was not to write the biggest one at all.
- Media: Immich (deployed, not rebuilt), Oracle ARM VM (Always Free), Tailscale (no open TCP ports)
- Documents: Next.js PWA (encrypts in browser), Supabase (auth, RLS, storage)
- Backup: restic (nightly, verified), Restore drill (the real gate)
- Health: Collector (pushes every minute), /status (live dashboard)
Don’t rebuild what already exists
The original plan was to deploy everything on Vercel. For photos that is a category mismatch rather than a tuning problem: a photo library needs Postgres with pgvector, a job queue, a persistent filesystem and long-running ML workers, and a serverless function has a 60-second ceiling and no disk. Immich already does semantic search, face recognition, albums and — crucially — background camera-roll backup, which iOS only allows a native app to do. So the media half is Immich, deployed and hardened on an Oracle Always Free ARM VM with Ansible, and the repository contains no photo-management code at all.
Encryption the server can’t undo
Documents are the half I did build. Nobody but the owner — not Supabase, not Vercel, not me as the operator — can read a stored file, which is a property the design has to earn rather than claim.
Encrypted before upload
AES-256-GCM in 4 MB chunks with a fresh random IV per chunk, using the browser’s Web Crypto API. Storage only ever holds ciphertext.
Keys that never leave memory
Derived with PBKDF2-SHA256 at 600,000 iterations and marked non-extractable, so code in the page can use a key but never read it out.
Bytes bypass the server
A function authenticates the request and mints a 60-second signed URL; the browser talks to storage directly.
Row Level Security
Every Supabase table has policies scoped to the signed-in user, verified with a real file round trip.
No secrets in the repo
A pre-write hook blocks credential-shaped content, gitleaks scans the full history weekly, and CI scans the built client bundle for server-only variables.
Search without plaintext
Full-text search over contents is impossible by design. Search runs client-side over a decrypted index of names, tags and notes.
A budget of $0.00, audited
Free tiers are generous and unforgiving: several of them respond to an overage by deleting data rather than sending a bill. So the repository keeps a ledger of every allowance against projected usage, and each line that can bite has a guard in code rather than a warning in a README.
| Service | Free allowance | Usage | Guard |
|---|---|---|---|
| Oracle compute | 2 OCPU / 12 GB ARM | 2 / 12 | Never resize up — exceeding it terminates the VM |
| Oracle block storage | 200 GB | 200 GB | Keep the volume at 0 VPU; one tier up costs ~36× the annual budget |
| Oracle Object Storage | ~20 GB (Always Free) | < 8 GiB | Backup refuses to run past 85% — over-limit objects get deleted |
| Supabase Postgres | 500 MB | ~80 MB | 30-day metric retention, pruned nightly by a workflow |
| Vercel Hobby | 1M function calls / month | ~43k | Signed URLs only — file bytes never pass through Vercel |
Moving the health collector from every 15 minutes to every minute cost nothing in money but moved two lines of the ledger: 4.3% of Vercel’s monthly function calls, and 78 MB of the 500 MB database for 30 days of samples. Until a nightly workflow started pruning them, retention was unbounded — exactly the kind of drift the ledger exists to catch.
Settled by measuring, not by arguing
The video archive is verified by downloading every archived file again and hashing it against a manifest. Measured on the real archive, that check was 85% of the whole run — 6.2 GB in 162 minutes, seven times slower than uploading the same bytes — and its log was full of one stalled connection timing out while nothing else moved.
I had recommended against parallelising it, reasoning that upload dominated. The measurement said otherwise, so I built a fetcher that downloads several files at once — whole files per task, so there is no offset arithmetic to get wrong — behind three fallbacks, the last of which still hashes every byte before anything is cleared.
- 162 → 12.5 minto verify ~6.5 GB
- ~14×against a hoped-for 2–4×
- 1 timeoutdown from dozens per run
Gates, and where each one stands
Each phase had a gate that had to pass on evidence. Stating them exactly, including the one that has only partly passed, is the point: an archive you can’t restore isn’t a backup.
Crypto core — passed
46 of 46 unit tests, blocking in CI.
Responsive UI and PWA — passed
140 of 140 Playwright tests across viewports and hydration; installable.
Network — passed
Zero open TCP ports, verified. One UDP port opened on purpose so Tailscale gets a direct path instead of a 1.3 MB/s relay.
Restore drill — partly passed
An 18 MB database dump restored into a clean Postgres and served over the API. Restoring original media is still to be proven.
Limits, stated rather than hidden
No card-free provider offers enough free storage in this region for a second copy of a whole photo library, so the one-dollar ceiling and the two-copies rule are in direct conflict. The nightly backup protects the database — the part that turns a pile of files back into a library — and whatever recent originals fit; videos are copied to a drive at home by hand. The fix is about $6 a year of object storage, and the README says so on its first screen. Losing both the passphrase and the recovery code means losing the documents, which is the correct behaviour of an encrypted system rather than a bug.
Where it stands
All four components are deployed and running. The live link is private by design; the source is on GitHub, including the ledger, the security notes and the build log.