I am learning web development. I have done a few small projects, however, those are all in development stages which are far from ready for production.
My coding practices mostly come from online resources e.g. books, articles and tutorials. However, these are mostly for beginners. I love and appreciate all the tutorials but now I'm at a point that I want to look for more advanced and production-ready examples as well as coding practices.
Looking forward to hearing any suggestions. I'm focusing on Node.js so any recommended resources are highly appreciated.
Thanks in advance!
Top of my head, minimization of code is an area that no one touches upon in tutorials.
I feel like authentication, in general, is left completely out of most tutorials. It's hard and there are 1000 ways to do it, but it would be really handy to have some best practices start to bubble up through the beginner and intermediate tutorials.
There can be many things .. Mentioning few things which you can checklist for mission critical production ready applications.
There can be many things depending upon the type of application you are developing and the technologies involved.
I think scalability is one of those things.
You might argue that most tutorials actually _mention _it. Well, mentioning it and teaching it is two different things. During my years in web development (which is the last 12 years) I haven’t seen a tutorial that shows you how to make your code scale.
In a successful project in production you will probably soon reach a point where your visitors get too numerous so your application can’t handle it anymore. So you add one more node. And all of a sudden, you get a lot of errors.
Developers should learn about race conditions. Some of these can happen even on a single node, but when multiple nodes are involved, this becomes a real burden. Writing resources from multiple nodes may wreak havoc, and even though a lot of backends (DB, storage, whatever) provide some ways of locking, a lot of developers don’t deal with the locking errors, because they are not taught about it.
Aaron Cooper
UK Software Engineer in Singapore
The importance of keeping your secret keys secret. Perhaps not always relevant depending on the type of app, but often you'll have database connection credentials or simply some private data required by your backend services that you really don't want exposed in your checked-in source code.
Environment variables are a good solution: not only do they only get exposed within the environment they're in (e.g. your server/VM instance) but won't explicitly sit in your code. You're then free to refer to your environment variables in your code to be used at runtime. In Node this is simply done via: process.env.VAR_NAME.
It also then makes it easy to have different credentials for different environments like your local development server, a staging/testing environment and your production environment.