7
lorentz
4y

Lessions I learned so far from my first big node/npm project with tons of users:
1) If you didn't build something for a while, expect 3 hours of resolving version conflicts for every two weeks since the last build.
2) Even if the tests pass, run the containers on your own machine and make sure that the app doesn't randomly crash before deploying
3) Even if the app seemed to work on your own machine, run the tests again in an environment mimicking prod at most 15 minutes before replacing the running containers.
4) Even if all else indicates that the app will work, only ever deploy if you expect to be available within the 4 hours following a deployment.
5) Don't use shrinkwrap for anything other than locking every version down completely. A partial shrinkwrap will produce bugs that are dependent on the exact hour you built the app _and_ the shrinkwrap file, and therefore no one will ever have seen them other than you.
6) Avoid gyp, and generally try not to interface too much with anything that doesn't run on node. If parts of your solution use very different toolchains, your problems will be approximately proportional to the amount of code. And you'd be surprised just how much code you're running. (otherwise it's more logarithmic because the more code the less likely a new assumption is unique)
7) Do not update webpack or its plugins or anything they might call unless you absolutely need to
8) Containers are cool but the alpine ones are pretty much useless if you have even just one gyp module.
9) There's always another cache. To save yourself a lot of pain, include the build time in every file or its name that the browser can download, and compare these to a fresh build while debugging to assert that the bug is still present in the code you're reading
+1) Although it may look like it, SQLite is far from a simple solution because the code and the bindings aren't maintained. In fact, it'll probably be more time consuming than using a proper database.

Comments
  • 0
    @devjesus These are lessons I learned from making the same mistakes over and over again, and many of them I can't even follow in this project because eg. a production-like environment for testing isn't part of the budget.
  • 0
    Point 2 is the biggest truth I’ve seen. I would add if doesn’t work in your pc run it in the container just to check if node/npm randomly decided to stop working in your machine.
  • 0
    this scares me ... my app isnt even running in containers (thats planned, but for the very distant future) .. right now im just keeping everything the same and never updating until i absolutely have to. pretty bad i know, but when you're a 1man team with a full time job, you cant help it. sorry future me, and good luck.
Add Comment