Victor Gusev
← Projects
active

2ndMind

Personal knowledge vault and daily-use app — a public portfolio and a private second brain (training, live erg, food, calendar) over one markdown source of truth.

2ndMind — figure

Year
2026
Category
software

Stack

Next.jsTypeScriptReactTailwindPostgresDrizzleWebAuthnWeb BluetoothGemini APIwebfull-stackaipwaself-hosted
Problem
Most portfolio sites are a one-time export: write a resume, paste it into a template, forget it until the next job search.
Approach
Next.js App Router over one markdown vault.
Result
2,712 tests across 216 files as of 2026-11-16, covering session forgery/expiry, vault frontmatter parsing, the public-field allowlist, and sync conflict resolution against a real embedded Postgres rather than a mock.

This site. A personal knowledge vault, written in markdown, that renders itself as two different surfaces from one source of truth: a static public portfolio for hiring managers, and an authenticated private tool I actually use daily — training log and live rowing monitor, food log, task tracker and calendar, resume tailoring, and a daily/weekly AI summary.

01

The problem

Most portfolio sites are a one-time export: write a resume, paste it into a template, forget it until the next job search. The vault behind this one is alive year-round — training data, coursework, project notes — and a portfolio that cannot read from the same place it is written to always drifts out of date. The private half had to be worth opening every day, or logging would migrate back to whatever app already existed for it.

02

Architecture

Next.js App Router over one markdown vault. Public routes are built from an explicit per-field allowlist rather than the raw vault entry, so a private field added tomorrow is private by default — a test fails the build if a public route ever imports a private loader. Private routes are server-rendered and session-gated, reading and writing the same files through the GitHub Contents API (Vercel functions have no writable filesystem and no git binary).

Auth is self-hosted WebAuthn — a passkey ceremony plus a signed session cookie, no vendor, because there is exactly one user. Training and log data live in Postgres (Neon + Drizzle); everything else — projects, experience, coursework, brand, standards — is markdown, read at request time.

The private app is also an installable PWA: a service worker, an IndexedDB-backed outbox, and a hybrid-logical-clock sync engine that reconciles edits made with no connection, built and proven against a real database rather than a mock.

The training side talks to hardware. A Concept2 PM5 rowing monitor connects over Web Bluetooth; the app decodes its stroke and force data into a live screen, records every stroke, and can program the next workout onto the monitor over its CSAFE command protocol. Pieces can be reviewed by an AI model, compared against an earlier piece, and exported to Strava as FIT files. A photo of the erg's screen also works as input: Gemini reads it into a logged piece.

03

What did not work

The original plan used Clerk for passkey auth. Its passkey tier is Pro-only and priced for multi-tenant products — pure overhead for an app with exactly one account — so it was dropped for a hand-rolled WebAuthn ceremony with the credential stored as plainly as the threat model allows.

An early version of offline support passed every automated test and still froze on real plane wifi: navigator.onLine reports true on a connection that answers nothing, and a fetch with no deadline never rejects. Fixing it meant treating "connected" and "reachable" as two different, separately-tested claims.

04

Measured results

2,712 tests across 216 files as of 2026-11-16, covering session forgery/expiry, vault frontmatter parsing, the public-field allowlist, and sync conflict resolution against a real embedded Postgres rather than a mock. The offline round trip is proven end to end on a real phone: a training session logged in airplane mode reaches the database exactly once on reconnect.

Updates

  1. Live rowing: the app now connects to a Concept2 PM5 monitor over Bluetooth and shows the piece as it happens — force curve, split, stroke rate and watts — records every stroke, saves each piece the moment it ends, and can set the workout on the monitor itself. Finished pieces get a summary, an AI review, a side-by-side with a comparable earlier piece, and a one-tap upload to Strava.

  2. A Food tab: type what you ate and an AI model matches it against that day's UCLA dining-hall menus or USDA data, or estimates it with a range. The daily calorie target is learned from what was eaten and the weigh-in trend, and reset each week.

  3. Training rebuilt around rowing: Concept2 Logbook import, a photo of the erg's screen turned into a logged piece, a records page laid out as a report, and a history calendar you can page through.

  4. Redesigned the private app from scratch: a new shell and navigation, a Today page and a calendar that writes to Google Calendar, and course deadlines imported from Canvas automatically.

  5. Finished the interface overhaul: a collapsible sidebar, accessibility work (a minimum text size, contrast checked on every page and theme, respect for reduced-motion and other OS preferences), and the home page's JavaScript cut from 221 KB to 147 KB, with a per-page budget that fails its check if it grows back.

  6. Added self-serve device enrollment: a new passkey now finishes enrolling itself the moment the browser ceremony completes, with no environment edit and no redeploy, backed by a small Postgres table instead of an env var.

  7. Phase 6 closed: link previews, a real favicon, an About page that leads with a claim, the resume PDF as the primary download, and four hand-authored system diagrams.