TG

Offline-first PWA from scratch: foundation to dashboard, in parallel

An intense day bootstrapping a mobile-first PWA with Next.js, Dexie, and Supabase, moving from foundation to dashboard and phase 3 PRDs across multiple parallel workspaces.

Almost the entire day went into a client project (NDA): a mobile-first offline-first app that went from nothing to a working foundation, auth, dashboard, and phase 3 PRDs all in one day.

Client PWA project (NDA)

Several workspaces ran in parallel, all converging on the same repository. The starting point was a clean Next.js scaffold with Bun; within a few hours the base had Dexie for offline storage, TanStack Query for server state, Zustand for global state, Serwist for the service worker, and t3-env for environment variable validation.

The most interesting architectural decision was handling the Turbopack and Serwist conflict. Turbopack speeds up dev, but Serwist is only stable with webpack. The fix: Turbopack in next dev (the service worker is disabled in dev anyway) and next build --webpack for production. That went into an ADR alongside the other decisions made today.

Phase 2 came next: pilot dashboard, sync engine between Dexie and Supabase, report wizard, and the database schema. Supabase auth got a temporary-password gate rule on first access. This phase also produced a clear pattern for abstracting the Supabase client: instead of calling createClient() scattered across files, custom hooks encapsulate it, separating server-side from client-side with explicit contracts.

One workspace focused on utilities: I ported mask helpers for CPF, CNPJ, phone numbers, postal codes, and BRL currency (always in cents) from another in-house project, adapting them to local conventions. Another workspace swept through arbitrary Tailwind classes (the h-[54px] and px-[16px] kind) and replaced them with canonical framework values.

To close out the project work, a workspace analyzed the visual context screenshots for each screen and produced detailed PRDs with 15 implementation tickets for phase 3.

tgmarinho-ai-website

Merged the PR with journal entries for July 21-23 and started today's entry. Light activity here, but the pipeline kept running.

Technical research

Spent some time mapping open-source repositories covering Brazilian fiscal tech: NF-e, NCM codes, tax reform, and tributos. The goal is to have quick references when the topic comes up in future projects.

A heavy day, but a rare kind of satisfying: watching an app go from zero to a working offline-first dashboard with auth in hours, with multiple agents running in parallel on the same repository without stepping on each other.