If you’ve built a few .NET APIs, you’ve probably done authentication more than once.
JWT setup
login and register endpoints
protecting routes
maybe adding roles
It works, but every time I started a new project, I found myself repeating the same setup again.
After doing this a few times, I decided to settle on a structure that I can reuse and understand without digging through tutorials.
This is the approach I use now.
The goal
I’m not trying to build a full identity system.
I just want:
a clean login and register flow
JWT authentication that works
refresh tokens so users don’t get logged out constantly
a structure that doesn’t turn into a mess later The structure
I keep things split into simple layers.
Api
Application
Domain
Infrastructure
Shared
Nothing fancy.…