

Crud-bones - Boilerplate project to kick-start your Node.JS/Mongo/MySQL CRUD app - green
http://words.alexeypro.com/crud-bones/
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!
======
mwill
Is MySQL a common choice with Node.js? Don't see many people talking about SQL
and Node.js. Anyone using this combo got something to say about their
experience with it?

~~~
green
Hard to say if it's a common choice. I've had few projects where Node.JS was
the choice of backend, and MySQL was the database, because our frontend was
PHP/static HTML/CSS/JS stuff. DB is not really important. Node.JS shines on
the backend, and it doesn't really matter to what it talks to. MySQL _can be_
decently fast, but you can as well use Node.JS solely with, say, Riak or
Mongo, or just Redis? In this "crud-bones" project I am use Redis as a cache
layer, but you can use it as "storage" as well...

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

~~~
green
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.

------
tferris
Nice work!

Do you use any ORM for MySQL?

~~~
green
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-...](https://github.com/alexeypro/crud-
bones/blob/master/src/api-rest.js#L9) 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?

------
crcastle
There should be something like this for every language. I've recreated this so
many times in so many languages.

------
valladont
I am just getting in to node.js, I will have to try this and see if it makes
things any easier.

~~~
green
I hope it will make things easier, or at least would server as a collection of
code snippets "how to" :-) Let me know if you have any questions, or would
like to have something beyond what you see there. Feel free to email me
(<http://alexeypro.com>) or just simply contribute to the project. Thanks!

------
jordhy
Just in time!

~~~
green
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, ...

------
atjoslin
Thanks. This is a huge help for me.

~~~
green
Let me know if you think it can be improved. I am happy to make it easier. :-)

