so on my website you’d login and afterwards you are able to watch some videos. Each user has some videos to his disposal but these are specific to the user (which courses he is taking etc.). My first question overall is:
- Is this even a good usecase for an SPA? The reasons I am thinking about an SPA are these: After login, I do not need SEO, so there goes that drawback. While the user is on one site, the other sites could be prefetched already, so when he clicks on another video, the change to that video page is immediate (of course the video itself would need to get fetched only then, but the site change is immediate). There is also some stuff on each site which I would like to be reactive.
Now how I wanted to build this is as follows:
I have some server A that serves a public-facing part of the website (where google can land, users can register and login) and also serves an API. This server does user management. (and also payment for creating new accounts)
After login I just serve my SPA from a Next.js server B. The served react app interacts with server A by querying the API. A user will have normally 10-20 videos which are available to him, but these are specific to the user. Therefore all the sites of the SPA actually need some kind of server interaction (they need to fetch video on that site and maybe some other data about the video).
I have a few questions:
- Is this the right way to build this kind of application?
- What kind of authentication would server A use? JWT? Sessions? And why? What about cors?