DEV Community

Cover image for Check Out My First Node.js Package: Json Flex DB!
Rizmy Abdulla πŸŽ–οΈ
Rizmy Abdulla πŸŽ–οΈ

Posted on β€’ Edited on

13 1 2

Check Out My First Node.js Package: Json Flex DB!

Hello folks,

I'm thrilled to share something really exciting with you all – my very first open-source Node.js package, Json Flex DB! It's a fantastic tool for managing data in Node.js projects, all using JSON.

What's the Deal with Json Flex DB?

Json Flex DB makes handling data a breeze. It's a lightweight and versatile solution for managing JSON-based databases in your Node.js projects. With Json Flex DB, you can effortlessly store, retrieve, update, and delete data, making your life as a developer a whole lot easier.

What's Under the Hood?

  • Data Management: Easily handle all your data operations – storing, retrieving, updating, and deleting – without breaking a sweat.

  • Lightweight: Don't worry about your project getting weighed down. Json Flex DB is light as a feather, so it won't slow you down.

  • Versatile: Whether you're dealing with a simple task or something more complex, Json Flex DB can handle it all. It's versatile enough to tackle a wide range of data management tasks.

  • User-friendly: Designed with simplicity in mind, Json Flex DB is beginner-friendly. Even if you're new to Node.js, you'll find it easy to use and navigate.

Check out my npm package.

And don't forget to give my GitHub repo a star🌟.

What do you think about my first Node.js package? Drop a comment below and let me know!

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (13)

Collapse
 
miketalbot profile image
Mike Talbot ⭐ β€’

Firstly congratulations on publishing a package! I think it would be worth documenting that this is an in-memory database.

Thinking about the actual database code:

  • I'd seriously think about debouncing the save method - it's going to kill performance stringifying and writing files all the time, especially in high data processing environments when there are a lot of changes.
  • I don't see how the indexes are being used. I see you writing to them, but never using the values written - only checking if an index is present.
  • Your method of generating a random key is going to lead to clashes, Math.random() isn't very random. Personally, I use nanoid to do this, but even a function based on Date.now() would be more likely to be unique over any significant number of records.
Collapse
 
yashlalpotu11 profile image
YASH LALPOTU β€’

Agree with your points, thanks for sharing.

Collapse
 
webjose profile image
JosΓ© Pablo RamΓ­rez Vargas β€’ β€’ Edited

Hello, my 2 cents would be to move away from CommonJS and re-write it to be ES modules. This is particularly important when working with async/await syntax, as CommonJS only allows this in functions. ES modules allow it everywhere. Every modern package should just move to ESM and never CJS.

Also, since you're entering this area, you might be intersted in this article:

Collapse
 
rizmyabdulla profile image
Rizmy Abdulla πŸŽ–οΈ β€’

Yeah, that sounds like a good plan! I'm all for rewriting it as an ES Module. Thanks for bringing it up. I wasn't even aware of the differences between CJS and ESM before.πŸ˜…

Collapse
 
rizmyabdulla profile image
Rizmy Abdulla πŸŽ–οΈ β€’

Thank you for your suggestion, Lev. I'll look into it soon.

Collapse
 
sehgalspandan profile image
Spandan Sehgal β€’

Hi @rizmyabdulla ,
Congratulations for your Achievements, but it would be better if explain what it does and how it does in your post too!

Overall, gg, keep up the good work!

Collapse
 
rizmyabdulla profile image
Rizmy Abdulla πŸŽ–οΈ β€’

Thanks πŸ’« I edited the Post !

Collapse
 
sehgalspandan profile image
Spandan Sehgal β€’

πŸ‘€ nice work @rizmyabdulla, quick response, really appreciate itA

Collapse
 
ronakjain2012 profile image
Ronak Bokaria β€’

Congratulations and as a lightweight package it's really great and ppl already mentioned the improvement opportunities but overall it's Good

I have used it for POC and worked awesome.

Collapse
 
rizmyabdulla profile image
Rizmy Abdulla πŸŽ–οΈ β€’

Thank you for using my package😊. I'm still working on implementing the awesome improvements that ppl have mentioned.πŸš€

Don't forget to star my GitHub repository!πŸ˜…

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free β†’

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay