Connor Pepin
GET/case-studies/crosswalk

Crosswalk Legal

Hybrid document sync MVP

May 2025 – January 2026 · Engineering Consultant, full-stack

Problem

Crosswalk Legal needed a client and document management system where attorneys could work offline locally while staying in sync with a shared cloud database, without losing edits, sacrificing security, or blocking on network latency.

Constraints

  • Ship a feature-heavy MVP in under four weeks with the company CTO
  • Support bidirectional updates between local clients and cloud Postgres
  • Keep conflict resolution predictable for legal document workflows
  • Minimize infrastructure cost for an early-stage product

Approach

  • Used PGLite as the local Postgres-compatible store so offline writes capture full CRUD context and ACL metadata before anything leaves the device
  • Queued outbound changes in a local sync table and flushed them to the Express API when connectivity returned
  • Persisted validated writes to cloud Postgres as the authoritative source of truth
  • Used database triggers to detect row changes and route notifications by ACL — private, public, or user-specific shared data
  • Delivered inbound updates to subscribed clients via webhooks so each device converged without manual refresh
  • Built the full stack — data model, API, sync engine, and client integration — as sole engineer alongside the CTO

Architecture

Every edit lands in local PGLite first with enough metadata to replay offline. A sync table batches outbound work to the cloud API when online; Postgres triggers on the server detect changes, filter by ACL, and webhooks push updates back to the right clients.

1

1. Local edit

User makes a change in the desktop app — document, client record, or other entity.

2

2. PGLite write

Change is saved to the local PGLite database with CRUD operation type, payload, and ACL scope so offline work is captured completely.

3

3. Sync table upload

When connected, pending rows are read from the local sync table and sent to the cloud Express API.

4

4. API → cloud DB

API validates the payload and inserts or updates the authoritative cloud Postgres database.

5

5. Trigger + ACL routing

Postgres triggers detect the change and determine which clients should receive it based on ACL rules — private, public, or user-specific shared data.

6

6. Webhook delivery

Eligible clients receive the update via webhook and apply it locally in PGLite, keeping every device in sync.

Flow diagram

Outcomes

  • Shipped a feature-heavy MVP in under four weeks
  • Millisecond-level sync between local clients and cloud Postgres
  • End-to-end ownership of API, data model, and sync engine
  • Production-ready foundation for legal document and client management

Stack

TypeScriptExpressPGLitePostgreSQLWebhooksNode.js