Software Architect & Full Stack Lead

2026Client: Kincodefullstack
Software Architect & Full Stack Lead

Technologies

Software Architect & Full Stack | Kincode

Driving a systemic 10-month engineering transformation: from technical debt and multi-repo chaos to a high-performance TypeScript monorepo, sub-300ms database response times, and AI agent automation.

Overview

Over a 10-month engagement at Kincode, I stepped in as Software Architect and Full Stack Engineer to tackle deep-rooted technical debt, instability, and severe performance bottlenecks. The ecosystem consisted of multiple independently managed JavaScript repositories that lacked shared standards, type safety, and automated testing.

My mission was not just to patch symptoms, but to execute an architectural overhaul from the database layer to the frontend UI—all while continuously shipping new product features in parallel without downtime or regressions.


The Core Challenges

When I audited the systems, several critical architectural bottlenecks were holding the platform back:

  • Multi-Repo Sprawl & Untyped Code: Multiple isolated repositories running disparate versions of Node.js, legacy CommonJS, and pure JavaScript. Sharing business logic or fixing cross-service bugs required manual synchronization and created fragile deployment cycles.
  • Frontend State Bloat & Over-Rendering: The React frontend was constrained by a monolithic "mega-context" holding global state. Every state change triggered cascading re-renders across the entire tree, resulting in duplicate network requests, race conditions, and sluggish user experience.
  • Database Latency (5s to 20s): MongoDB queries lacked proper pagination and brought entire collections into memory. Heavy aggregation pipelines with deeply nested $lookup stages caused queries to take anywhere from 5 to 20 seconds under production loads.
  • Zero Automated Testing: There were no unit tests, no end-to-end tests, and no CI validation pipelines. Deployments relied on manual sanity checks.
  • Operational Inefficiencies: Internal workflows were manual and fragmented across communication channels without smart automation.

The Solution & Engineering Journey

1. Unified TypeScript Monorepo & ESM Modernization

Instead of managing separate repositories with diverging dependencies, I unified the entire ecosystem into a high-efficiency Monorepo:

  • JS to TypeScript Migration: Incrementally migrated the entire codebase to strict TypeScript, introducing end-to-end type safety between shared libraries, backend services, and the React frontend.
  • Modern Node.js & CommonJS to ESM: Upgraded Node.js across all services to the latest LTS releases and converted the legacy CommonJS module system to native ECMAScript Modules (ESM).
  • Standardized Internal Libraries: Extracted duplicated utility functions, schema validations, and middleware into versioned, shared workspace packages used by all backend services.
  • Zero-Downtime Parallel Rollout: All migrations were executed incrementally in tandem with new product feature development, ensuring uninterrupted business operations.

2. Frontend Architectural Overhaul (React + TanStack Query)

To solve the UI lag and eliminate redundant network overhead, I dismantled the monolithic global context:

  • Decoupled State Management: Deconstructed the mega-context into localized, domain-driven state modules, isolating component renders to their immediate boundaries.
  • Server State with TanStack Query: Replaced ad-hoc useEffect data fetching with TanStack Query, providing automated background caching, request deduplication, cache invalidation, and optimistic updates.
  • Modular Lazy Loading: Implemented route-based and component-level code splitting, loading data and bundle chunks strictly when needed by the user.

3. Backend Performance Engineering: Slashing Latencies to Sub-300ms

I led an exhaustive performance audit of the Express.js and MongoDB backend services:

  • Paginated Queries: Replaced all unbounded data queries with cursor-based and offset-based pagination across every API endpoint.
  • Eliminating Expensive $lookup Pipelines: Redesigned aggregation pipelines, eliminating redundant lookups by restructuring schema relationships and denormalizing high-frequency read fields.
  • Precomputed Views & Caching: Introduced precomputed aggregation collections and Redis-backed caching layers for computationally heavy analytics, offloading repetitive work from the primary database cluster.
  • Event-Driven Task Queues with BullMQ: Offloaded time-intensive background jobs, notifications, and data synchronizations to BullMQ workers, ensuring the primary HTTP event loop stayed responsive under high traffic.

4. Automated Testing & Containerized CI/CD Pipelines

To guarantee long-term stability and eliminate manual regression cycles:

  • Unit Testing Foundation: Introduced comprehensive unit test suites covering mission-critical business logic, controllers, and shared utility modules.
  • Playwright & Docker E2E Testing: Built containerized End-to-End test suites using Playwright running inside Docker containers, simulating realistic user journeys against staging environments.
  • GitHub Actions Quality Gates: Created automated multi-stage pipelines that run build validations, linting, type checks, unit tests, and Playwright suites on every pull request before deployment to Heroku.

5. AI Agent Integrations via Model Context Protocol (MCP)

To modernize operational capabilities, I designed and deployed custom MCP (Model Context Protocol) servers:

  • Connected internal LLM agents directly with platform APIs, database inspection tools, and background task dispatchers.
  • Delivered native multi-channel agent integrations across Slack, Microsoft Teams, and Google Chat, empowering team members to trigger operational tasks, query system health, and orchestrate workflows via conversational AI.

Measurable Results & Impact

  • 95%+ Latency Reduction: Slashed database and API response times from agonizing 5s–20s down to sub-300ms across the board.
  • Eliminated Frontend Re-render Chaos: Vanquished duplicate API requests and UI stuttering, creating a responsive, fluid user experience with TanStack Query caching.
  • Developer Velocity: The TypeScript Monorepo and shared internal packages drastically reduced cross-service bugs and cut onboarding time for new developers.
  • Deployment Confidence: Shipped a fully automated CI/CD pipeline where every pull request is validated through build checks, unit tests, and Dockerized Playwright tests before touching production.
  • Modern AI Workflows: Successfully rolled out conversational agent integrations in Slack, Teams, and Google Chat through standardized MCP interfaces.
Gerardo Perrucci
Let's connect

Interested in a similar project?

Schedule a call to discuss how I can help with your next project