NodeJS without NPM
Implementing a Web framework in NodeJS without using NPM

Principal Technical Consultant at GeekyAnts.
Bootstrapping our own Data Centre services.
I lead the development and management of innovative software products and frameworks at GeekyAnts, leveraging a wide range of technologies including OpenStack, Postgres, MySQL, GraphQL, Docker, Redis, API Gateway, Dapr, NodeJS, NextJS, and Laravel (PHP).
With over 9 years of hands-on experience, I specialize in agile software development, CI/CD implementation, security, scaling, design, architecture, and cloud infrastructure. My expertise extends to Metal as a Service (MaaS), Unattended OS Installation, OpenStack Cloud, Data Centre Automation & Management, and proficiency in utilizing tools like OpenNebula, Firecracker, FirecrackerContainerD, Qemu, and OpenVSwitch.
I guide and mentor a team of engineers, ensuring we meet our goals while fostering strong relationships with internal and external stakeholders. I contribute to various open-source projects on GitHub and share industry and technology insights on my blog at blog.faizahmed.in.
I hold an Engineer's Degree in Computer Science and Engineering from Raj Kumar Goel Engineering College and have multiple relevant certifications showcased on my LinkedIn skill badges.
This article lists things that we can achieve in NodeJS without using any NPM dependencies. You can find the repository on GitHub — faizahmedfarooqui/nodejs.
Let's review things that we could developing using only low-level NodeJS APIs;
RESTful API:
- A server to listen to HTTP/HTTPS requests (View Code)
- Deflate / GZIP Compression for HTTP/HTTPS created servers (View Code)
- RESTful API to CRUD and many more for users, tokens & checks (View Code)
- Router for request methods like GET, POST, PUT & DELETE (View Code)
- Handlers(ie. controllers) to handle requests & their methods (View Code)
- Model Base class (View Code)
Workers:
- A Worker to execute things in the background (View Code)
Logging:
- A logging logic that logs everything into a *.log file (View Code)
Compress & Decompress:
- A gzip compression logic which compresses older log file (View Code)
Debugging:
- Local debug environment for the developments in each file (View Code)
Serve Routes & Templates:
- A use of template logic & data interpolation (View Code)
Serve Static Assets:
- Logic to serve static assets to the web-app (View Code)
- Web routes handler for serving pages & static assets (View Code)
CLI Tool with Input Handlers & their Responders:
- The CLI tool that runs using node’s readline, events libraries & many more (View Code)
- CLI Events handlers (View Code)
- CLI Events responders (View Code)
Handling Error Crash:
- Server request are handled using try-catch block & now rather than app crash send 500 error response (View Code)
Debugger Mode:
- For detailed information, please use its official documentation from NodeJS.
- To run the app in debugger mode, use command
node inspect index-debug.js
Performance Hooks:
- Added PerformanceObserver Node Class to observe all the entries & log them out to the CLI (View Code)
- Added Performance Mark & Measure methods to measure all the marked performance steps (View Code)
- To see how it works, run the command
NODE_DEBUG=performance node index.jsin your terminal
Cluster:
- Added a new file with clusters, here forks are created by the count of the CPUs available (View Code)
- To see how it works, run the command
node index-cluster.jsin your terminal
Child Process:
- Using
lscommands into the.logsfolder from CLI commandslist logs(View Code)
Other NodeJS Modules:
- Use of Async Hooks module (View Code)
- Use of HTTP/2 module in Client & Server Logic (View Code)
- Use of NET module in Client & Server Logic (View Code)
- Use of REPL module (View Code)
- Use of TLS/SSL module in Client & Server Logic (View Code)
- Use of UDP module in Client & Server Logic (View Code)
- Use of VM module (View Code)
How to download & setup?
#
# You only need NodeJS (LTS) ie. >= 8.11.3
#
# Clone this repo using your terminal
git clone https://github.com/faizahmedfarooqui/nodejs.git;
# Go inside the repo
cd nodejs;
# Make a data directory into the root of the project
mkdir .data && cd .data;
# Create 3 more directories into the .data directory
mkdir users checks tokens;
# Go back to project's root
cd ..;
# Make a logs directory into the root of the project
mkdir .logs;
# Goto the https directory
cd https;
# Now run the command given also available
# in the file keyGeneration.txt
openssl req -newkey rsa:2048 -new -nodes -x509 \
-days 3650 -keyout key.pem -out cert.pem;
That's All!
# About Me 👨💻
I'm Faiz A. Farooqui. Software Engineer from Bengaluru, India. Find out more about me @ https://faizahmed.in






