问HN:2024年单页应用(SPA)与服务器端渲染(SSR)哪个更好?
我正在进行一个新项目,后端的内容和处理量相对合理,但并不算太重。我的默认方案是使用静态服务的简单单页面应用(SPA),配合一个CRUD后端,可能会选择FastAPI和Svelte。然而,我听到很多人赞扬更多服务器端渲染(SSR)的优势,认为这得益于更好的边缘计算技术。很多人似乎倾向于将后端放在Cloudflare Workers等服务上处理。你们在这两者之间的经验如何?
对于一个大型团队来说,拥有统一的前端和后端似乎更方便,而人们似乎也喜欢SvelteKit,但我个人并不介意将两者分开。我也能看到使用TypeScript、Prisma和Zod相比于SQLAlchemy和Pydantic的优势;Pydantic在一定程度上改善了Python,配合mypy和pyright,但类型系统仍然显得有些生硬。此外,使用SSR似乎会稍微增加我的托管费用,因为SSR将工作转移到了服务器上,而Workers或类似服务通常比VPS的费用要高。谢谢!
查看原文
I'm working on a new project that has a reasonable level of content/processing done on the backend but nothing too heavy. My default approach would be a simple SPA served statically with a CRUD backend, probably fastapi and svelte. However, I've heard lots of people extoll the advantages of more SSR due to better edge compute technologies. Lots of people seem predisposed to throw their backend on cloudflare workers or something and handle it there. What are y'all's experiences between the two?<p>It seems marginally more convenient for a large team to have a unified front/backend and people seem to like sveltekit, but it doesn't personally bug me to have the two separated. I could also see advantages to typescript/prisma/zod for instance over sqlalchemy and pydantic; pydantic improves python a bit along with mypy/pyright but typing is still very much hacked-in. It also seems like I'd increase my hosting bill a bit, both because SSR shifts work to the server and because workers or similar services generally have markups over a VPS. Thanks :)