I am trying to figure out how to spin up effective React apps as fast as possible. I have loved my experience with using Next.js so far and have been using Next-Auth as an authentication process.
So far, I have used Django on the backend, but it looks like I can speed things up by ditching the backend and going serverless with the Next.js API routes. That means I am left with a database solution to figure out. Does anyone have experience using Firebase together with React, or alternatively using TypeORM with a PostgreSQL database?
I am valuing ease of development in this decision.
I am valuing ease of development in this decision.
Unless you have a hard requirement to server render the authenticated pages, and that your business domain and schemas are very well known and defined, I would advise you to completely ditch next-auth and server side code altogether, and use the client side authentication pattern with Firebase Web SDK.
The power of using Firebase SDKs are that you get an out of the box auth system, real-time data updates, offline writes, etc without writing a single line of backend code. Security is not a concern if you properly write the Firestore security and validation rules for your various use cases. Club it with Firestore and Auth triggers running on Cloud Functions and you already have a solid infrastructure to quickly pump out features. There is a solid react hook library for firebase react-firebase-hooks
that would massively simplify your development and coding/maintenance efforts.
In future when your product matures and you get clarity around your business domains and have very well defined schemas, replace smaller parts of the system with individual apis, stricter schema based DBs (any SQL DB), microservices, etc as you scale.
To sum it up
Use Firebase Web SDK with hooks directly on the client side app in NextJS
Use Firebase Authentication for all your auth needs
Use Firestore for all your data needs
Add Firestore security/validation rules for read/write operations