Basic project structure for api/frontend

I've a small project I wanna build, but it'll need a frontend and a backend. I'd like to learn some Blazor, so I'll use that as Frontend and normal asp.net w/controllers for backend. I'm kinda stuck on project naming and organization though, do I use something like clean architecture, even if my project is way too small for that or do I just use like a *.Api, *.Blazor and *.Common? What should be the recommended there to keep it simple as much as possible?
22 Replies
theluckyrogue
theluckyrogue7mo ago
Don't worry about that stuff for now. Just build it first After you finish building it is when you look back on it and make it better. Yeah just go through the very basic tutorials of blazor and asp.net Just enough to build the very basics of what you want.
The Fog from Human Resources
until you end up with a legacy codebase nobody wants to touch because its too much while also holding back implementing new features :SCgetoutofmyhead:
theluckyrogue
theluckyrogue7mo ago
That is because they skipped the "make it better" part It's like writing a book. The first draft is always shitty. Especially when you haven't built it before Even better re-build it from scratch better than the previous one. If you run out of ideas on how to make it better, ask someone really good how they would make it better. I guarantee they would have some ideas.
Sun「無用」
Sun「無用」OP7mo ago
wdym? I have "2 projects" to build though and there is stuff like models and such that should be in both projects no time for that in the moment, sry
theluckyrogue
theluckyrogue7mo ago
Are you using visual studio?
Sun「無用」
Sun「無用」OP7mo ago
vscode I like my memory, kinda
theluckyrogue
theluckyrogue7mo ago
If you are, just make a solution with three projects. One is the blazor project, one is an asp.net webapi project, and the last one is a shared class library project. Then reference the shared library in both of the other two You can do all of this with the dotnet cli Wdm?
Sun「無用」
Sun「無用」OP7mo ago
vs needs too much memory for anything but like, what should I name those too I'm mostly having naming problems
theluckyrogue
theluckyrogue7mo ago
Idk what you are building but I name them like this: <project_name>Frontend, <projectname>API, <project_name>Shared Simple as
Sun「無用」
Sun「無用」OP7mo ago
ah ok should the blazor server do any db calls? that's a problem I've been having too, as it kinda makes sense, but not really
theluckyrogue
theluckyrogue7mo ago
Do you need a db for what you are building? @Sun「無用」 ? If it is, read up on a "code first database" in "entity framework core."
Sun「無用」
Sun「無用」OP7mo ago
yea ik about those, I'm just thinking about architecture rn
theluckyrogue
theluckyrogue7mo ago
Blazor server is not the same thing as blazor.
Sun「無用」
Sun「無用」OP7mo ago
I just did dotnet new blazor and hoped for the best
theluckyrogue
theluckyrogue7mo ago
Yeah that is just blazor you are good
Pobiega
Pobiega7mo ago
If you have a separate API, you would not do database queries in your blazor app
theluckyrogue
theluckyrogue7mo ago
Yeah db queries happen at your api Not your frontend Your frontend shouldn't know what a database is @Sun「無用」
Sun「無用」
Sun「無用」OP7mo ago
welp lemme get 100 spinner animations then
theluckyrogue
theluckyrogue7mo ago
Why is that?
Sun「無用」
Sun「無用」OP7mo ago
for when stuff are loading, my apis are always bad
theluckyrogue
theluckyrogue7mo ago
How many records were you trying to load? @Sun「無用」
Sun「無用」
Sun「無用」OP7mo ago
wdym? sry, was coding and changing themes yet again
Want results from more Discord servers?
Add your server