hoangvvo / nextjs-mongodb-app

A Next.js and MongoDB web application, designed with simplicity for learning and real-world applicability in mind.
https://nextjs-mongodb.now.sh/
MIT License
1.53k stars 286 forks source link

Support for Firebase as database and user authentication #76

Open RachelHow opened 4 years ago

RachelHow commented 4 years ago

I'm new to code and would like to learn how to set up using Firebase instead of MongoDB.

Would like to see an alternative code to Firebase instead, hope this is alright.

(I'm new to this so I'm not sure if I did it the right way. Sorry if I caused any issues!)

hoangvvo commented 4 years ago

:disappointed: So sorry I don't work with Firebase so I don't really know much about it, but I can try to point you toward the right directions.

Look at https://github.com/hoangvvo/nextjs-mongodb-app/blob/master/middlewares/database.js

You want initialize the Firebase store there and attach it to req (it can be req.db).

Then you want to rewrite all the function req.db.* to the equivalent in firebase. Also our session store is connect-mongo, which is for mongodb, so you need to replace it with the firebase equivalent too.

If you need any help along the way, feel free to ping me!

victorfu commented 2 years ago

@RachelHow If you are looking for nextjs integrated with firebase, check this example https://github.com/vercel/next.js/tree/canary/examples/with-firebase

athifbinu commented 2 years ago

what is the issue