# "Web Dev Saga: Week 9 :– Backend Basics Unveiled: Node.js, Modules, and Working with Files"

### **Things I Learned This Week :-**

This week, I took my first steps into backend development with **Node.js**, learning how JavaScript can be used outside the browser to build server-side applications. Here’s what I covered:

* **Backend, Node.js, and NPM** – Explored the fundamentals of Node.js, understanding its event-driven, non-blocking architecture. Learned how to install and manage packages using **NPM (Node Package Manager)** to enhance functionality in Node.js applications. Want to dive deeper? Check out my [keynotes](https://codingdhairya7-webdev.hashnode.space/default-guide/backend-nodejs-and-npm).
    
* **CommonJS vs ECMAScript Modules** – Understood the differences between these two module systems, learning when to use **require** (CommonJS) and **import/export** (ES Modules). Explored module interoperability and best practices for organizing project dependencies. Curious to know more? Head over to my [keynotes](https://codingdhairya7-webdev.hashnode.space/default-guide/commonjs-vs-ecmascript-modules).
    
* **Working with Files: fs and path Modules** – Got hands-on experience with the **fs (File System)** and **path** modules, learning how to read, write, and manipulate files and directories. Explored synchronous and asynchronous file handling and best practices for working with paths efficiently. Want to see the practical implementations? Check out my [keynotes](https://codingdhairya7-webdev.hashnode.space/default-guide/working-with-files-fs-and-path-modules).
    

### Steps That I Did :-

This week, I took a deep dive into backend development with **Node.js**, exploring its core functionalities and working with modules. Here’s how I approached my learning:

* **Setting Up Node.js & Exploring NPM** – Installed Node.js and set up my development environment. Learned how to initialize a project using `npm init` and install dependencies using `npm install`. Explored how to manage packages efficiently and understand their role in backend development.
    
* **Understanding CommonJS vs ECMAScript Modules** – Worked with both **require** (CommonJS) and **import/export** (ES Modules) to understand their differences. Practiced writing modular code and explored how module resolution works in Node.js.
    
* **Working with the fs and path Modules** – Used the **fs module** to create, read, update, and delete files. Practiced handling asynchronous operations using callbacks and Promises. Explored the **path module** to manipulate file paths efficiently.
    

### Challenges I Faced and How I Overcame Them :-

* **Understanding Node.js and NPM** – Initially, setting up **Node.js** and understanding how **NPM** works was overwhelming, especially managing dependencies efficiently. I overcame this by exploring the official documentation and experimenting with different package installations, updates, and removals to get hands-on experience.
    
* **CommonJS vs ECMAScript Modules Confusion** – Switching between **require** (CommonJS) and **import/export** (ES Modules) was tricky, especially when dealing with module compatibility issues. To tackle this, I practiced writing both types of modules and understood when to use each.
    
* **Working with Files in Node.js** – Using the **fs module** for reading and writing files asynchronously was confusing at first, especially handling callbacks and Promises properly. I resolved this by breaking down each function, practicing different file operations, and experimenting with both synchronous and asynchronous approaches to see the differences in execution.
    

### Resources I Used :-

* Videos :- [**Sigma Web Development Course By CodeWithHarry**](https://youtube.com/playlist?list=PLu0W_9lII9agq5TrH9XLIKQvv0iaF2X3w&si=7d_R9TB8oL8fRFnK)
    
* Documentation :- [Node.js Learn](https://nodejs.org/en/learn/getting-started/introduction-to-nodejs)
    

### Conclusion :-

This week was a thrilling deep dive into the backend side of web development. Exploring **Node.js**, **NPM**, and **file system modules** opened up a whole new perspective on how JavaScript powers server-side applications. From managing dependencies with **NPM** to working with files using the **fs** and **path** modules, every topic helped me build a stronger foundation for backend development.

While the transition from frontend to backend had its challenges, overcoming them gave me a clearer understanding of how servers interact with files, modules, and dependencies. Each concept I learned this week is a stepping stone toward mastering full-stack development.

Excited for what’s next as I continue this journey into the world of backend technologies! 🚀💡
