Live data from Hacker News

Crud-bones - Boilerplate project to kick-start your Node.JS/Mongo/MySQL CRUD app

words.alexeypro.com

1–10 of 15 posts

Crud-bones - Boilerplate project to kick-start your Node.JS/Mongo/MySQL CRUD app

#1
No, it's not an another framework. Chill. All this code is basically the template which I use to jump-start with new project. It has simplistic Model and DAO (MySQL and Mongo - which are interchangable), and all the usual set of Node.JS modules I like to use (I gathered them from across many forums, as the most stable and reliable). So, it saves me a ton of time. I clone it, and go from there. You can get simple CRUD right away, just change the model (yeah, it's very "opionated"). And if you feel like you need something more sophisticated just change the code!

Crud-bones - Boilerplate project to kick-start your Node.JS/Mongo/MySQL CRUD app
words.alexeypro.com

Re: Crud-bones - Boilerplate project to kick-start your Node.JS/Mongo/MySQL CRUD app

#4
post #2

Nice work! Do you use any ORM for MySQL?

Actually, I don't -- I am trying to keep the app extremely simple, and straightforward. I don't want new Rails app, neither want Java-style-framework. All of us are going to cut it back and forth to make to suit our next project needs, so why bother?

The switch between using Mongo and MySQL -- is just using different DAO -- https://github.com/alexeypro/crud-bones/blob/master/src/api-... I kept the "interfaces" (yeah, not interfaces but contracts, 'cause JavaScript has no interfaces, but you know what I mean) same, and that makes the switch EASY.

In short-term plans I want to update README as for the deployment instructions to other Node.JS hostings, and probably throw some simple caching layer on top of Redis, and definitely some unit testing. Then it should be all set. Just basics to get me up & running with new backend effort :-)

Frankly, even those things are not necessary. They will make the app more complicated, but let's be honest -- we use Node.JS because it's lightweight and minimalistic approach, so why create an ugly-beast-which-does-it-all-its-own-way?

Re: Crud-bones - Boilerplate project to kick-start your Node.JS/Mongo/MySQL CRUD app

#5
post #3

Just in time!

I am glad if you found it helpful, and happy I didn't sit on it.. yeah, it's far from been all shiny and polished, but the intention is to get basic Node.JS CRUD project up and running, so you can focus on actual project's goals, not (while simple but still time-wasteful) basic implementations. Especially if you need to wire together DB connections, Express, EJS, ...

Re: Crud-bones - Boilerplate project to kick-start your Node.JS/Mongo/MySQL CRUD app

#7
post #6

Interesting code. Have you thought about automatically creating the models by using SHOW TABLES + DESCRIBE? Might save you some time.

That's definitely something what I don't want to do. Not that it's bad, or something.. just it defeats the purpose of this app. The goal is to have some skeleton or base to start your own stuff. There is no reason to make it so flexible so it'll generate all that stuff. Besides, as you can see, my app works with Mongo or MySQL DB by simply changing ONE SINGLE LINE of the code. Which is kinda cool, I think. No ORMs, no special "preparations". A little bit work on the model class, and you are done.

Besides, I mentioned that already, we all know we are going to change this code for our own needs. So it needs to be simple, straightforward and interchangeable. That was my goal.

Post reply on HN