Backend API Server Development with Node.js from Scratch to Production
A couple of years ago, having had a solid engineering background, over 10 years of C/C++ for *nix systems and 5 years for iOS Native, I needed to develop a business logic application for iOS and Android and a backend for it in 3 months only. I chose React Native for a mobile development, and Node.js for a backend, both on 2 main reasons:
- The same language, TypeScript (JavaScript), and the same set of tools and libraries for a client and a backend;
- The largest software development community, the JS community, leading to the largest and great set of tools and libraries.
“Learn Once, Write Everywhere” took me over.
It took me a while to learn what I know now, collecting the info bit by bit, often from multiple resources, to implement a single thing. Now, it is time to give back. This writing helps me and my team to summarize knowledges, to find issues and points for refactoring, and to onboard newcomers with no Node.js background.
I hope you will find it useful as well.
Contents
Part 1. Project initial setup: TypeScript + Node.js
Part 2. Express Routing with Open API 3.0 and Swagger UI/Editor
Part 3. Brushing up: Logger + Environment variables
Part 4. Node.js + Express + TypeScript: Unit Tests with Jest
Part 6. Authentication with JWT, JSON Web Token
Part 7. Internal Caching in Node.js
Part 8. External Caching in Node.js with Redis
Part 9. Docker, Docker Compose, Complete Intro
Stay tuned for the next parts…
You can use this guide as a tutorial if you are new to Node.js or just pick the parts you need. You might need to review Appendix A. Project Structure if you dive into a specific part right away to navigate in the project and code easily.
You can get the complete project sources from git https://github.com/losikov/api-example. Git commit history and tags are organized based on the parts.