-2

I am creating an app with Deno (a personal project), and I manage the "database" with only the Javascript code of the Deno enviroment, modifying JSON files like any other JS object. For me, that's seems much more intuitive than using a database client (like mongoDB), and making the classical queries. I prefer to establish my own algorithms to change the data. Also, I like to have the data as plain text, and not in some propietary-form. Overall, I will say that (at least for me, and for now) that give me more clear control over the application, and so I encounter less strange bugs.

I guess that this is not a "best practice", but I would like to know the reasons. I don't know exactly what are the pros and cons to that aproach. Is this a crazy aproach or there are similar examples there?

For example, can this produce more security problems? Is using Deno to change the JSON files directly more faster in the runtime (instead of relying in another layer to do it)?

7
  • Do you believe your solution is scalable? Stable? Secure? Efficient? Behaves sensibly under most circumstances?
    – VLAZ
    CommentedMar 16, 2021 at 12:59
  • I'm asking because I'm searching for the facts, not the believes, on what are the cons and pros. Is perhaps a datadabase client like MongoDB adding an extra security layer? Having that extra layer is not slowing down the application? I don't see why these questions seem so outrageous.
    – Imagitori
    CommentedMar 20, 2021 at 13:58
  • 1
    You asked whether you can manage a NoSQL database better than existing solutions. Well, are you better than existing solutions? I've given you some parameters. I don't really know how you're managing this. However, given that there is a lot of work done on MongoDB and others, my initial assumption is that yours hasn't had the years of usage, testing, and fixes, as well as a team dedicated to building and maintaining the solution.
    – VLAZ
    CommentedMar 20, 2021 at 14:05
  • I don't pretend to replace MongoDB, creating a multi-purpose database client for all types of business logic. All I am saying is what is the reasoning for using a client database in a NoSQL database, when, for a medium API "Rest", I can manage the changes with practically the same effort and verbosity, treating the data like any JS Object. That way, I gain more control over the process, instead of relying in another layer to wich I am blind. With that in mind, I don't see what is the necessity of using another layer, appart of an easy of use.
    – Imagitori
    CommentedMar 20, 2021 at 16:03
  • That's why I asked if something like MongoDB brings any extra-security, or if it manages to be more efficient in the runtime, etc. And of course that there is a lot of work done on MongoDB. The same you could say about jQuery. It seems that rejecting to use a client database the only answer I get is "well, good luck to you", when I ask for objective model cases of what could go wrong. I see it like a minimalistic approach, wich for now has given me a better taste and less bugs for dealing with the data model. That's all. Anyway, thanks for your replies, I appreciate that you took the time.
    – Imagitori
    CommentedMar 20, 2021 at 16:05

1 Answer 1

2

I wouldn't say its a crazy approach, I mean some great software has been written from crazy approaches but there are reasons as to why this isn't a great solution.

Why this isn't a good practice

  1. As VLAZ said in the comments, scalability is difficult with this approach since once you have more data, you're likely going to be performing more complex queries, which are difficult with just JSON files since you haven't set up any custom queries and because as your data grows, your algorithm for performing queries will need to change become more advanced which again, takes timefor you to implement
  2. Also, the authentication will likely be an issue if the project gets larger since you'll want to manage access to the database and generate multiple access keys, which is another setup process in itself with this approach
  3. If this is just a side project or something for a portfolio project, since it's not generally used in the industry (and takes lots of extra work on your side to manage the DB, not even getting to the app) it won't impress most employers and even if this is just for fun, I suppose you're also not able to learn new technologies and systems..

Other things to consider

Also, remember that if your site or this server was to go down, all your data would be lost until your site is back online. Whereas, with MongoDB or another service, your data would still be intact and you might be able to route traffic to a backup server or something like that.

I also doubt that it's faster in a way that actually matters to the end user. Most users likely don't care how long an application takes within about 2-3s of waiting (or at least, that's been my experience). Once the wait has increased to about 5-10s, that's a problem, but I doubt that an additional layer to MongoDB or another service would take 5-10s, probably a max of 1s longer, if even. So from my perspective, likely not, whereas making your own algorithm would increase the response time with a larger amount of data (unless its extremely optimized).

To summarize, it likely takes longer, is riskier in the case of an incident, difficult for you as the developer to set up and generally tougher to maintain.

Hope I answered your question. Let me know if I got anything wrong.

2
  • Many thanks for your points, Harshith. Because my project is totally personal, and I use it for trying and learning new things, I will keep going with this "funky" approach, but now I am going to see how can I address the problems that you and others have pointed. Guess I will look how DBs like Mongo resolve these problems. I am completely aware how this sounds like reinventing the wheel, but my project is somewhat unique, and I would prefer to have something in wich I know ("like the back of my hand") how the data is being processed, and to have, eventually, the maximum efficiency.
    – Imagitori
    CommentedMar 25, 2021 at 18:00
  • No problem. Yeah sometimes it definitely is easier to stick with the things that you're familiar with. It definitely reduces the learning curve. Good luck with your project!
    – Harshith
    CommentedMar 26, 2021 at 19:20

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.