DEV Community

Discussion on: I have no idea what I'm doing, but here Goes #0

Collapse
 
flrnd profile image
Florian Rand

Hey Jaimie glad you continue this adventure. If you want to learn a database, learn a relational db first. And I would advice learning about posgresql directly.

Out of curiosity, Can I ask why did you drop the idea of firebase and similar options?

Anyway, keep going! Cheers.

Collapse
 
jamonjamon profile image
Jaimie Carter

Hey Florian. I'm learni g Mongo because it seems to 'be the thing to do', though I intend to deploy on Firebase. I'm hoping my data structures will work the same in deployment.

  1. Can Node use SQL?
  2. I can't figure out how to build a development environment with Firebase... Though, I haven't had a good look yet.
Collapse
 
thefern profile image
Fernando B 🚀

Hi Jaimie both sql, and firebase have npm packages and are supported by node. Imo it doesn't matter what database you choose, if you want to go serverless then firebase would be a good choice to avoid server maintenance, costs, etc. If you want full control of your database then mongo, or sql or whatever you want to install on your server would also be another choice.

I am in the process of designing an app with firebase so I'd give you my 2 cents. Documentation, and examples are great. And lots of youtube tutorials as well. The nice thing about firebase is that you have a nice documented API, and it separates services database, storage, and auth. On top of that you also have cloud functions. One thing to keep in mind is read/writes limit and costs. Tbh the free spark plan is quite generous. Firebase pricing

If you are planning on using mongo as a local testing make a super class, and then you can subclass actual database implementation separated like that. And with that firebase also supports a simulator local environment for local testing, but cloud testing is not too bad for small apps.

Thread Thread
 
jamonjamon profile image
Jaimie Carter

Thanks Fernando, I was thinking of using Mongo for the dev environment. Thanks for the tip with super class and sub class. I'll look that up first thing in the morning. I really like the look of firebase to get an idea what your concept will turn out like, so I'm super keen to get across at least a bit of what it has to offer.

Thread Thread
 
thefern profile image
Fernando B 🚀

No worries, yeah the idea with a super or even an abstract class is that you keep all the database methods in one place.

Examples:

  • FetchUser
  • WriteData
  • ReadData
  • Etc

Of course these methods would be based on your app, but then on the subclass implementation you can actually focus on mongo in one class, and firebase on another. And somewhere on a configuration file you can easily switch between the two.

Thread Thread
 
jamonjamon profile image
Jaimie Carter

Excellent!! Thanks for this.

Collapse
 
flrnd profile image
Florian Rand

I'm making things more complicated for you instead of helping. Forget about everything I said. I'll try to come back to this tomorrow (it's a bit late here).