1
10 Comments

Node.js based backend stack

I'm a frontend developer with no backend and DB experience. At this point, I've finished the client-side for my project and need to code a backend.
For my purposes, I picked Node.js + Express and MySql stack.
My goal is to ship my app as fast as I can, so I have a few questions:

  1. Is this stack ok for beginners?
  2. Should I use ORM (e.g. sequelize which seems very hard for me)
  3. What do you think about Firebase as a backend?
  1. 7

    Pro tips:

    • Don't use firebase, you'll spend months learning a pointless abstraction instead of the more fundamental technology it's built on

    • I agree with @seanmcgary , PostGres is the best way to go, use Docker compose to spin it up locally

    • The "JS Stack" is the future and has only become mature as of this year (with the arrival of ESM builders)

    • skip ORMs for the same reason you should skip Firebase. (However, we like Knex because it helps us add a bit of type safety to SQL.)

    1. 1

      Thank you for your answer🙏
      Yeah, firebase is actually a waste of time.
      I picked postgres, don't know why it's so good, but I trust people with a great experience.
      Js stack is great especially because it's much easier to hop into js backend than say python or ruby.
      I tried Sequelize and it was so hard to understand I skipped it, haha😂

  2. 4

    Is this stack ok for beginners?

    Sure! If you're comfortable with NodeJS and know MySQL (or another RDBMS), then absolutely.

    Should I use ORM (e.g. sequelize which seems very hard for me)

    This is going to depend on your database experience. Sequelize is incredibly feature rich but lacks documentation in a lot of places, so having a deep knowledge of your database will give you the reference points of what you're looking for (on top of not being afraid to go reading through the actual codebase).

    Using an ORM effectively is a balancing act. Most database operations are going to be pretty basic - creating, updating, deleting, selecting, etc. Sequelize is one of the few ORMs Ive seen that can properly joins tables together with an all inclusive query rather than making n + 1 queries and aggregating data in your code. Granted, knowing when this is a good or bad practice depends on your level of database experience. Sequelize also allows you to write raw SQL queries, so you're not limited to trying to bend the ORM to your will.

    Ive been using Sequelize since around 2013ish, and still use it today, albeit with PostgreSQL, so if you want to know how to do something, send me a message; Im happy to help out.

    What do you think about Firebase as a backend?

    Ive been using PostgreSQL for the last 10 years and wouldn't choose anything different for my primary database. Picking what you start with is going to depend on your level of experience.

    I think you'll find that if you start with Firebase, you'll be migrating to an RDBMS at some point in the future, mostly due to cost, if your app takes off. AWS RDS has a free tier that is more than sufficient to build a proof of concept on, so if you're familiar at all with MySQL, I would say start there. Scaling at that point is clicking a button to make your instance larger.

    1. 1

      Thanks for your response!
      I know nothing about backend and DB - that's the main problem for me. I'm trying to figure out what stack will fit my needs. For now, I decided to stop with Node.js and PostgreSQL. I'm working on a budgeting web app and I suppose SQL will be a better choice than NoSQL. Talking about ORM I think it will complicate my life so much😅

  3. 2

    If you're already familiar with Javascript on the front-end your learning curve will be relatively small.

    If you don't want to use an ORM I'd recommend using Knex.js for building your queries, it's much easier than writing queries manually and not as complex as using an ORM.

    Avoid Firebase, if you want to speed things up, then using a Node.js boilerplate along with choosing a simple deployment process would be a better future-proof option. eg. deploy to Heroku or DO and avoid complex setups like Docker and AWS.

  4. 2

    nodejs thumbs up, firebase thumbs down. firebase in production is bad if you need adwanced queries on the data. go with rdms instead

  5. 2

    I'd learn a stack like MEVN or MERN, so yeah. Depending on your scope of users/data firebase could be fine.

    Also firebase wont take months of learning , lol.

  6. 2
    1. It should be ok, especially given your frontend experience with JS.
    2. Some people prefer to avoid ORMs with performance sensitive projects. I think a good alternative to avoiding ORM is to choose one that supports overriding some performance-sensitive things with handwritten SQL. Due to this reason and due to the complexity of Sequelize (and some bugs it has) - I think objection.js is a better solution. It has most of the abstraction benefits you get from ORM without a steep learning curve (like Sequelize).
  7. 2

    Hi Vladyslav, good questions but the answers you get will be limited without more information regarding your project. Assuming you know javascript due to your front-end development skills then I would say that Node.js would be a good fit. MySQL would be a fine choice and you are likely to find a hosting provider with that stack already configured. Firebase is decent and I use it for a mobile application but since you likely will need the back-end for more than just the database then I recommend giving the MySQL option a chance. Please note that I do all my own stack configuration using virtual servers so my answer could be slightly bias as I like to have more control over my stack.
    Good Luck
    -m

  8. 1

    Lots of opinions here from web developers who have been at this a lot longer than me, but as a fellow (relative) newbie, if for some reason you hit a wall getting going with any of these RDBMS options and need for speed is critical, Firebase is really fast/easy to get up and running for the purposes of an MVP.

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 16 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments