<?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>Forem: Dark | Backend Developer</title>
    <description>The latest articles on Forem by Dark | Backend Developer (@dark_353).</description>
    <link>https://forem.com/dark_353</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%2F3704563%2F9ab322f0-ec64-47b7-813d-54e8910195a1.png</url>
      <title>Forem: Dark | Backend Developer</title>
      <link>https://forem.com/dark_353</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dark_353"/>
    <language>en</language>
    <item>
      <title>From Spaghetti Code to Clean Architecture: Organizing a Professional Node.js Backend</title>
      <dc:creator>Dark | Backend Developer</dc:creator>
      <pubDate>Wed, 14 Jan 2026 19:43:08 +0000</pubDate>
      <link>https://forem.com/dark_353/from-spaghetti-code-to-clean-architecture-organizing-a-professional-nodejs-backend-4ijo</link>
      <guid>https://forem.com/dark_353/from-spaghetti-code-to-clean-architecture-organizing-a-professional-nodejs-backend-4ijo</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/dark_353" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F3704563%2F9ab322f0-ec64-47b7-813d-54e8910195a1.png" alt="dark_353"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/dark_353/from-spaghetti-code-to-clean-architecture-organizing-a-professional-nodejs-backend-2dca" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;From Spaghetti Code to Clean Architecture: Organizing a Professional Node.js Backend 🏗️&lt;/h2&gt;
      &lt;h3&gt;Dark | Backend Developer ・ Jan 14&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#node&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#architecture&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>node</category>
      <category>architecture</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>From Spaghetti Code to Clean Architecture: Organizing a Professional Node.js Backend 🏗️</title>
      <dc:creator>Dark | Backend Developer</dc:creator>
      <pubDate>Wed, 14 Jan 2026 19:42:11 +0000</pubDate>
      <link>https://forem.com/dark_353/from-spaghetti-code-to-clean-architecture-organizing-a-professional-nodejs-backend-2dca</link>
      <guid>https://forem.com/dark_353/from-spaghetti-code-to-clean-architecture-organizing-a-professional-nodejs-backend-2dca</guid>
      <description>&lt;p&gt;Many developers start their Express apps with everything inside a single app.js or index.js. It works for a "Hello World" project, but as soon as you add Authentication, Database Models, and Business Logic, things get messy. Fast.&lt;/p&gt;

&lt;p&gt;After refactoring several production apps, I realized that the secret to a scalable backend isn't just the code you write, but how you organize it.&lt;/p&gt;

&lt;p&gt;Here is the "Layered Architecture" I use to keep my sanity:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Controller Layer (The Messenger)
Controllers should only handle requests and responses. They don't know how the database works; they just pass data to the next layer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Mistake: Putting SQL queries inside a route handler.&lt;/p&gt;

&lt;p&gt;Fix: Keep them thin. If it's more than 10-15 lines, move the logic.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Service Layer (The Brain)
This is where your business logic lives. If a user registers, the Service Layer handles hashing the password, checking if the email exists, and sending the welcome email.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why? This makes your logic reusable and much easier to test.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The Model Layer (The Foundation)&lt;br&gt;
Using an ORM like Sequelize helps, but you need a strict structure. Define your associations (One-to-Many, etc.) in a way that doesn't create circular dependencies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Middleware Layer (The Guard)&lt;br&gt;
Security headers, rate limiting, and JWT validation should be global or route-specific guards. They shouldn't clutter your main logic.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why This Matters&lt;br&gt;
Building this structure from scratch for every project takes hours of boilerplate work—setting up folders, configuring Sequelize, mapping JWT flows, and testing Docker containers.&lt;/p&gt;

&lt;p&gt;I’ve spent a lot of time perfecting this exact folder structure and flow so that it's both secure and modular. I wanted a system where I could just focus on building features instead of configuring middleware for the 100th time.&lt;/p&gt;

&lt;p&gt;If you're looking for a reference on how to implement this layered architecture with a fully functional Auth system, I've shared my implementation on GitHub. It includes:&lt;/p&gt;

&lt;p&gt;Clear Controller/Service/Model separation.&lt;/p&gt;

&lt;p&gt;Automated Docker setup.&lt;/p&gt;

&lt;p&gt;Ready-to-use Auth flows (JWT Rotation).&lt;/p&gt;

&lt;p&gt;Check out the architecture here: 👉 &lt;a href="https://github.com/Dark353/node-express-mysql-auth-boilerplate" rel="noopener noreferrer"&gt;https://github.com/Dark353/node-express-mysql-auth-boilerplate&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How do you structure your Node.js apps? Do you prefer a flat structure or do you go all-in on clean architecture? Let's discuss in the comments!&lt;/p&gt;

</description>
      <category>node</category>
      <category>architecture</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Auth Logic: My Production-Ready Node.js + MySQL Boilerplate</title>
      <dc:creator>Dark | Backend Developer</dc:creator>
      <pubDate>Sat, 10 Jan 2026 21:37:06 +0000</pubDate>
      <link>https://forem.com/dark_353/-435d</link>
      <guid>https://forem.com/dark_353/-435d</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/dark_353" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F3704563%2F9ab322f0-ec64-47b7-813d-54e8910195a1.png" alt="dark_353"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/dark_353/stop-rewriting-auth-logic-my-production-ready-nodejs-mysql-boilerplate-42nl" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Stop Rewriting Auth Logic: My Production-Ready Node.js + MySQL Boilerplate 🚀&lt;/h2&gt;
      &lt;h3&gt;Dark | Backend Developer ・ Jan 10&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#node&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#security&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>security</category>
    </item>
    <item>
      <title>Stop Rewriting Auth Logic: My Production-Ready Node.js + MySQL Boilerplate 🚀</title>
      <dc:creator>Dark | Backend Developer</dc:creator>
      <pubDate>Sat, 10 Jan 2026 21:36:33 +0000</pubDate>
      <link>https://forem.com/dark_353/stop-rewriting-auth-logic-my-production-ready-nodejs-mysql-boilerplate-42nl</link>
      <guid>https://forem.com/dark_353/stop-rewriting-auth-logic-my-production-ready-nodejs-mysql-boilerplate-42nl</guid>
      <description>&lt;p&gt;Every time I start a new Node.js project, I find myself wasting hours setting up the same authentication patterns: JWT handling, secure password hashing, database models, and Docker configs. It’s tedious, and if you miss one security step, the whole app is at risk.&lt;/p&gt;

&lt;p&gt;To solve this, I built a comprehensive, enterprise-grade boilerplate that focuses on security and clean architecture, so you can just clone it and start building your actual business logic.&lt;/p&gt;

&lt;p&gt;🛠 What’s Under the Hood?&lt;br&gt;
I focused on a professional architecture that goes beyond simple tutorials:&lt;/p&gt;

&lt;p&gt;JWT Rotation Strategy: Implemented secure Access and Refresh token rotation with database-level revocation for extra security.&lt;/p&gt;

&lt;p&gt;Security First: Out-of-the-box protection with Bcrypt hashing, rate limiting, and security headers (Helmet).&lt;/p&gt;

&lt;p&gt;Clean Architecture: A layered structure (Controllers / Services / Models) using Sequelize for easy maintenance and scalability.&lt;/p&gt;

&lt;p&gt;DevOps Ready: Fully containerized with Docker for a "plug and play" experience.&lt;/p&gt;

&lt;p&gt;Professional Emails: Includes HTML email templates for authentication flows (welcome, reset password, etc.).&lt;/p&gt;

&lt;p&gt;📖 Fully Documented&lt;br&gt;
I believe code is only as good as its documentation. I’ve included a full API reference and architectural map in the README to make it transparent and easy to use for developers of all levels.&lt;/p&gt;

&lt;p&gt;🔗 Open Source &amp;amp; Feedback&lt;br&gt;
I’m sharing the core of this architecture on GitHub. I’d love to get your feedback on the implementation or answer any technical questions you might have!&lt;/p&gt;

&lt;p&gt;Check it out here: 👉&lt;a href="https://github.com/Dark353/node-express-mysql-auth-boilerplate" rel="noopener noreferrer"&gt;https://github.com/Dark353/node-express-mysql-auth-boilerplate&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you find this project helpful, please consider leaving a ⭐ on GitHub! It helps me stay motivated to keep it updated.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>security</category>
    </item>
  </channel>
</rss>
