TGViewer
Programming & AI Tips 💡 Programming & AI Tips 💡 @programmingtip · 46.3K subscribers
Post #421 7.71K
API Feature Folders ⚡️

In ASP.NET Core (and unlike ASP.NET 5 / Web API 2), Web API controllers are just controllers. 🗂

You don’t need to inherit from a different base type or anything like that. ❌

What’s more, your API controllers should be returning DTOs that are separate from your underlying domain or data model. ↔️

What I’ve found to be a better organization is to do away with the Controllers folder (or keep it around if you’re using view-based controllers) and instead use feature folders for your APIs. 💎

I’m partial to having a root level API folder but if you’d prefer to put your features in the root of the project that would work, too. 👍🏻

Within each feature folder, you include the controller along with any model types it needs to work with, like this 👾 :

https://t.me/pgimg/124

Obviously one benefit of this approach is that it’s more cohesive. ✅

Things that change together are located physically next to one another, and the friction involved in moving between different folders with too many files in them is greatly reduced. ✂️

Another nice thing about this approach is that it just works. Unlike view-based controllers, you don’t need to change anything about how ASP.NET Core is configured to have this organization structure work for you. ✨


[ Article ] : bit.do/apif

〰〰〰〰〰〰
#AspMvc #Core #API
@ProgrammingTip
Telegram Programming Tips Resources
More from @programmingtip
  1. Oct 5, 2026AI is changing the developer career ladder 🚀 GitHub's latest developer career advice is r…
  2. Oct 2, 2026GPT-6 Astra gets an Ultrafast API tier 🚀 OpenAI added an Ultrafast speed tier for GPT-6 A…
  3. Oct 1, 2026Cloudflare shipped an agentic CLI for its API ⚡️ Cloudflare launched cf, an agentic CLI fo…
  4. Sep 30, 2026OpenAI introduced Dots, always-on agents 🚀 OpenAI introduced Dots, its take on always-on…
  5. Sep 29, 2026Claude Sonnet 5.5 is built for coding agents 🚀 Anthropic released Claude Sonnet 5.5 for t…
  6. Sep 26, 2026Claude Opus 5.5 is available in the API 🚀 Anthropic released Claude Opus 5.5, and it is a…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →