A Beyond-the-Basics Guide
Samer Buna

#Node_js
#JavaScript
🚀 وقتش رسیده که با نود جی اس مهارتهای وب دولوپمنت خودتون رو از مرورگر به سرور بیارید؛ همون فریمورک بکاند معروفی که بیشتر از ۱۰ میلیون دولوپر توی شرکتهایی مثل آمازون، نتفلیکس و لینکدین دارن ازش استفاده میکنن. اگه با جاوااسکریپت راحت هستید، این راهنمای کاربردی از سامر بونا بهتون نشون میده چطور پیچیدهترین اپلیکیشنهای نود جی اس رو به شکل موثری بسازید و نگهداری کنید.
💻 با دنبال کردن یک مسیر پروژهمحور و عملی، از مفاهیم پایهای و کلیدی به سمت مباحث پیشرفتهای مثل ماژولها، پکیجها، معماری رویدادمحور، استریمها، چایلد پروسسها، اسکیل کردن، تست و دیپلویمنت حرکت میکنید؛ اونم در حالی که تمرکز اصلی روی چیزهایی هست که واقعاً در عمل به کارتون میاد.
⚙️ قابلیتهای نیتیو نود جی اس رو درک کنید تا بتونید بهترین استفاده را از کتابخانهها و ابزارهای قدرتمند اکوسیستمش ببرید.
📦 از ماژولها و پکیجهای نود جی اس استفاده کنید.
🔄 معماری رویدادمحور، استریمها و چایلد پروسسهای نود جی اس رو عمیقاً بررسی کنید.
🧱 اپلیکیشنهای کارآمد و اسکیلپذیر نود جی اس بسازید، تست کنید و توسعه بدید.
👥 چه کسانی باید این کتاب را بخوانند
🎯 این کتاب تلاش منه برای اینکه به شما کمک کنم Node.js رو به شکل بهینهای یاد بگیرید. کتاب به طور طبیعی یه سری به مفاهیم JavaScript میزنه، اما به طور کلی، برای اینکه بیشترین بازدهی رو ازش بگیرید، باید درک پایهای و خوبی از زبان JavaScript داشته باشید.
⚠️ اگه با Objectها، Functionها، Operatorها و Iteratorهای جاوااسکریپت راحت نیستید، بهتره قبل از شروع این کتاب، یه کتاب مقدماتی درباره JavaScript بخونید.
💡 این همون کتابیه که وقتی خودم شروع به یادگیری Node.js کردم، آرزو داشتم وجود داشته باشه. اون زمان تمرکز اصلی من روی Frontend بود. طبیعتاً این کتاب برای یک Frontend developer که میخواد تجربهاش رو به Backend توسعه بده، گزینهی خیلی مناسبیه.
✍️ چرا این کتاب را نوشتم
🔍 وقتی صحبت از یادگیری Node.js میشه، خیلی از توتوریالها، کتابها و دورهها بیشتر روی کتابخانهها و ابزارهای موجود در اکوسیستم Node.js تمرکز میکنن تا خود محیط runtime نود جی اس. اونا آموزش نحوه استفاده از فریمورکها و کتابخانههای معروف Node.js رو اولویت قرار میدن، به جای اینکه از قابلیتهای native خود نود جی اس شروع کنن.
🛠️ این رویکرد قابل درکه چون Node.js یک محیط runtime سطح پایین (Low-level) بهحساب میاد. نود جی اس راهحلهای جامع و آماده ارائه نمیده، بلکه مجموعهای از ماژولهای حیاتی و کوچک رو در اختیارتون میذاره که ساختن راهحلها رو راحتتر و سریعتر میکنه. مثلاً یک وبسرور کامل، قابلیتهایی مثل سرو کردن فایلهای static (مثل تصاویر، فایلهای CSS و غیره) رو داره. شما با ماژول داخلی http در نود جی اس میتونید وبسروری بسازید که دیتای binary رو سرو میکنه و با ماژول داخلی fs میتونید محتوای یک فایل رو از filesystem بخونید. حالا میتونید این دوتا قابلیت رو با کد JavaScript خودتون ترکیب کنید تا فایلهای static رو سرو کنید. هیچ راه داخلی و native در نود جی اس برای سرو کردن فایلهای static زیر مجموعهی یک وبسرور وجود ندارد.
🌐 کتابخانههای معروف Node.js که جزوی از خود نود جی اس نیستند (مثل Express.js، Next.js و خیلیهای دیگه که پسوند js. دارن) هدفشون اینه که راهحلهای تقریباً کاملی رو در دامینهای خاص ارائه بدن. مثلاً Express.js تخصصش در ساخت و اجرای وبسروره (و البته سرو کردن فایلهای static، و کلی قابلیت جذاب دیگه). در واقعیت، بیشتر دولوپرها از Node.js به تنهایی استفاده نمیکنن، بنابراین منطقیه که متریالهای آموزشی روی کتابخانههایی تمرکز کنن که راهحلهای جامع میدن تا کارآموزها بتونن سریعتر برن سراغ بخشهای جذاب کار. تفکر رایج اینه که فقط دولوپرهایی که شغلشون نوشتن این کتابخانههاست نیاز دارن لایه زیرین و پایهای Node.js رو درک کنن.
🧠 اما استدلال من اینه که داشتن یک درک قوی از قدرت داخلی و native نود جی اس، قبل از استفاده از هر کتابخانه و ابزار خارجی، کاملاً ضروریه. داشتن درک عمیق از Node.js به دولوپرها اجازه میده موقع انتخاب کتابخانهها و نحوه استفاده موثر از اونا، تصمیمهای آگاهانهای بگیرن. این کتاب تلاش منه تا اولویت رو روی یادگیری قابلیتهای native نود جی اس بذارم و بعد از اون دانش برای استفاده بهینه از کتابخانهها و ابزارهای قدرتمند اکوسیستمش استفاده کنیم.
📑 فهرست مطالب
فصل ۱. مبانی نود
فصل ۲. اسکریپتها و ماژولها
فصل ۳. اسینکرونوس و رویدادها
فصل ۴. خطاها و دیباگ کردن
فصل ۵. مدیریت پکیجها
فصل ۶. استریمها
فصل ۷. چایلد پروسسها
فصل ۸. تست کردن نود
فصل ۹. اسکیل کردن نود
فصل ۱۰. نود کاربردی
👨💻 درباره نویسنده
سامر بونا بیش از ۲۰ سال تجربه در توسعه نرمافزار، طراحی API، مدیریت دیتابیس و اسکیلپذیری داره. سامر نویسنده چندین کتاب فنی و دورههای آنلاین درباره JavaScript، Node.js، React.js و موارد دیگهست. سامر عاشق هر چیزیه که به JavaScript ربط داره و از بررسی کتابخانههای جدید لذت میبره. تکاستک محبوب اون PostgreSQL، GraphQL، Node و React هست.
Take your web development skills from browser to server with Node.js, the popular backend framework used by more than 10 million developers at companies like Amazon, Netflix, and LinkedIn, to name just a few. If you're comfortable working with JavaScript, this practical guide from Samer Buna will show you how to effectively build and maintain even the most complex Node.js applications.
Following a hands-on, project-based approach, you'll move from key fundamentals to advanced concepts such as modules, packages, event-driven architecture, streams, child processes, scaling, testing, deployment, and much more—all while focusing on what actually matters in practice.
Who Should Read This Book
This book is my attempt at helping you learn Node.js efficiently. It naturally dips into a few JavaScript concepts, but in general, you need a good basic understanding of the JavaScript language to get the most value out of this book.
If you’re not comfortable working with JavaScript objects, functions, operators, and iterators, reading an introductory book about JavaScript before this book would help.
This is the book that I wished existed when I started learning Node.js. At that time, I was mainly focusing on the frontend. Naturally, this book is a good fit for a frontend developer wanting to expand their experience to the backend.
Why I Wrote This Book
When it comes to learning Node.js, many tutorials, books, and courses tend to focus on the libraries and tools available within the Node.js ecosystem, rather than the Node.js runtime environment itself. They prioritize teaching how to utilize popular Node.js libraries and frameworks, instead of starting from the native capabilities of Node.js.
This approach is understandable because Node.js is a low-level runtime environment. It does not offer comprehensive solutions but rather a collection of small essential modules that makes creating solutions easier and faster. For example, a full-fledged web server will have options like serving static files (like images, CSS files, etc.). With the Node.js built-in http module, you can build a web server that serves binary data, and with the Node.js built-in fs module, you can read the content of a file from the filesystem. You can combine both of these features to serve static assets by using your own JavaScript code. There’s no built-in Node.js way to serve static assets under a web server.
Popular Node.js libraries that are not part of Node.js itself (such as Express.js, Next.js, and many others with .js in their names) aim to provide nearly complete solutions within specific domains. For example, Express.js specializes in creating and running a web server (and serving static assets, and many other neat features). Practically, most developers will not be using Node.js on its own, so it makes sense for educational materials to focus on the libraries offering comprehensive solutions, so learners can skip to the good parts. The common thinking here is that only developers whose job is to write these libraries need to understand the underlying base layer of Node.js.
However, I would argue that a solid understanding of the built-in power of Node.js is essential before utilizing any of its external libraries and tools. Having a deep understanding of Node.js allows developers to make informed decisions when choosing which libraries to use and how to use them effectively. This book is my attempt to prioritize first learning the native capabilities of Node.js and then using that knowledge to efficiently utilize the powerful libraries and tools in its ecosystem.
Table of Contents
Chapter 1. Node Fundamentals
Chapter 2. Scripts and Modules
Chapter 3. Asynchrony and Events
Chapter 4. Errors and Debugging
Chapter 5. Package Management
Chapter 6. Streams
Chapter 7. Child Processes
Chapter 8. Testing Node
Chapter 9. Scaling Node
Chapter 10. Practical Node
Samer Buna has over 20 years of experience in software development, API design, database management, and scalability. Samer has authored several technical books and online courses about JavaScript, Node.js, React.js and more. Samer is passionate about everything JavaScript, and he loves exploring new libraries. His favorite technical stack is PostgreSQL, GraphQL, Node, and React.









