T3Sharp - C# Backend with TypeScript Frontend

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:

  1. Running a C# ASP.NET Core backend with OpenAPI/Swagger
  2. Using openapi-typescript to auto-generate TypeScript types from the Swagger spec
  3. Using openapi-typescript-fetch for 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-typescriptapi-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!