Solo Select Horses
THE STORY BEHIND THE CODE: A DEEP DIVE
- Summary with focus on technical aspects
- App description
- Technical details
- Technology and services used
Summary with focus on technical aspects
Over a year of high-paced startup experience as the lead developer on 4 developers team on an enterprise internal tool designed to be a future SaaS platform built with React, Node.js/Express, Supabase/Postgres, and TypeScript. Owned the full product end-to-end, from database schema design, billing system through frontend dashboards and customer-facing portals. Built a production-grade billing system with Stripe payment orchestration, QuickBooks accounting reconciliation, and an immutable financial ledger. Designed and implemented comprehensive E2E test suites using Cypress, integration and unit tests using Jest, and as AI agentic tooling matured, developed a test-driven, continuous human-in-the-loop refactoring workflow with Claude Code that significantly accelerated feature delivery while maintaining system reliability.
App description
Solo Select Horses (https://www.soloselecthorses.com/) is a premium equine breeding farm in Texas managing over 2,500 recipient mares. To support this scale, and being able to grow even more, the business needed a custom management platform to replace fragmented spreadsheets, obsolete technology, and manual processes across breeding operations, customer billing, and reproductive program tracking.
The platform that was built serves as the operational backbone of the business. It has features for managing the full breeding lifecycle - scheduling mare breeding events, tracking embryo transfers, managing semen collections and shipments, recording pregnancy checks, and maintaining frozen embryo and semen inventory across liquid nitrogen tanks. A spotlight search (Cmd+K) lets staff instantly locate any horse across thousands of records, and a calendar-based breeding schedule with 30-second auto-refresh keeps the team synchronized in real time.
The billing system is the most technically complex component. Invoices follow a full lifecycle - draft, closed, paid, refunded, voided - with amendment support that atomically recalculates totals and triggers accounting sync. When an invoice is closed, the system materializes charge entries into an immutable financial ledger and schedules an automated charge against the customer's stored payment method (card or ACH), if the customer enabled automated charges. Stripe webhook events are processed through a batched queue with distributed locking and idempotency guarantees, handling charge successes, failures, ACH returns, 3D Secure authentication flows, and chargeback disputes. Payments are allocated to invoices using a FIFO strategy with composite-index idempotency, and all financial state changes are reconciled unidirectionally with QuickBooks Online via an async sync runner so that continuous syncing does not block frontend operations.
Beyond billing, the system includes a customer-facing public billing portal with token-based secure access (hashed tokens, expiration, use-count tracking), where customers can view invoices, make payments, and manage their payment methods. PDF invoice generation compiles billing summaries into professional statements. DocuSign integration handles contract e-signatures with webhook-driven status tracking. A Postmark-based mail system sends invoices, payment receipts, and contract notifications with pixel-based open tracking for audit purposes. Google Maps autocomplete and address verification simplify customer address entry and disallow non-existent addresses to be entered.
Role-based access control separates admin, staff, and customer permissions. Admins manage users, configure billing settings, and review audit logs including public portal access records with IP tracking. Rate limiting protects public endpoints.
Technical details
The application follows a multi-service monolith architecture: a React/Vite frontend, a Node.js/Express core service handling business logic, and a separate billing service managing Stripe webhook processing. Supabase provides the Postgres database, authentication (JWT-based), and real-time capabilities. The frontend uses Mantine as the UI framework, ag-Grid for enterprise-grade data tables, TanStack React Query for server state management, and react-hook-form with Yup for form validation.
The financial ledger records every charge, credit, and adjustment as an immutable entry. A separate allocations table tracks how payments and credits are mapped to specific invoices, using a composite unique index for idempotency - retries or duplicate webhook deliveries never create double-counted records. Twelve distinct allocation sources track the origin of every dollar movement (Stripe payments, manual credits, ACH releases, refund reversals, void-to-credit conversions, amendment releases, and more). Invoice payment status and coverage flags are recomputed after every allocation change.
ACH payments introduced significant complexity because they settle asynchronously - oftentimes days after initiation, and can be returned after apparent success. The system tracks ACH settlement state and blocks certain operations (reopening, voiding, refunding) while settlement is in progress. Similarly, 3D Secure card authentication creates PaymentIntents in a requires_action state; stale 3DS intents are auto-cancelled by a daily maintenance job. Payment resume links allow customers to complete interrupted payment flows.
Closing an invoice finalizes it -- materializing charges in the ledger, making it visible to the customer for payment, scheduling an automated charge, and syncing it to QuickBooks. Reopening a closed invoice reverses all of this, but only after enforcing nine separate precondition checks -- verifying the invoice isn't already paid, hasn't been amended, has no active refunds, no ACH settlement in progress, no pending 3DS authentication, no QuickBooks payment records, and more. The reopening operation atomically cancels auto-charge schedules, removes all allocations, soft-deletes ledger entries, voids the Stripe invoice, and triggers QuickBooks deletion.
The automated charge system supports configurable delays (days in production, minutes in test mode), retry logic for failed charges, and a special 3-day retry schedule for embryo transfer charges. An instant auto-charge service handles on-demand charges for service fees and shipment costs, supporting multi-customer ownership splits.
Refunds follow dual paths: online customers get Stripe refunds (with optional convenience fee inclusion calculated via a gross-up formula), while offline customers or those covered by manual credits get ledger-only refunds. Void-to-credit operations release allocated funds back to available credit without issuing Stripe refunds, with optional auto-reallocation to the next unpaid invoices via FIFO.
QuickBooks sync uses a dependency-ordered runner with distributed locking to prevent parallel sync cycles. It resolves QB customers by name, syncs invoices/payments/credits/voids/refunds in order, and maintains bidirectional entity mappings. The QB API client handles OAuth token refresh and exponential backoff for rate limits.
The Supabase/Postgres layer makes heavy use of RPC functions for transactional operations -- allocation primitives (fifo_iterator, allocations_write_row, recompute_allocation_flags), portal link management (increment_portal_link_use), and invoice lifecycle operations. Database migrations are versioned.
For testing, I built Cypress E2E test suites covering the full billing workflow - invoice creation, payment flows, amendments, refunds, voids, and service fee charges when customers pay late. These tests served as a verifiable feedback loop that became especially valuable when integrating Claude Code into my development workflow. Writing tests first created a closed loop where the AI agent could implement features and immediately validate correctness, which significantly improved productivity and allowed me to focus on system design and domain architecture.
Technology and services used
- TypeScript
- React
- Vite
- Node.js / Express
- Mantine UI
- Ag-Grid for tables
- TanStack React Query
- react-hook-form / Yup for forms validation
- Recharts
- Supabase (Postgres, Auth, RPC, File Storage)
- Stripe (Payments, PaymentIntents, SetupIntents, Webhooks, ACH, 3DS, Refunds, Disputes, Testing)
- QuickBooks Online API (OAuth, Invoice/Payment/Credit Memo sync)
- DocuSign (JWT auth, e-signatures, webhook status tracking)
- Postmark (transactional email with open tracking, bulk emails)
- Google Maps API (address autocomplete)
- Upstash Redis (webhook event deduplication, rate limiting)
- AWS SNS
- Swagger / OpenAPI for API docs
- Sentry (error tracking, cross-service debug tracing, rate-limit telemetry)
- Jest / Vitest (unit testing)
- Cypress (E2E testing)
- Helmet / Morgan / CORS (Express middlewares for security)
- Claude Code (AI-assisted development workflow)
- GitHub








