Frontend dev is best dev
So this has been the case for many a year now, that everything in JavaScript land or in this day and age, TypeScript land, is targeting the fact that the developer can use one codebase for everything frontend and backend. This means you would use the same file for the definitions of the data models that both the NodeJS/Deno backend will use as well as the frontend to query/reason about those objects. Use a simple REST API to ship data back and forth and so on.
I just have one thought/question; why?
Why indeed
Well it seems like more and more was pulled into the frontend as time passed on, mainly to free up the backend to do the real processing. Like number crunching, data processing and so on. Which makes sense, but now it is weird to say the state of an application should be as close to the user as possible. Also servers are now more than capable of doing both work, and therefore the natural conclusion is that since most of the things were in the frontend anyway now; why not move the whole thing to the frontend?
The thing is that it makes the codebase more difficult to manage, you introduce unwanted complexity let alone making it secure. The whole codebase has so many extra dependencies and vulnerabilities since a lot of Server Side Template Injection (SSTI) plague the landscape now and have been fixed/found already in the old backend languages.
Of course it seems convenient, but let's take the data models that you want to use. You define them either from the frontend perspective or backend perspective first. In the frontend you might only want first name and an e-mail address, for example. Then in the backend you want to have maybe something more than just first name and an email address. How about a password to login? Or a session id, or maybe just an id in general for the databases so you can store multiple combinations of people? Then you have to transform schemas or build them differently. So you get views or something equivalent and suddenly everything is back to this again.
I would steer away from having the whole application in one language with one library/framework since nothing so far checks all the boxes and covers all the bases.