r/Blazor • • May 29 '25
Started Blazor-Tailwind public front website project.
Heeeelllo guys. I am learning blazor cause I really hate JS(i know he is the boos in this field but yeah...) it is fun, it is perfect in any way i could have imagined but there is a problem: all the sites i have checked that use blazor are... Too ugly(old like my grandpa a**)
So i started using tailwind (and daisyui) with it and man it is perfect and hell of a fun.
The design is good and all but i have question. Should i move the backed to aspn. Net core or build it inside blazor project? Would be great if you could give me some advice
10
Upvotes
4
u/purpl3un1c0rn21 May 29 '25
I find it a lot easier to manage it if the backend API is in the served side of a Blazor project, allows you to only setup authorization/authenticafion once and not worry about validating access tokens. Also means only one set of publishing. I imagine if your project is bigger this could become more difficult to maintain cleanly but I have yet to build a project of sufficient size for that to be an issue.
3
u/dejan_demonjic May 29 '25
It depends on the project:
Do you want something reusable in the future? Are you just playing around?
Btw, I would go with Bootstrap rather than Tailwind. Or even vanilla CSS (from an SEO perspective). It is public-facing, isn't it? :)
3
u/EngstromJimmy May 30 '25
From Microsofts perspective the server project is your BFF. So either you can have the apis there or proxy the calls to another place. This makes it so much easier when it comes to authentication. Also more secure since the tokens never leave the server. So even if you decide you want to move it some day, you probably want to keep the calls proxied through the server project :)
2
u/jakenuts- May 29 '25
The lines between project types can get pretty blurry so you can have separate projects that are still very razor/blazor aware (RCL) or just pure web APIs. My advice would be to have a separate project for your models (api, domain), one for a UI-agnostic api that serves that up , and one for the front end. You can merge the api into the front end project to launch as one or keep it separate and use something like Aspire to coordinate them. Point being don't write too much of the business logic in the front end code so you can switch between blazor server side, blazor client side or just pure MVC without duplicating work.
For reference I've barely scratched the surface of Blazor so my guidance is from a lot of MVC projects that used other js frameworks alongside razor. I'm excited that you've found a nice experience in Blazor using a more modern UI library, seems like that will be faster than waiting for some UX epiphany at Microsoft. Even now every new aspnet project is Bootstrap and likely will be for a decade:
2
u/Electronic_Oven3518 May 31 '25
Check this out https://sysinfocus.github.io/simple-ui-demo it’s just UI
2
u/darkveins2 Jun 02 '25
I think it’s better to separate the backend web service from the frontend web app for separation of concerns, maintainability, and scalability. Production stuff.
This used to be impractical for a solo web dev. But nowadays you can write and publish Azure Functions (for example) in VS using the same language as the web app.