# From legacy ASP.NET and stored procedures to Node.js on serverless

> A legacy stack of ASP.NET, C# and slow SQL stored procedures, modernised into Node.js on serverless AWS: faster, cheaper to run, and something a modern team can work on.

- Client: An Australian agriculture-technology company with a large IoT sensor network (Agriculture technology)
- Role: Architect and lead engineer, Nicolas Dao
- Status: Delivered. At Cloudless Labs
- Capabilities: Legacy modernisation, Serverless, Database performance, Refactoring
- Web page: https://cloudlesslabs.com/work/dotnet-to-serverless/

## Outcomes

- Legacy ASP.NET and C# applications rebuilt in Node.js on serverless infrastructure.
- A large body of slow stored procedures refactored, and the business logic moved where it can be tested.
- Faster systems that cost nothing when idle, and a codebase AI agents and new engineers can both work in.

## The situation

Once the platform was on AWS, the next problem was what it was made of. The core systems were legacy ASP.NET and C#, built for the server they used to live on. Much of the business logic sat in SQL stored procedures: an enormous number of them, many very slow, hard to test, and understood by fewer people every year.

## What I did

I modernised the stack piece by piece, moving away from ASP.NET and C# to Node.js on serverless infrastructure. Each piece was rebuilt, tested against the old behaviour, and switched over while the rest kept running.

The stored procedures got the most care. I refactored a very large number of them: rewriting the slow queries, removing logic that had been duplicated across procedures over the years, and moving business rules out of the database into application code, where they can be read, tested and changed safely. The database went back to doing what it's good at.

## Why it matters to you

I was a .NET developer for a long time before I moved to open source and AWS, so I know these systems from the inside: why they were built that way, and where they hide their surprises. Legacy systems are where most of a company's real business rules live. Modernising them is less about the new technology than about not losing a single one of those rules on the way.

## Built with

- [Node.js (plain JavaScript)](https://cloudlesslabs.com/stack/nodejs-javascript/index.md): My default in The Stack
- [TypeScript](https://cloudlesslabs.com/stack/typescript/index.md): Skip in The Stack
- [AWS Lambda](https://cloudlesslabs.com/stack/aws-lambda/index.md): My default in The Stack
- [Aurora PostgreSQL](https://cloudlesslabs.com/stack/aws-aurora/index.md): Use when it fits in The Stack
- [Playwright, Vitest, pytest](https://cloudlesslabs.com/stack/testing/index.md): My default in The Stack
- ASP.NET
- C#
- SQL Server stored procedures

## Related

- [Lambda, Web Functions or Workers?](https://cloudlesslabs.com/stack/guides/compute-choice/index.md): the decision guide behind it
- [Cutting an AWS bill from US$240k a year to under US$40k](https://cloudlesslabs.com/work/aws-bill-cut/index.md): a related project
- [Real-time ingestion for a national farm-sensor network](https://cloudlesslabs.com/work/realtime-iot/index.md): a related project
- [Every project](https://cloudlesslabs.com/work/index.md)
- [How we work](https://cloudlesslabs.com/about/how-we-work/index.md)
- [Map of every Markdown file on cloudlesslabs.com, with what each one answers](https://ask.cloudlesslabs.com)
