American Whitewater
Full-stack platform modernization and offline-first mobile app for the nation's leading whitewater conservation organization
A next-generation JavaScript ecosystem that modernized how Sovrn Commerce builds client-side applications.
View projectPreact
TypeScript
Zustand
Vanilla Extract
Vite
Zod
A next-generation JavaScript ecosystem that modernized how Sovrn Commerce builds client-side applications. This monorepo architecture powers high-value products including AI Shopping Galleries and Choice Page, directly impacting user experience and revenue generation across the platform.
Role: Lead Architect and Primary Developer
Commerce-focused publishers need tools that integrate seamlessly into their existing websites without disrupting page performance or conflicting with their established styling. Building distributed JavaScript that runs on third-party sites presents unique constraints: strict bundle size limits, CSS isolation requirements, privacy compliance across multiple regulatory frameworks, and accessibility standards that serve all users.
The legacy approach to building these tools had become a bottleneck. Each new product required rebuilding common functionality, and inconsistent patterns across projects slowed iteration and increased maintenance burden.
I designed a monorepo architecture using npm workspaces that fundamentally changed how the team builds JavaScript applications. The architecture enables multiple products to share a common foundation while maintaining independent deployment cycles.
The ecosystem includes eight internal packages organized by domain:
Each package builds to multiple output formats—ES modules, CommonJS, and IIFE bundles—enabling consumption across different integration patterns. Environment-aware builds handle development tooling, staging validation, and production optimization with appropriate sourcemaps and identifier hashing.
I introduced functional programming paradigms that are now adopted across teams:
Result Type Pattern: Railway-oriented error handling that makes success and failure paths explicit. Instead of exceptions bubbling unpredictably, functions return typed results that must be handled. This eliminated entire categories of runtime errors and made error handling logic visible in the type system.
Exhaustive Pattern Matching: Using ts-pattern for conditional logic ensures all cases are handled at compile time. When the data model changes, the compiler identifies every location that needs updating—no more forgotten edge cases discovered in production.
Loadable State Pattern: A standardized representation for async data that eliminates null-checking ambiguity. Components can reliably distinguish between “hasn’t started loading,” “currently loading,” “loaded successfully,” and “failed with error” states.
The state layer uses Zustand with carefully composed middleware:
Distributed JavaScript running on publisher sites cannot assume anything about the host page’s CSS. I implemented Shadow DOM isolation to encapsulate component styles completely, preventing conflicts with publisher stylesheets while maintaining full styling control within the boundary.
The design system uses Vanilla Extract for compile-time CSS generation with type-safe tokens. This approach produces zero-runtime CSS overhead while catching styling errors during the build process rather than in production.
All data crossing system boundaries passes through schema validation. API responses, configuration objects, and query parameters are validated and typed at runtime, with graceful degradation when data doesn’t match expectations. Types are derived from schemas, ensuring the TypeScript compiler and runtime validation stay synchronized.
| Decision | Rationale |
|---|---|
| Preact over React | ~3KB vs ~40KB for equivalent functionality in a distributed library where every kilobyte impacts publisher page load |
| Zustand over Redux | Simpler API with better TypeScript inference and smaller bundle footprint |
| Vanilla Extract | Zero-runtime CSS with type-safe design tokens, compatible with Shadow DOM isolation |
| Vite over Webpack | Faster development builds, native ESM support, and simpler configuration |
| ts-pattern | Exhaustive pattern matching that eliminates runtime errors from unhandled cases |
| Zod | Runtime validation with excellent developer experience and strong TypeScript integration |
| Immer | Ergonomic immutable state updates without the verbosity of manual spreading |
I proactively implemented comprehensive privacy compliance without being asked:
The consent system handles cross-frame communication for iframe-embedded scenarios, ensuring privacy preferences propagate correctly regardless of integration method.
WCAG compliance built into the architecture from day one:
As Lead Architect, I owned the technical direction for this ecosystem while collaborating closely with product and design teams. Beyond implementation, I focused on creating leverage:
Force Multiplier Effect: The patterns and packages I established are now adopted by other teams and projects. When engineers can build on proven foundations rather than reinventing solutions, the entire organization moves faster.
Mentorship Through Architecture: Well-documented patterns and clear abstractions teach architectural thinking implicitly. Junior engineers working in this codebase absorb functional programming concepts and state management best practices through the code itself.
Quality Standards: I established 80% test coverage thresholds enforced across all packages, 50KB production bundle limits with automated enforcement, and structured code review practices that maintain consistency as the team scales.
Revenue Impact: The architecture powers two distinct revenue streams for Sovrn Commerce. AI Shopping Galleries automatically recommend affiliated products based on page content, driving clicks and conversions for publishers. Choice Page (click interstitial) captures user intent at the moment of purchase consideration. Both products depend on the shared foundation I architected, enabling rapid iteration on revenue-generating features while maintaining the performance and compliance standards that publisher partnerships require.
Full-stack platform modernization and offline-first mobile app for the nation's leading whitewater conservation organization
Complete rewrite of a legacy browser extension with modern tooling and improved developer experience
Native iOS app enabling content creators to manage affiliate links on mobile, generating new revenue for the platform