{"id":16385200,"url":"https://github.com/faizahmedfarooqui/nodejs","last_synced_at":"2025-03-23T04:31:22.735Z","repository":{"id":113591844,"uuid":"139415715","full_name":"faizahmedfarooqui/nodejs","owner":"faizahmedfarooqui","description":"A Web \u0026 API app built using low-level NodeJS APIs (Implementing NodeJS without using NPM for web, api \u0026 cli)","archived":false,"fork":false,"pushed_at":"2020-09-14T06:38:30.000Z","size":124,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T17:40:20.555Z","etag":null,"topics":["api","boilerplate","cli","node-cli","node-cluster","node-deflate","node-gzip","node-http2","node-unifiedserver","nodejs","nodejs-boilerplate","web"],"latest_commit_sha":null,"homepage":"https://faizahmedfarooqui.github.io/nodejs/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faizahmedfarooqui.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-02T08:44:22.000Z","updated_at":"2025-02-12T16:04:32.000Z","dependencies_parsed_at":"2023-05-24T03:00:17.553Z","dependency_job_id":null,"html_url":"https://github.com/faizahmedfarooqui/nodejs","commit_stats":null,"previous_names":[],"tags_count":6,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizahmedfarooqui%2Fnodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizahmedfarooqui%2Fnodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizahmedfarooqui%2Fnodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizahmedfarooqui%2Fnodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faizahmedfarooqui","download_url":"https://codeload.github.com/faizahmedfarooqui/nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","boilerplate","cli","node-cli","node-cluster","node-deflate","node-gzip","node-http2","node-unifiedserver","nodejs","nodejs-boilerplate","web"],"created_at":"2024-10-11T04:13:57.765Z","updated_at":"2025-03-23T04:31:22.707Z","avatar_url":"https://github.com/faizahmedfarooqui.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Implementing NodeJS without using NPM\n\n## What is it?\n\nA boilerplate or a sample built in **NodeJS** without using **any NPM packages** covering all (or most) of the Node's API modules\n\n## What is needed?\n\nNodeJS (LTS) ie. \u003e= 8.11.3\n\n## How to download \u0026 setup?\n\n```sh\n# Clone this repo using your terminal\ngit clone https://github.com/faizahmedfarooqui/nodejs.git;\n\n# Go inside the repo\ncd nodejs;\n\n# Make a data directory into the root of the project\nmkdir .data \u0026\u0026 cd .data;\n\n# Create 3 more directories into the .data directory\nmkdir users checks tokens;\n\n# Go back to project's root \ncd ..;\n\n# Make a logs directory into the root of the project\nmkdir .logs;\n\n# Goto the https directory\ncd https;\n\n# Now run the command given in the file keyGeneration.txt\nopenssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem\n```\n\n## List of things, this repository contains:\n\n#### 1. RESTful API:\n* A server to listen to HTTP/HTTPS requests ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/server.js#L26-#L39))\n* Deflate / GZIP Compression for HTTP/HTTPS created servers ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/server.js#L151-#L179))\n* RESTful API to CRUD and many more for users, tokens \u0026 checks ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/handlers.js#L65-#124))\n* Router for request methods like GET, POST, PUT \u0026 DELETE ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/router.js))\n* Handlers(ie. controllers) to handle requests \u0026 their methods ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/handlers.js))\n* Model Base class ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/data.js))\n\n#### 2. Workers:\n* A Worker to execute things in background ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/workers.js))\n\n#### 3. Logging:\n* A logging logic that logs everything into a *.log file ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/logs.js))\n\n#### 4. Compress \u0026 Decompress:\n* A gzip compression logic which compresses older log file ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/logs.js#L69-#L110))\n\n#### 3. Debugging:\n* Local debug environment for the developments in each files ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/server.js#L15-#L16))\n\n#### 4. Web App to serve routes \u0026 templates:\n* A Web App with template logic \u0026 data interpolation ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/helpers.js#L116-#L182))\n\n#### 5. Web App to serve static assets:\n* Logic to serve static assets to the web-app ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/helpers.js#L184-#L199))\n* Web routes handler for serving pages \u0026 static assets ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/handlers.js#L28-#L63))\n\n#### 6. CLI Tool with Input handlers \u0026 their responders:\n* The CLI tool that runs using node's readline, events libraries \u0026 many more ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/cli.js))\n* CLI Events handlers ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/cli-handlers.js))\n* CLI Events responders ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/cli-responders.js))\n\n```sh\n---------------------------------------------------------------------------------------------------------------------------------------------------------\n                     CLI Manual\n---------------------------------------------------------------------------------------------------------------------------------------------------------\nexit                          Kill the CLI (and the rest of the application)\nman                           Show this help page\nhelp                          Alias of the \"man\" command\nstats                         Get statistics on the underlying operating system and resource utilization\nList users                    Show a list of all the registered (undeleted) users in the system\nMore user info --{userId}     Show details of a specified user\nList checks --up --down       Show a list of all the active checks in the system, including their state. The \"--up\" and \"--down flags are both optional.\"\nMore check info --{checkId}   Show details of a specified check\nList logs                     Show a list of all the log files available to be read (compressed only)\nMore log info --{fileName}    Show details of a specified log file\n```\n\n#### 7. Handling error crash:\n* Server request are handled using try-catch block \u0026 now rather than app crash send 500 error response ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/server.js#L88-#L99))\n\n#### 8. Debugger Mode:\n* For detailed information please use official NodeJS [Documentation](https://nodejs.org/api/debugger.html)\n* To run this app in debugger mode use command `node inspect index-debug.js`\n\n#### 9. Performance Hooks:\n* Added PerformanceObserver Node Class to observe all the entries \u0026 log them out to the CLI ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/https/controllers/api/tokens.js#L12-#L31))\n* Added Performance Mark \u0026 Measure methods to measure all the marked performance steps ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/https/controllers/api/tokens.js#L38-#L75))\n* To see how it works, run command `NODE_DEBUG=performance node index.js` in your terminal\n\n#### 10. Cluster:\n* Added a new file with clusters, here forks are created by the count of the cpus available ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/index-cluster.js))\n* To see how it works, run command `node index-cluster.js` in your terminal\n\n#### 11. Child Process:\n* Using `ls` commands into the `.logs` folder from CLI commands `list logs` ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/lib/cli-responders.js#L209-#L222))\n\n#### 12. Other NodeJS Modules:\n* Use of Async Hooks module ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/misc/async-hooks/index.js))\n* Use of HTTP/2 module in Client \u0026 Server Logic ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/misc/http2))\n* Use of NET module in Client \u0026 Server Logic ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/misc/net))\n* Use of REPL module ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/misc/repl/index.js))\n* Use of TLS/SSL module in Client \u0026 Server Logic ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/misc/tls))\n* Use of UDP module in Client \u0026 Server Logic ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/misc/udp))\n* Use of VM module ([View Code](https://github.com/faizahmedfarooqui/nodejs/blob/master/misc/vm/index.js))\n\n#### That's It!\n\n## How do I contribute?\n\nPlease read the [CONTRIBUTING.md](https://github.com/faizahmedfarooqui/nodejs/blob/master/CONTRIBUTING.md)\n\n## Issue Template?\n\n• [Bug Report](https://github.com/faizahmedfarooqui/nodejs/tree/master/.github/ISSUE_TEMPLATE/bug_report.md)\n\n• [Feature Request](https://github.com/faizahmedfarooqui/nodejs/tree/master/.github/ISSUE_TEMPLATE/feature_request.md)\n\n• [Custom Report](https://github.com/faizahmedfarooqui/nodejs/tree/master/.github/ISSUE_TEMPLATE/custom.md)\n\n## Code of Conduct\n\nPlease read the file [CODE_OF_CONDUCT.md](https://github.com/faizahmedfarooqui/nodejs/blob/master/CODE_OF_CONDUCT.md)\n\n## License\n\n[MIT License](https://github.com/faizahmedfarooqui/nodejs/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaizahmedfarooqui%2Fnodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaizahmedfarooqui%2Fnodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaizahmedfarooqui%2Fnodejs/lists"}