Minimal endpoints or one controller per feature in VSA?
How do you usually structure your APIs in VSA? Do you prefer a minimal set of centralized endpoints, or do you use a dedicated controller per feature? I’d like to hear which approach you prefer and what advantages you see compared to the other option.
17 Replies
I don't really know what VSA is, but as a general question, I usually do "controller per feature"
or maybe "controller per functional domain"
so, a users controller
a projects controller
an authentication controller
as things that are often used across different features
and then maybe a ProjectSearch controller, for the "ProjectSearch" feature
for anything that's specifically only applicable to the ProjectSearch feature
not sure how applicable that is outside of our heavily-domain-specific work application
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
minimal apis, one file per endpoint
and put them in a feature folder
GitHub
GitHub - viceroypenguin/VsaTemplate
Contribute to viceroypenguin/VsaTemplate development by creating an account on GitHub.
@taner. feel free to ask me questions about the template. i'm using $ip to simplify a lot of boilerplate and design around endpoints and simplify the architecture as a whole.
ImmediatePlatform
ImmediatePlatform
Libraries for building modern, maintainable .NET applications leveraging the Vertical Slice Architecture and Mediator pattern with no boilerplate. Extensible. Fast. Source Generated. Open Source.
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
why do u prefer not to manage usernames and password in ur own database?
i spent too many years growing up where usernames and passwords were a target for hackers, so i like to reduce my attack surface by not being responsible for those. honestly, it's not that bad with identity, and i'll probably switch at some point, i just haven't yet.
u mean asp.net identity with the alr. impl dbcontext etc?
and would u split the identity db from ur normal application db?
i haven't figured that out yet, beceause i haven't explored that yet. probably need to implement a custom istoragefactory to translate to a l2db context instead of efc context, but until i play with it, i dunno
ty for the response
$vsa
Vertical Slice Architecture
I haven’t used it so far but I really wanna try it
Because it looks good on the paper
@viceroyturkey | 🦋🦃 In Auth0, is there a user ID inside the JWT that I can use to create relationships in my database? I want to keep the flow in my pipeline, where I get the user ID from the current user, so I don’t need to inject it into every command or query.
If you look at my template, you can see how I translate an auth0 id into an app userid and how I keep track of the userid. It’s going to be under web/infrastructure/authentication.