<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Farhan Shahriar</title>
    <description>The latest articles on DEV Community by Farhan Shahriar (@farhan_shahriar_).</description>
    <link>https://dev.to/farhan_shahriar_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2675707%2F4be0e4a7-8ef6-4df6-8f56-36f18ee34b16.png</url>
      <title>DEV Community: Farhan Shahriar</title>
      <link>https://dev.to/farhan_shahriar_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/farhan_shahriar_"/>
    <language>en</language>
    <item>
      <title>⚡ Boosting API Performance: 5 Practical Techniques Every Developer Should Know</title>
      <dc:creator>Farhan Shahriar</dc:creator>
      <pubDate>Thu, 07 Aug 2025 17:37:03 +0000</pubDate>
      <link>https://dev.to/farhan_shahriar_/boosting-api-performance-5-practical-techniques-every-developer-should-know-98h</link>
      <guid>https://dev.to/farhan_shahriar_/boosting-api-performance-5-practical-techniques-every-developer-should-know-98h</guid>
      <description>&lt;p&gt;When it comes to building &lt;strong&gt;scalable, high-performance APIs&lt;/strong&gt;, the devil is in the details. We often focus on functionality and endpoints—but &lt;strong&gt;performance&lt;/strong&gt;? That’s what keeps users happy and systems healthy.&lt;/p&gt;

&lt;p&gt;In this article, we’ll walk through &lt;strong&gt;five essential techniques&lt;/strong&gt; to optimize your API for speed, efficiency, and a better user experience. These aren't theoretical ideas—each method is practical, proven, and ready to implement in real-world scenarios.&lt;/p&gt;

&lt;p&gt;Let’s dive in. ⚙️&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 1. Pagination: Serve Data in Bite-Sized Chunks
&lt;/h2&gt;

&lt;p&gt;Large datasets can overwhelm both your server and your users. That’s where &lt;strong&gt;pagination&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;Instead of dumping thousands of records in one go, pagination breaks that data into manageable pages—like splitting a massive novel into chapters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxm3545b5c769ansk1av3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxm3545b5c769ansk1av3.png" alt=" " width="600" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why it matters:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduces memory usage on the server&lt;/li&gt;
&lt;li&gt;Improves response time for the client&lt;/li&gt;
&lt;li&gt;Keeps interfaces snappy and interactive&lt;/li&gt;
&lt;li&gt;Helps maintain stability under heavy load&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;📌 Perfect for product listings, user feeds, search results, etc.&lt;/p&gt;




&lt;h2&gt;
  
  
  📝 2. Synchronous Logging: Smarter Logging, Fewer Delays
&lt;/h2&gt;

&lt;p&gt;Every log write is an I/O operation—and doing it after every event can slow things down &lt;em&gt;a lot&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Synchronous logging&lt;/strong&gt; changes the game by batching logs in memory before writing them to disk. It’s like saving up your receipts and filing them all at once.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8hmjp84koknytsm6ayj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8hmjp84koknytsm6ayj.png" alt=" " width="636" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why it matters:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduces disk write frequency&lt;/li&gt;
&lt;li&gt;Minimizes I/O delays&lt;/li&gt;
&lt;li&gt;Frees up CPU for real-time request handling&lt;/li&gt;
&lt;li&gt;Ensures logs are still safely persisted&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧠 A great balance between performance and reliability.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚡ 3. Caching: Stop Repeating Yourself (and Your Database)
&lt;/h2&gt;

&lt;p&gt;Why hit your database for the same data over and over?&lt;/p&gt;

&lt;p&gt;With tools like &lt;strong&gt;Redis&lt;/strong&gt;, you can cache frequently requested data in-memory—returning lightning-fast responses without touching your backend DB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn69zzfeytpri5b7fl6gd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn69zzfeytpri5b7fl6gd.png" alt=" " width="624" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why it matters:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Massive drop in DB read operations&lt;/li&gt;
&lt;li&gt;Significantly lower latency&lt;/li&gt;
&lt;li&gt;Higher throughput for read-heavy workloads&lt;/li&gt;
&lt;li&gt;Scales effortlessly for high-traffic apps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🎯 Ideal for user profiles, product data, config settings, etc.&lt;/p&gt;




&lt;h2&gt;
  
  
  📦 4. Payload Compression: Shrink Your Data, Speed Up Delivery
&lt;/h2&gt;

&lt;p&gt;APIs often serve large JSON or XML payloads—but not all clients have fast internet. That’s where &lt;strong&gt;gzip compression&lt;/strong&gt; shines.&lt;/p&gt;

&lt;p&gt;By compressing your API responses, you reduce data size and improve transfer speed—especially noticeable on mobile or slow connections.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqz0kk0mqio45f3g4btmg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqz0kk0mqio45f3g4btmg.png" alt=" " width="636" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why it matters:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduces bandwidth usage&lt;/li&gt;
&lt;li&gt;Speeds up uploads and downloads&lt;/li&gt;
&lt;li&gt;Enhances performance for end users&lt;/li&gt;
&lt;li&gt;Especially helpful with verbose APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🛠️ Enable gzip in your web server or backend framework config.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔄 5. Connection Pooling: Keep Your DB Connections Warm
&lt;/h2&gt;

&lt;p&gt;Opening a new database connection per request? That’s like calling the restaurant every time you want another bite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connection pooling&lt;/strong&gt; maintains a pool of reusable connections—eliminating the cost of open/close cycles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6yx1vvvfqtwpqo7eg9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6yx1vvvfqtwpqo7eg9p.png" alt=" " width="528" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why it matters:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduces latency for DB queries&lt;/li&gt;
&lt;li&gt;Prevents bottlenecks under high concurrency&lt;/li&gt;
&lt;li&gt;Saves server resources&lt;/li&gt;
&lt;li&gt;Boosts overall performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔥 Most ORMs and frameworks support pooling—just configure it properly.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Stack These Techniques for Maximum API Performance
&lt;/h2&gt;

&lt;p&gt;Each technique offers a boost—but together? That’s where real performance lives:&lt;/p&gt;

&lt;p&gt;✅ Pagination, caching, and compression reduce data and network load&lt;br&gt;&lt;br&gt;
✅ Logging and connection pooling optimize resource use&lt;br&gt;&lt;br&gt;
✅ Combined, they create &lt;strong&gt;scalable, reliable, and fast&lt;/strong&gt; APIs&lt;/p&gt;

&lt;p&gt;These aren’t “nice-to-haves.” They’re &lt;strong&gt;essentials&lt;/strong&gt; in any modern developer’s performance toolkit.&lt;/p&gt;




&lt;p&gt;Have you used any of these techniques? What’s made the biggest difference in your APIs?&lt;/p&gt;

&lt;p&gt;💬 Drop your experiences or questions in the comments below!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>api</category>
      <category>backend</category>
    </item>
    <item>
      <title>Introduction to Backend Development-Part 1</title>
      <dc:creator>Farhan Shahriar</dc:creator>
      <pubDate>Fri, 18 Jul 2025 15:34:21 +0000</pubDate>
      <link>https://dev.to/farhan_shahriar_/introduction-to-backend-development-part-1-big</link>
      <guid>https://dev.to/farhan_shahriar_/introduction-to-backend-development-part-1-big</guid>
      <description>&lt;p&gt;Before diving into backend development, it’s essential to understand where to start—and more importantly, how far to go. The “end” isn’t clearly defined. Your goal should be reaching a level where you’re comfortable continuing learning independently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend Developer Responsibilities&lt;/strong&gt;&lt;br&gt;
Roles vary significantly depending on company size:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Startup / Solo Product:&lt;/em&gt; You build the entire stack—frontend, backend, database, API, architecture, cloud, security, and documentation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Small team (5–6 people):&lt;/em&gt; You still handle many responsibilities, though some tasks are shared.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Established startup:&lt;/em&gt; You likely specialize in backend or system design without cloud or infra work.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Enterprise:&lt;/em&gt; Roles become highly specialized—e.g., API design, test coding, documentation or architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning Roadmap Overview&lt;/strong&gt;&lt;br&gt;
The following progression targets foundational backend skills suitable for most early-career developers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. API Design&lt;/strong&gt;&lt;br&gt;
Design how data flows between client and server:&lt;/p&gt;

&lt;p&gt;REST API – Dominant pattern, easy to get started&lt;/p&gt;

&lt;p&gt;GraphQL – Flexible queries and reduced over-fetching&lt;/p&gt;

&lt;p&gt;gRPC – High-performance communication (usually microservices)&lt;/p&gt;

&lt;p&gt;SOAP – Mostly obsolete; only relevant if you're working with legacy systems&lt;/p&gt;

&lt;p&gt;Real-time communication via WebSockets, though resource-intensive to scale. Avoid message brokers (RabbitMQ, Kafka) at the beginner stage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. API Security&lt;/strong&gt;&lt;br&gt;
Fundamental authentication/authorization elements:&lt;/p&gt;

&lt;p&gt;JWT Token – JSON Web Tokens for stateless auth&lt;/p&gt;

&lt;p&gt;Refresh Token – Used for secure long-lived sessions&lt;/p&gt;

&lt;p&gt;OAuth2 – Allows login via third-party identities (Gmail, Facebook, GitHub)&lt;/p&gt;

&lt;p&gt;Advanced topics like SAML, Auth0, Firebase Auth, or Cognito are optional at this stage.&lt;br&gt;
Focus next on Role‑Based Authorization: controlling access by user role (e.g. admin vs. moderator vs. member).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. API Testing &amp;amp; Documentation&lt;/strong&gt;&lt;br&gt;
Ensure your API works—and stays documented:&lt;/p&gt;

&lt;p&gt;Unit Testing – Test individual components&lt;/p&gt;

&lt;p&gt;Acceptance Testing / Integration Tests – Test end-to-end behavior&lt;/p&gt;

&lt;p&gt;Load Testing – Ensure performance under strain&lt;/p&gt;

&lt;p&gt;For documentation:&lt;/p&gt;

&lt;p&gt;Swagger – Automatically generate API docs&lt;/p&gt;

&lt;p&gt;Postman – Ideal for building, documenting and sharing API specs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Databases &amp;amp; Caching&lt;/strong&gt;&lt;br&gt;
Basic usage, not admin-level mastery:&lt;/p&gt;

&lt;p&gt;Databases&lt;/p&gt;

&lt;p&gt;NoSQL: MongoDB, AWS DynamoDB&lt;/p&gt;

&lt;p&gt;SQL: PostgreSQL, MySQL, MSSQL, Oracle&lt;/p&gt;

&lt;p&gt;In-Memory Storage / Caching&lt;/p&gt;

&lt;p&gt;Redis (multi-use, highly recommended)&lt;/p&gt;

&lt;p&gt;Memcached (caching-only use case)&lt;/p&gt;

&lt;p&gt;Graph databases (e.g. Neo4j) are powerful, but only needed for advanced ML/graph-based use cases—not essential for beginners.&lt;/p&gt;

&lt;p&gt;Designing Systems by Requirement&lt;br&gt;
Learning concept names is easy—but interpreting business requirements to select the right architecture is the hardest skill. You'll need to analyze non-technical requirements and map them to technical choices, such as choosing REST vs. GraphQL or deciding when to cache with Redis.&lt;/p&gt;

&lt;p&gt;Server &amp;amp; API Implementation Workflow&lt;br&gt;
Fundamentally, your server must:&lt;/p&gt;

&lt;p&gt;Listen for incoming requests&lt;/p&gt;

&lt;p&gt;Process the request—including accessing business logic, data structures, algorithms, or database&lt;/p&gt;

&lt;p&gt;Respond to the client&lt;/p&gt;

&lt;p&gt;Example: Raw Node.js HTTP Server (server.js)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const http = require('http');

const server = http.createServer((req, res) =&amp;gt; {
  if (req.url === '/') {
    res.statusCode = 200;
    res.end('&amp;lt;h1&amp;gt;Hello World&amp;lt;/h1&amp;gt;');
  } else if (req.url === '/hello') {
    res.statusCode = 200;
    res.end('&amp;lt;h1&amp;gt;Hello Guest&amp;lt;/h1&amp;gt;');
  } else {
    res.statusCode = 404;
    res.end('&amp;lt;h1&amp;gt;404 Not Found&amp;lt;/h1&amp;gt;');
  }
});

server.listen(8000, () =&amp;gt; {
  console.log('Server is listening on port 8000');
});`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This implements the request-listen → process → response flow manually—useful to understand how frameworks simplify this pattern.&lt;/p&gt;

&lt;p&gt;Example: Express.js Server&lt;br&gt;
Using Express removes boilerplate and adds routing, middleware, and JSON parsing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const app = express();

app.use(express.json());

const books = [
  // array of { id, name, price }
];

app.get('/books', (req, res) =&amp;gt; {
  const { show, price } = req.query;
  if (show === 'all') return res.json(books);

  if (price === '500') return res.json(books.filter(b =&amp;gt; b.price &amp;lt;= 500));
  if (price === '1000') return res.json(books.filter(b =&amp;gt; b.price &amp;lt;= 1000));

  return res.json(books);
});

app.post('/books', (req, res) =&amp;gt; {
  books.push(req.body);
  res.json(books);
});

app.listen(8000, () =&amp;gt; {
  console.log('Server is listening on port 8000');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample routes:&lt;/p&gt;

&lt;p&gt;/books – list all books&lt;/p&gt;

&lt;p&gt;/books?show=all&lt;/p&gt;

&lt;p&gt;/books?price=500 or price=1000&lt;/p&gt;

&lt;p&gt;Adding new books via POST /books&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend Request Lifecycle Pipeline&lt;/strong&gt;&lt;br&gt;
A modern backend typically follows this flow:&lt;/p&gt;

&lt;p&gt;Incoming Request&lt;br&gt;
  ↓&lt;br&gt;
Middleware: logger, body parser, file parser, auth, validation&lt;br&gt;
  ↓&lt;br&gt;
Controller: business logic&lt;br&gt;
  ↓&lt;br&gt;
Middleware: error handler&lt;br&gt;
  ↓&lt;br&gt;
Response to client&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning Path Summary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Learn API design (REST + GraphQL/gRPC concepts)&lt;/p&gt;

&lt;p&gt;Master API security (JWT, refresh tokens, role-based access)&lt;/p&gt;

&lt;p&gt;Set up testing and documentation (unit tests, Postman, Swagger)&lt;/p&gt;

&lt;p&gt;Choose and query databases; implement caching (Redis)&lt;/p&gt;

&lt;p&gt;Build projects from scratch in Node.js / Express to understand underlying processes&lt;/p&gt;

&lt;p&gt;Evolve toward system design skills: analyzing requirements and choosing the right architecture&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Although backend touches many concepts—databases, security, APIs, infrastructure—the central challenge is system design based on requirements. Everything else—frameworks, caching tools, database engines—becomes easier once you master understanding and mapping business needs.&lt;/p&gt;

&lt;p&gt;Build simple projects: start with raw Node.js, upgrade to Express with CRUD APIs, layer in tests and documentation, then explore security and caching. From there, real-world requirements will shape your deeper learning path.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backenddevelopment</category>
      <category>backend</category>
      <category>web</category>
    </item>
    <item>
      <title>🏗️ Designing a Project File Structure: Practical Guide Inspired by Clean Code Architecture</title>
      <dc:creator>Farhan Shahriar</dc:creator>
      <pubDate>Fri, 11 Jul 2025 18:15:42 +0000</pubDate>
      <link>https://dev.to/farhan_shahriar_/designing-a-project-file-structure-practical-guide-inspired-by-clean-code-architecture-53de</link>
      <guid>https://dev.to/farhan_shahriar_/designing-a-project-file-structure-practical-guide-inspired-by-clean-code-architecture-53de</guid>
      <description>&lt;p&gt;Designing a good file structure for your project is one of the trickiest yet most critical tasks. A well-thought-out structure keeps your project maintainable and helps you avoid constant refactoring headaches as the application grows.&lt;/p&gt;

&lt;p&gt;There’s a design principle that guides us here, known as Clean Code Architecture. Though this is an advanced concept that we'll explore in detail later, it offers powerful insights into how and why to organize your code.&lt;/p&gt;

&lt;p&gt;Right now, we’re building a Monolithic application. This means everything lives in a single deployable unit, rather than splitting into microservices. Monolithic architecture is often structured following what’s formally called Layered Architecture, but most developers simply know it as monolithic.&lt;/p&gt;

&lt;p&gt;Let’s walk through the practical steps to structure your project so it stays clean, understandable, and scalable—even before fully adopting Clean Architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🗂 Recommended Project Folders &amp;amp; Why They Matter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s a practical breakdown of folders and files you should create, along with why each exists:&lt;/p&gt;

&lt;p&gt;app/&lt;br&gt;
Holds core application logic like custom errors, database connection code, the main app file, and global routes.&lt;br&gt;
Note: This folder is separate from your server.js file.&lt;/p&gt;

&lt;p&gt;routes/&lt;br&gt;
Contains all your route definitions. Helps keep your HTTP layer organized and modular.&lt;/p&gt;

&lt;p&gt;models/&lt;br&gt;
Where you define data models (e.g., using Mongoose, Sequelize, etc.) that map to your database.&lt;/p&gt;

&lt;p&gt;controller/&lt;br&gt;
Each route typically has an associated controller function. This folder stores all controllers to keep your business logic separate from route definitions.&lt;/p&gt;

&lt;p&gt;service/&lt;br&gt;
We never want controllers to talk directly to the database. Instead, services handle database interactions or external API calls.&lt;br&gt;
This cleanly separates business logic from database logic, making your code easier to test and change.&lt;/p&gt;

&lt;p&gt;middleware/&lt;br&gt;
Custom middleware functions live here. Examples: authentication checks, logging middleware, request validation, etc.&lt;/p&gt;

&lt;p&gt;util/&lt;br&gt;
Utility functions or helper scripts that don’t fit elsewhere.&lt;/p&gt;

&lt;p&gt;db/&lt;br&gt;
Contains scripts or configurations related specifically to database setup or migrations.&lt;/p&gt;

&lt;p&gt;config/&lt;br&gt;
Holds configuration files—for example, environment-specific settings, third-party service configs, etc.&lt;/p&gt;

&lt;p&gt;log/&lt;br&gt;
Store application logs here (especially if you use tools like Winston or Morgan).&lt;/p&gt;

&lt;p&gt;error/&lt;br&gt;
All your custom error classes or handlers live here, making error management consistent.&lt;/p&gt;

&lt;p&gt;test/&lt;br&gt;
Write your automated tests here—unit, integration, or end-to-end.&lt;/p&gt;

&lt;p&gt;server.js&lt;br&gt;
Your application's entry point. Sets up and starts the HTTP server.&lt;/p&gt;

&lt;p&gt;.env &amp;amp; default.env&lt;br&gt;
Store secrets, API keys, and environment-specific variables that should never be committed to source control.&lt;/p&gt;

&lt;p&gt;Inside the app/ folder, you’ll often create an app.js file which sets up the Express app instance, applies middleware, and mounts your routes.&lt;br&gt;
&lt;strong&gt;✅ Why this structure helps&lt;/strong&gt;&lt;br&gt;
Keeps concerns separated (routing, business logic, database logic, configs, etc.)&lt;/p&gt;

&lt;p&gt;Makes it easy for new developers to find what they’re looking for.&lt;/p&gt;

&lt;p&gt;Encourages writing testable, maintainable code.&lt;/p&gt;

&lt;p&gt;Supports gradual migration to clean architecture principles (like Use Cases and Domain layers) if your project grows.&lt;/p&gt;

&lt;p&gt;🧪 Going further: When you're ready for Clean Architecture&lt;br&gt;
Clean Architecture takes these principles to the next level:&lt;/p&gt;

&lt;p&gt;Defines domain, application, infrastructure, and presentation layers.&lt;/p&gt;

&lt;p&gt;Enforces dependency inversion so core business logic doesn’t depend on frameworks or databases.&lt;/p&gt;

&lt;p&gt;Makes your system highly testable and flexible.&lt;/p&gt;

&lt;p&gt;But don't rush—start simple, then refactor gradually as complexity grows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✍️ Final Thoughts&lt;/strong&gt;&lt;br&gt;
A clear, intentional file structure isn’t just about neat folders—it’s a foundation for scaling your project, onboarding team members, and keeping bugs away.&lt;/p&gt;

&lt;p&gt;By following this practical approach inspired by clean architecture, you’ll save countless hours and future-proof your codebase—even if you’re building a monolithic application today.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>backend</category>
      <category>backenddevelopment</category>
    </item>
    <item>
      <title>🖥️ How Code Runs: A Beginner’s Guide to What Happens When You Press “Run”</title>
      <dc:creator>Farhan Shahriar</dc:creator>
      <pubDate>Sat, 05 Jul 2025 11:09:51 +0000</pubDate>
      <link>https://dev.to/farhan_shahriar_/how-code-runs-a-beginners-guide-to-what-happens-when-you-press-run-107j</link>
      <guid>https://dev.to/farhan_shahriar_/how-code-runs-a-beginners-guide-to-what-happens-when-you-press-run-107j</guid>
      <description>&lt;p&gt;When I first started learning to code, I wondered: How does my computer know what to do when I write some text and click “Run”?&lt;/p&gt;

&lt;p&gt;In this first lesson, I’ll share what I learned — and trust me, understanding this makes you appreciate programming so much more!&lt;/p&gt;

&lt;p&gt;📹 Let’s Compare It To Something You Know&lt;/p&gt;

&lt;p&gt;Imagine you want to watch a video on your computer. You need video player software — like VLC or Windows Media Player.Or, you want to play a game — you first install the game on your machine.&lt;/p&gt;

&lt;p&gt;Running code is very similar.&lt;/p&gt;

&lt;p&gt;When you write code, your computer needs a special program that knows how to understand and execute it.For example:&lt;/p&gt;

&lt;p&gt;To run C++, you need a compiler like GCC.&lt;/p&gt;

&lt;p&gt;To run Java, you need the Java Development Kit (JDK) installed.&lt;/p&gt;

&lt;p&gt;If you run your code online, you use an online IDE (like Replit or CodeSandbox). Your code runs on another computer (a server) somewhere in the world. Still, it always needs a machine to run.&lt;/p&gt;

&lt;p&gt;✅ What Happens When You Run Code?&lt;/p&gt;

&lt;p&gt;Let’s take a simple C++ example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
using namespace std;

int main() {
  // Your code goes here
  cout &amp;lt;&amp;lt; "Hi...";
  return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you hit Run, your computer does this in two main steps:&lt;/p&gt;

&lt;p&gt;1️⃣ Compilation Phase&lt;/p&gt;

&lt;p&gt;It checks your code line by line.&lt;/p&gt;

&lt;p&gt;It finds any errors — like typos or wrong syntax.&lt;/p&gt;

&lt;p&gt;2️⃣ Execution Phase&lt;/p&gt;

&lt;p&gt;It looks for the entry point — in C++ that’s int main().&lt;/p&gt;

&lt;p&gt;Then, it starts running your instructions step by step.&lt;/p&gt;

&lt;p&gt;Here’s a quick Java example too:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.*;
import java.lang.*;
import java.io.*;

class FirstCode {
  public static void main(String[] args) throws java.lang.Exception {
    // Your code goes here
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, Java finds the main method and starts executing your logic from there.&lt;/p&gt;

&lt;p&gt;🤯 So Much Happens Behind the Scenes!&lt;/p&gt;

&lt;p&gt;Behind that Run button, there are thousands of lines of code written by other developers — the compiler, the interpreter, the virtual machine. All of this software does the hard work of translating your code into instructions your computer can understand.&lt;/p&gt;

&lt;p&gt;If it wasn’t for these tools, we’d have to write those low-level instructions ourselves. Thankfully, people already did that work and packaged it for us!&lt;/p&gt;

&lt;p&gt;🗂️ Does Every Language Run the Same Way?&lt;/p&gt;

&lt;p&gt;Most programming languages follow a similar flow:&lt;/p&gt;

&lt;p&gt;Check for errors&lt;/p&gt;

&lt;p&gt;Find the starting point&lt;/p&gt;

&lt;p&gt;Execute the code step by step&lt;/p&gt;

&lt;p&gt;The exact details depend on the language (some are compiled, some are interpreted, some use virtual machines). But the big idea stays the same:👉 You write instructions → A special program understands them → Your computer does the work&lt;/p&gt;

&lt;p&gt;🚀 Key Takeaway&lt;/p&gt;

&lt;p&gt;Whenever you write code, you’re actually giving instructions to a machine. The compiler or interpreter is your translator — it converts your words into something the computer’s hardware understands.&lt;/p&gt;

&lt;p&gt;So next time you click Run, appreciate the invisible magic happening behind your screen!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiylk6l9ipr87c7cdrl57.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiylk6l9ipr87c7cdrl57.png" alt="Image description" width="504" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📌 Final Thoughts&lt;/p&gt;

&lt;p&gt;Understanding how code runs is the first step to becoming a confident programmer.I hope this helped you — follow my journey as I share more beginner-friendly lessons!&lt;/p&gt;

</description>
      <category>coding</category>
      <category>programming</category>
      <category>programmers</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
