The Motivation
I love the T3 Stack for rapid frontend development, but sometimes you need a C# backend - maybe you’re integrating with existing .NET services, or your team knows C# better.
The pain point? Keeping TypeScript types in sync with your C# models. Manual type definitions are tedious and error-prone.
The Approach
T3Sharp solves this by:
- Running a C# ASP.NET Core backend with OpenAPI/Swagger
- Using
openapi-typescriptto auto-generate TypeScript types from the Swagger spec - Using
openapi-typescript-fetchfor type-safe API calls
The Stack
- Backend: C# ASP.NET Core with Swagger at
/swagger/v1/swagger.json - Frontend: Next.js T3 Stack
- Type Generation:
openapi-typescript→api-types.ts - API Client:
openapi-typescript-fetch
Usage
# Start the C# backend on localhost:5194
# Then run the frontend
npm run dev
The types are regenerated on changes, keeping everything in sync.
Alternatives
If you need something more battle-tested:
Check It Out
Repo: domi-ninja/t3sharp
It’s a rough draft, PRs welcome!