Notes from a Maximilian video here. This definitely helped me better understand some of the broad styles.
There are three broad styles of website, Dynamic, Static, SPA.
This is more traditional than you have HTML generated by a server. Maybe use a templating engine if your app is built with Express. He said you’re good for when there’s frequent data changes. This style is for content that’s highly dynamic and SEO matters. This site style is not going anywhere. These are like multiple page apps. This is more traditional. WordPress is dynamic site that uses PHP MySQL on the back end instead of node and mongo.
A single page app is modern apps It’s instantaneously kind of very zippy You don’t change pages just gives you the illusion that you do that. You connect to a backend via an API maybe hosted on Express. Use react as a front end framework. May use next JS for server side rendering for SEO benefits. Parts of the page are updated there’s a decoupled front end and you have a distribution folder.
API? Consume an existing or create your own? Well this is definitely two options but obviously you have more control with your own.
When do you use an API versus server-side routing? Well this would be like if you’re using a single page application you’re going to need an API. If you have a full stack application that uses server-side routing then you don’t necessarily need an API.
When does an API need or not need a database? I think this is still about data persistence? If you need to update and store these updates for things like user authentication or to display a high score.