Avatar of Ray Arayilakath

Ray Arayilakath

Full-stack Developer && Software Engineer at Self-employed
Full-stack Developer && Software Engineer at Self-employed

Moving from a SQL database to a noSQL database is a really big deal, congrats 馃憦! In the current industry having handy knowledge of both is really important and I would recommend continuing to learn Firebase even if it feels a little unnatural.

When using noSQL databases you have consider the idea that the models you work with are individual documents. The data in the documents can be duplicated, re-referenced, and completely dissimilar to each other-the only thing differentiating two documents is an ID value. It's normal for data to be duplicated if you don't perform operations on the same document you already created. You stop unnecessary duplication by wrapping your document creation in a function that checks for a certain value (say if you don't want a username value to appear twice you would check if your collection of documents already has one with a username value and then throw an error).

Creating relations in a noSQL database would be done by referencing a different document in another collection (typically with the aforementioned ID value) and then going and finding that document in that collection. Say you want to find a user's posts. In the User document you would have an array of references to different documents in a Post collection, and then you would go to the Post collection and find each document that has a matching ID number to the ones stored in the User's references.

All in all, you have to realize you are working with two completely different ways of storing and relating data, similar to learning a new and completely different language. If you stick too it and don't try to force SQL onto noSQL then you will get the hang of it and it will be very rewarding.

READ MORE
7 upvotes2 comments16.4K views
Jens G眉nther
Jens G眉nther
May 18th 2022 at 4:36AM

Ray, without the context of the question your reply is 100% correct.

Reply
Ray Arayilakath
Ray Arayilakath
May 18th 2022 at 4:00PM

Thank you, Jens :).

Reply
Full-stack Developer && Software Engineer at Self-employed

I see it's been some time since this was posted, but I'm glad you are migrating to Next.js 馃帀!

Me personally, I would run an Express.js backend so that frontend and backend logics don't feel blurred, especially if you want to attract more developers to your project. Keeping frontend separated from the backend makes for a healthier workspace ecosystem and often confuses people less. Furthermore, implementation is a lot easier and later on as you move from RoR to an Express.js server there won't be too much confusion as to how certain parts mesh together.

Based on the features you're looking at I would consider using websockets (WSS or Socket.IO) for the chat application or rolling that with features from WebRTC, which you would need to support video streaming anyways. For authentication you could look at Auth0 which has some very nice libs for authentication or you could rig up your own stitching individual OAuths (Google, Facebook, etc.) along with a simple User/Pass signup that you manage in your database. For payment I would consider using Stripe, it's very popular in the JS ecosystem right now, has lots of documentation and features, and is also pretty cost-effective.

I know it's been some time since you have posted this and you have already made some decisions, but if you (or anyone else reading this) has any question feel free to let me know :)

READ MORE
4 upvotes22.8K views
Full-stack Developer && Software Engineer at Self-employed
Recommends
on
MongoDBMongoDB

There are many things to consider when choosing between noSQL and SQL databases, but in short SQL databases are often more performant whereas noSQL databases are more friendly for developers to create and maintain.

Since you are building this website up from scratch it would be best to use MongoDB because it makes for an easier developer experience, cuts down on the time needed to setup a database, removes the need for someone specialized in database development (unlike SQL databases which needed to be engineered with tables and rows noSQL databases are rather intuitive), and is overall a better option for a startup.

Some considerations to keep in mind is switching from a noSQL database to a SQL database later on is very, very tricky. If you find that you want to improve performance or later prefer SQL databases it's not going to be an easy feat, however you may come to love noSQL databases and your team will also appreciate its simplicity as well. Another consideration is cost. I'm not familiar with the expenses involved in using Heroku PostgreSQL however MongoDB can be a financial overhead when your project starts to become more user-heavy and you perform more operations and store more data. You may want to perform a quick cost-analysis before choosing your preferred database.

I hope this helps you (or anyone else with a similar question in mind) out a bit and good luck with your marketplace!

READ MORE
3 upvotes6K views