
Show HN: Node.js CRUD template with users, password resets and permissions - mongojunction
https://github.com/cris691/servedata
======
lioeters
Thanks for sharing your project. I think the Node.js ecosystem could use more
examples and templates, to demonstrate commonly needed features. It's also
good programming practice to create a template project like this, to learn how
to build such server functionality.

For constructive feedback - I got the feeling from the codebase that it's a
bit too opinionated for my use case. Aside from idiosyncratic naming (use of
constant case, or folders starting with underscore) and formatting
(inconsistent indentation), I think the template could benefit from using
common building blocks already available in the ecosystem, rather than every
aspect being custom made.

There are common libraries and patterns that are "idiomatic" in Node.js (or
any other language ecosystem for that matter), and most boilerplate projects
consist of a curated selection and combination of such common building blocks.

For example, Handlebars or EJS are typical solutions for templates. (More
typically these days, React rendered server-side.) Mocha, Jest, Ava are often
used for testing. There are popular modules for JSON document database.

A big advantage of using "community standard" libraries is that each project
becomes more consistent and predictable, in organization/structure and how
features work together. Having each module developed, documented, and
maintained by the wider community is more efficient too, so that we can all
benefit from - and contribute to - the open-source ecosystem.

~~~
mongojunction
Thanks for taking a look and for the extensive feedback. I really appreciate
it.

you're right from your point of view. I also think this project is probably
too custom to get extensive interest. although you never know. some really
cool projects did start out as custum hacks someone made. JS, redis, Dropbox
and Perl (I think). not that I'm comparing it to those in terms of impact. and
I certainly don't want the lonely and underpaid burden of being a popular
project's open source maintainer.

anyway, for me some reasons that contributed to my choice to make it by hand
almost totally from the ground up were:

\- learning experience. I just kind of wanted to learn about databases since
they're so widely used. good to build one to do that \- desire to simplify.
those apps are everywhere and there's a lot of complexity and opinion that
goes around that so I wanted to see if I could have my stab at simplifying for
myself the conceptual model. I figured that would make it easier for me to use
and build those kind of apps in future \- desire to use tools that fit me. I
really find myself more productive if I can use tools that are well suited to
how I think and work. so often I like to build my own tools. and having whole
stack like that give me a sense of satisfaction that I've touched all parts of
the project in a sort of craftsmanship manner. \- ownership for quality. doing
it that way meant I could create everything to my own standard and
specification and not have to rely on other people for quality. if something
went wrong then I knew that it was my responsibility and I could fix.

I'm quite scared to look foolish by sharing the following and that's sometimes
I wondered when doing this that maybe would have been easier just to use
someone else's database or someone else's templated feature equivalent app.
and I was really about to kind of give up on this whole project when
something's not working, I almost chucked it all the way but that sort of
"last straw bug" never happened and I just pushed through.

I suppose what I hope to achieve by releasing it publicly and posting it here
is mainly just to mark the moment for myself that I have achieved this and
that it's in a state where I feel okay I can stop an intense period of work on
it. because i could achieve most of what I originally set out to do.

and I'm somewhat aware that there's not that many examples of templates like
this, common as these apps are, and if somebody wants to inspect the code at
least it can sortof maybe give them a starting point to understand how one
person anyway thinks about solving these problems.

I'm not even saying that that can be helpful for other people very much but it
can probably help some people some of the time.

~~~
lioeters
Nice, I especially agree with this part:

> ..find myself more productive if I can use tools that are well suited to how
> I think and work. so often I like to build my own tools.

To be honest, I'm the same way. Over the years, I've always had a collection
of custom libraries for common needs. I often enjoy writing my own library
from scratch too, to understand how it works. Routers, databases, template
languages, builders.. Sometimes, after developing it to satisfaction, I
understand the value of a popular library that does the same thing, better
designed or documented than what I built - in that case, I'm fine with
transitioning to a better tool.

There's definitely something to be said for well-crafted custom tools that
work just how you want, intuitively. And you're right that's how popular
projects all start out - so, if everyone used only what's available, we would
never make progress. :)

So what I wrote about using "community standard" libraries, maybe it was a
kind of advice to myself..

> I was really about to kind of give up on this whole project when something's
> not working, I almost chucked it all the way but that sort of "last straw
> bug" never happened and I just pushed through.

Right, I see, this is a kind of record of your journey to solve all the
functionality you wanted in such a template project.

> mark the moment..that I have achieved this

Yes, congratulations on releasing it - that is an achievement worthy of
itself. I think many of us can relate to being "scared to look foolish", and
we should all feel encouraged to make things public, whether we're experts or
beginners.

I also agree that, we never know if something can be valuable to other people.
Since your code is now open source, anyone can learn from your experience, and
use it as a starting ground for their own applications.

------
winrid
Couple things that stood out: code is not in a "src" folder separate from
configuration. Views have just an "html" file extension - usually you would at
least have the templating language extension there too. Didn't see any
indication of test coverage. Also it looks like you have your own test
runner?? Using Jest for ex. gives you a lot.

First thing in the readme is lines of code. I would start with what this is,
what problems it solves, and why it's better than the alternatives.

~~~
mongojunction
Good feedbacks. those all sound like changes I'm happy to make. If you want to
contrib I'm happy but don't expect that from you at all obviously.

------
villgax
What I really wish for is a database migration ready app boilerplate & Ops.

~~~
xgenecloud
Check out
[https://github.com/xgenecloud/xgenecloud](https://github.com/xgenecloud/xgenecloud)
\- it scaffolds backend boilerplate with database migrations creation and
management via a GUI tool. It supports : MySQL, PostgreSQL, SQL server &
SQLite.

------
xgenecloud
This create CRUD templates for stubdb.

Happy to learn more on Stubdb - how does it differ compared to Sqlite (also
from issues in stubdb - it wants to support IPFS)

~~~
mongojunction
It's a very simple, 500 line JSON DB, with extremely simple indexes. It's
meant to be very lightweight people can just set it up and modify it easily.

Somehow just the idea of using the filesystem tree for record lookup was cool.
And I liked the idea that each record is a separate file so if you want, your
can edit and view by hand or using tools. also want to add git repo to db to
do versioned backups and change log etc.

IPFS BTFS issues are just considering a way to use a directory that's mounted
into some p2p network. just for curiosity I suppose. it could be cool for
applications of that

