Oct 21, 2020
I personally like using a wholly JS stack, with TypeORM + MySql/Postgres over MongoDb + Mongoose because TypeOrm's Typescript support is much stronger. After developing large projects with Typescript, there is no going back to regular javascript (typings help catch a LOT of errors / maintains data structure !)
Sticking with a javascript stack will allow you to share certain aspects of your application between front and backend. For example: one particularly common feature is to validate API call data and form entry data. Both of these are the same data shape typically (aside from pagination, metadata, etc), and can benefit from a single schema for validation. I use Yup to define this schema, then in the front and back end I can utilize this definition instead of rewriting the same logic in two different languages.
Same goes for certain utility functions such as data structure typings, decryption, encryption, sanitizing inputs, formatting of data, and other utilities. No point of writing these in two languages when both frontend and backend will use them. It will also help reduce developer work load, due to less tests / code to work with.
The only thing you must ensure in your import chain the frontend never imports any secret variables or sensitive logic used by the backend, as that will get bundled into your application. All shared imports should be individual modules
If you want to go one step further, next.js is basically create react app with server side rendering (SSR). This would allow you to skip the annoying step of configuring separate backend and frontend build tools. Might be worth exploring depending on your skill level.