Challenge
The site's original Node.js API had grown to carry real complexity — database connection management, OAuth against Google Ads, Graph email, circuit breakers, rate limiting — and needed the type safety and structured testing a compiled language gives. It also made sense for the business's own backend to be a working example of the C#/.NET practice it sells.
Approach
A full rewrite to C# on the .NET 10 isolated worker. The shared behaviour was extracted first into a library — a database connection factory that supports credential-free managed identity, typed analytics services, the attribution recorder, Graph email with HTML templates, the Google Ads conversion service with token refresh and an exponential-backoff circuit breaker, GA4 reporting, bot-check verification, rate limiting, an email-domain classifier and asynchronous mail-server enrichment for contact submissions. Existing behaviour was pinned with unit tests during the port, and the new API was delivered through the existing artifact-promotion pipeline without disrupting live traffic. The library has since grown to cover the CV request flow, YouTube authentication and contact identity resolution.
Outcome
- Type safety across the whole API layer and 2,589 automated tests covering validators, services and handlers (counted on 16 October 2026)
- Contact submissions enriched with domain type and mail-server checks before they reach the inbox
- Credential-free database access through managed identity, so there is no database password to store or rotate
- A circuit breaker on the Google Ads API stops quota pressure cascading
- Behaviour the endpoints share lives once, in the library, rather than being copied into each
Have a similar problem in your own systems? Book a free 20-minute call or describe it.
Where judgement mattered
- Extract the shared library before porting anything, so the port had something to test against
- Tests first, then migration, then cut-over — with the old implementation still serving until the new one proved itself
- Same pipeline, same environments: the rewrite changed the runtime, not the delivery process
Technology stack
C# / .NET 10 isolated worker · Azure Functions · Azure SQL with managed identity · Microsoft Graph SDK · Google Ads and GA4 APIs · xUnit and Moq · Azure DevOps CI/CD