DEV Community

Cover image for Building a self-hosted client document portal with 5 dependencies, Node SQLite, and a metadata-only MCP server
Fuad H
Fuad H

Posted on Edited on AI-assisted

Building a self-hosted client document portal with 5 dependencies, Node SQLite, and a metadata-only MCP server

If you have ever collected tax docs, KYC files, or onboarding assets from clients over email, you know the drill. Attachments get buried across threads, Google Drive links expire, and someone mistypes an ABN or bank number that nobody spots until two weeks later.

Existing portals like Content Snare and FileInvite handle checklists well, but they are per-seat closed SaaS. I didn't want clients' tax IDs and bank statements living on someone else's cloud, so I built GatherGate (MIT).

You can click through the live demo without signing up at gathergate.app/demo, or run it locally with Node 22+:

npx gathergate
Enter fullscreen mode Exit fullscreen mode

I kept the backend deliberately boring: Node 24 (node:sqlite in WAL mode + node:crypto) and Hono, with 5 production dependencies total (hono, @hono/node-server, aws4fetch, nodemailer, yazl). No ORM, no Redis, no telemetry.

clients open a magic link (plus optional 6-digit email OTP) and upload from desktop or mobile. Tax and bank fields run local checksums before submission (AU ABN/TFN/Medicare, UK UTR/NINO, US EIN/ABA, EU VAT, IBAN) so typos get rejected right away. Every file and sensitive field derives its own 32-byte key via crypto.hkdfSync from MASTER_KEY and encrypts with aes-256-gcm:

function deriveKey(masterKey: Buffer, salt: Buffer, purpose: string): Buffer {
  return Buffer.from(
    crypto.hkdfSync("sha256", masterKey, salt, Buffer.from(`gathergate:${purpose}:v1`, "utf8"), 32)
  );
}
Enter fullscreen mode Exit fullscreen mode

Uploads go through magic-byte checks (blocking HTML, SVG, executables, and macro-enabled Office files) and stream inside a Content-Security-Policy: default-src 'none'; sandbox preview drawer. Completed packs auto-purge blobs and field values on a retention timer.

trickier part was wiring up MCP (/mcp and npx gathergate mcp) so an AI assistant can spin up checklists from templates, spot overdue packs, and trigger reminders without leaking PII into model context. The 7 tools only return counts, due dates, masked emails, and an operator review_url. File bytes, decrypted national IDs, notes, and magic-link tokens never leave the server over MCP. Once files arrive, the agent stops and hands the human the link.

Main tradeoffs are intentional: single-replica SQLite rather than Postgres, and magic-byte validation isn't antivirus or CDR if you need deep malware scanning.

Source: github.com/FAAS19/gathergate

Top comments (0)