Simon-Pierre Boucher
All apps & projects
Web Platform
JavaScript

SPB Drive

Your files, your server, zero compromises

A private, self-hosted cloud drive that previews everything, shares anything, and never phones home.

27

Tests passing

100+

Code languages highlighted

8 MB

Resumable upload chunks

20

Versions kept per file

30 days

Trash retention

0

Third-party requests

Overview

SPB Drive is a self-hosted Google Drive and Dropbox replacement designed for exactly one user. The entire drive sits behind a single argon2id-hashed password; the only public surfaces are share links you explicitly create. It runs live at drive.spboucher.ai from a Fastify server on a Mac Studio node, exposed through an ngrok custom domain.

At its core is a content-addressed blob store: every file is stored once by its sha256 hash, so identical files cost nothing extra, while a SQLite database (WAL mode, FTS5) maps the virtual folder tree onto blobs. Uploads are chunked and resumable in 8 MB slices, entire folder trees drag-and-drop with hierarchy preserved, and everything streams — nothing is ever buffered whole in memory.

Beyond storage, it is a universal previewer and a sharing machine. Video transcodes in the background to play anywhere, Office documents convert to PDF via headless LibreOffice, archives are browsable from the inside, and code highlights in 100+ languages. Any file or folder becomes a clean public URL with optional expiry, password, and download limits — and v2.0 added file versioning, an in-browser text editor, inbound file requests, and storage insights.

Key Features

Content-addressed vault

Files are stored once by sha256 hash for free deduplication, organized in unlimited nested folders with tags, stars, and folder colors.

Universal previewer

Images, video, audio waveforms, PDF, Office-to-PDF, code, Markdown, CSV, notebooks, archives, fonts, and email all preview in-browser — with an elegant fallback for everything else.

Sharing machine

Any file or folder becomes an unguessable base58 URL with optional expiry, argon2 password, download limits, QR codes, Open Graph unfurls, and instant revocation.

Full-content search

SQLite FTS5 indexes names, tags, and extracted file contents — it finds a word inside an uploaded PDF.

File versioning

Replacing or editing a file archives the previous content, up to 20 CAS-backed versions per file, browsable and restorable from the Info panel.

Resumable uploads

Chunked 8 MB uploads survive interruptions and resume where they left off, with drag-drop of entire folder trees and paste-to-upload.

In-browser editor

Edit code, Markdown, JSON, or CSV directly in the drive, with every save archived as a new version.

Companion CLI

The spbdrive CLI handles list, upload, download, share, search, and one-way push sync from any terminal via API-token auth.

Hardened by default

Argon2id auth with lockout, hashed session ids, CSRF protection, sandboxed previews, and a strict self-only CSP with no third-party requests anywhere.

How It Works

  1. Edge & auth

    An ngrok tunnel terminates TLS at drive.spboucher.ai and forwards to a Fastify server; every route except login, share pages, and healthz requires a session backed by a single argon2id-hashed password with per-IP lockout.

  2. Content-addressed storage

    Uploads stream in 8 MB resumable chunks and are sha256-hashed into a content-addressed blob store, so identical bytes are stored exactly once; a SQLite nodes table maps the virtual folder tree onto blobs and garbage-collects at refcount zero.

  3. Preview pipeline

    A small in-process job queue (concurrency 2) produces thumbnails, H.264 video transcodes, and LibreOffice PDF conversions, all cached by blob hash — each unique file is processed once, ever.

  4. Sharing & search

    Signed base58 tokens serve polished public share pages with expiry, passwords, download caps, and ZIP-all folder streaming, while an FTS5 index over names, tags, and extracted text powers instant full-content search.

  5. Operations

    pm2 keeps the server and tunnel alive across reboots; a nightly 02:30 backup writes a SQLite snapshot plus hardlinked blob copies, retaining 14 dailies and 8 weeklies, with a documented and tested restore procedure.

Tech Stack

Server

Node.js 20+ (ESM)
Fastify 5
better-sqlite3 (WAL + FTS5)
Nunjucks SSR
pino
zod

Media & Previews

sharp
ffmpeg
LibreOffice headless
pdf.js
Shiki
wavesurfer.js
SheetJS
pdftotext

Security

argon2id
signed base58 tokens
double-submit CSRF
CSP default-src 'self'
sandboxed SVG/HTML

Ops

pm2
ngrok custom domain
rsync --link-dest backups
vitest
ESLint

Highlights

  • Previews virtually everything — mkv transcodes to H.264, Office converts to PDF, archives browse from the inside, and unknowns get a graceful fallback card
  • Zero third-party requests anywhere: fonts, pdf.js, and wavesurfer are all self-hosted behind a strict CSP
  • Content-addressed storage makes deduplication free — identical files and file versions cost zero extra bytes
  • Search reaches inside file contents: PDFs, Office documents, and code are text-extracted and FTS5-indexed
  • Full companion CLI with chunked uploads, share management, and one-way push sync
  • Nightly hardlink-deduplicated backups with a restore procedure that has actually been tested

Explore SPB Drive

Self-hosted personal cloud drive — the full source is on GitHub.