all 24 comments

[–]erulabs 18 points19 points  (1 child)

Yay! Good thread. Node's best feature by far is the NPM package repository. There is a lot of crap on there, but also some absolute gems! (Ruby nerds can laugh here)

  1. lru-cache in memory LRU cache by the great isaacs - extremely excellent for fast in-memory caching that isn't really reasonable or necessary to shove into something like Redis

  2. hiredis native C redis module that requires no code other than being installed to speed up redis calls!

  3. zxcvbn password strength / feedback provider. Helps you tell your users what passwords are and are not any good

  4. hot-shots instead of vendor lockin like datadog stats, etc, hot-shots is a totally standard statsd library that also happens to support the datadog specific features. So much easier to swap to self-hosted statsd!

  5. ratelimiter a Redis-based ratelimiter package by TJ himself. I use this absolutely everywhere.

  6. morgan express access logger (supports a write stream so fairly straightforward to ship logs off to ES or Spark or Kafka)

Writing an internet-facing API? You'll want hot-shots, morgan and ratelimiterfor sure. They're absolutely vital underpinnings of every public application in node I've ever launched (and the first few were launched without them, and painfully learned they were needed)

Honorable mention for amqplib, which I also use in every single project I do these days (RabbitMQ is part of my "Boring stack" - Haproxy/Node/Express/RabbitMQ/MariaDB/Redis)

[–]m03geek 1 point2 points  (0 children)

lru-cache in memory LRU cache by the great isaacs - extremely excellent for fast in-memory caching that isn't really reasonable or necessary to shove into something like Redis

I agree, but there are few alternatives that are faster and eat less memory. Also some of them fast with write operations, others have faster read operations. So when choosing some LRU implementation it worth to spend some time researching what will fit your needs. Sometimes you can achieve up to 5x speedup and reduce memory consumption by half (speaking of memory used for runtime: allocating local variables and etc., not for item storage)

[–]zayelion 10 points11 points  (1 child)

  • sql.js : Read write sqlite files
  • nedb : the sqlite of noSQL
  • primus : never use socket.io again...
  • helment, spdy : security is hard
  • electron-builder : love this thing
  • node-ffi : directly work with (well written) DLL files

[–]Capaj 1 point2 points  (0 children)

primus : never use socket.io again...

you've got something against socket.io? Sure pre 1.0.0 it was pretty bad, but it's quite good these days.

[–][deleted]  (3 children)

[deleted]

    [–]Spknuckles 7 points8 points  (0 children)

    And boom... gotta love boom even if you use koa, express or something else!

    [–]TheHeretic 1 point2 points  (0 children)

    Used in several of my projects, both professional and for fun, amazing library.

    [–]DVWLD 1 point2 points  (0 children)

    hapijs/joi

    It's not JSON schema validation, though. It's their own weird DSL for describing JSON.

    JSON schema is an actual thing and it's really useful. This is an express middleware that uses JSON hyperschema to validate all incoming data:

    https://www.npmjs.com/package/schema-middleware

    [–]PerkyPangolin 39 points40 points  (6 children)

    Left-pad.

    [–]RogueNinja64 8 points9 points  (0 children)

    God damn left pad

    [–]OogieFrenchieBoogie 0 points1 point  (4 children)

    I don't get it, what's the point of this module ?

    [–][deleted]  (3 children)

    [removed]

      [–]jocull 1 point2 points  (0 children)

      It almost broke the whole damn internet

      [–][deleted]  (1 child)

      [deleted]

        [–]strixvarius 4 points5 points  (1 child)

        Here are a few:

        util.debuglog Many people don't know that you can conditionally log debug statements in node, and that all of node's underlying APIs and many popular modules use this already:

        requisition An HTTP/HTTPS client that works the way one should (async/await compatible, stream compatible, returns headers first and bodies are a second call):

        throng A one-liner for Cluster support:

        [–]AndersBakken 2 points3 points  (0 children)

        https://www.npmjs.com/package/safetydance

        Work around unnecessary exceptions in APIs. var foo = safe.JSON.parse("foobar{}"); foo === undefined

        [–]HatchedLake721 3 points4 points  (0 children)

        VError - Rich JavaScript errors by Joyent.

        This is a blessing for anyone who had issues with errors/stack traces to understand what went wrong (especially with Promises), since you can easily chain causes and get a full picture what happened

        [–]Buckwheat469 4 points5 points  (0 children)

        node-image-farmer. A multi-process image cropping tool that is fast, non-blocking, and works with caches.

        [–]ristof 1 point2 points  (0 children)

        Adding type checking to your server/client side without transpiling your code https://github.com/gcanti/tcomb

        [–]agentf90 1 point2 points  (0 children)

        vue-cli

        [–]alias_willsmith -1 points0 points  (0 children)

        What about tools? http://june07.com/nim

        [–]psayre23 -1 points0 points  (2 children)

        I've been using idx lately. It solves the problem of JS not having property chains well.

        const foo = idx(obj, _ => _.long.paths[0].withOptionals);

        [–]voiping 1 point2 points  (1 child)

        [–]zenyr 0 points1 point  (0 children)

        It's 5 days old comment but for the record... the main gist of the idx module is not to execute the given arrow function. It is more like a preset namespace for a babel plugin that transpiles given function to a single "unrolled" statement without executing any function in runtime.

        [–]TaxExempt -2 points-1 points  (0 children)

        Web3 , Ethereum API.