<?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: Al-Amin Sarker</title>
    <description>The latest articles on DEV Community by Al-Amin Sarker (@alamin_php).</description>
    <link>https://dev.to/alamin_php</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%2F651619%2Fbd61343d-f050-4100-b7f4-cf835b584d89.png</url>
      <title>DEV Community: Al-Amin Sarker</title>
      <link>https://dev.to/alamin_php</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alamin_php"/>
    <language>en</language>
    <item>
      <title>Clean MVC Architecture in Node.js Without Express - A Laravel Inspired Approach</title>
      <dc:creator>Al-Amin Sarker</dc:creator>
      <pubDate>Sat, 30 Aug 2025 21:35:48 +0000</pubDate>
      <link>https://dev.to/alamin_php/clean-mvc-architecture-in-nodejs-without-express-a-laravel-inspired-approach-2oig</link>
      <guid>https://dev.to/alamin_php/clean-mvc-architecture-in-nodejs-without-express-a-laravel-inspired-approach-2oig</guid>
      <description>&lt;p&gt;A lightweight, framework-free Node.js project demonstrating a clean MVC structure inspired by Laravel. Includes &lt;strong&gt;routing&lt;/strong&gt;, &lt;strong&gt;controllers&lt;/strong&gt;, &lt;strong&gt;middleware&lt;/strong&gt;, &lt;strong&gt;MySQL integration&lt;/strong&gt;, &lt;strong&gt;form handling&lt;/strong&gt;, &lt;strong&gt;security&lt;/strong&gt; and a simple &lt;strong&gt;view Engine&lt;/strong&gt;. All built from scratch.&lt;/p&gt;

&lt;p&gt;When most developers think of Node.js, they immediately think of Express.js. But what if you could build a clean MVC architecture routing, controllers, models, views, middleware, security without any framework ? That’s exactly what I built in my project. It’s a lightweight MVC boilerplate that teaches you how frameworks work under the hood.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why This Project ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No Frameworks:&lt;/strong&gt; Everything is plain Node.js. Learn how MVC logic works internally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MVC Structure:&lt;/strong&gt; Inspired by Laravel’s clarity and organization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure by Default:&lt;/strong&gt; Includes &lt;strong&gt;CSRF&lt;/strong&gt;, &lt;strong&gt;XSS protection&lt;/strong&gt;, &lt;strong&gt;sessions&lt;/strong&gt;, &lt;strong&gt;CORS&lt;/strong&gt; and &lt;strong&gt;Rate limiting&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Feature Set:&lt;/strong&gt; &lt;strong&gt;Routing&lt;/strong&gt;, &lt;strong&gt;controllers&lt;/strong&gt;, &lt;strong&gt;models&lt;/strong&gt;, &lt;strong&gt;validation&lt;/strong&gt;, &lt;strong&gt;API support&lt;/strong&gt;, &lt;strong&gt;view Engine&lt;/strong&gt; and &lt;strong&gt;file uploads&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you’ve ever wanted to understand what happens behind Express, Laravel or Django, this project is the perfect deep dive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Routing &amp;amp; Route Service Provider&lt;/strong&gt;&lt;br&gt;
This project has a custom routing system for &lt;strong&gt;web&lt;/strong&gt; and &lt;strong&gt;API&lt;/strong&gt; endpoints, complete with global middleware and &lt;strong&gt;/api&lt;/strong&gt; prefixes. Routes are defined like Laravel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// routes/web.js
const Route = require('../system/WebRoute');
const UserController = require('../app/controllers/web/UserController');

Route.get('/users', UserController.index);
Route.post('/users', UserController.store);

module.exports = Route;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// routes/api.js
const Route = require('../system/ApiRoute');

const UserController = require('../app/controllers/api/UserController');
const AuthController = require('../app/controllers/api/AuthController');

Route.post('/users', UserController.store);
Route.post('/login', AuthController.create);

module.exports = Route;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supports &lt;strong&gt;GET&lt;/strong&gt;, &lt;strong&gt;POST&lt;/strong&gt;, &lt;strong&gt;PUT&lt;/strong&gt;, &lt;strong&gt;DELETE&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Middleware can be attached per route.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Middleware&lt;/strong&gt;&lt;br&gt;
Middleware enhances modularity, running before controllers for tasks like logging, authentication, validation, and CSRF protection. Just like Laravel’s pipeline.&lt;br&gt;
&lt;/p&gt;

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

// Example usage
Route.post('/users', UserController.store, [AuthMiddleware]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Controllers&lt;/strong&gt;&lt;br&gt;
Controllers manage the business logic and prepare responses for &lt;strong&gt;web&lt;/strong&gt; or &lt;strong&gt;API&lt;/strong&gt; routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// app/controllers/api/UserController.js
const response = require('../../../helpers/response');
const User = require('../../models/User');

class UserController {
  async index(req, res) {
    const users = await User.all();

    return response.json(res, {
        success: true,
        message: 'Success',
        data: users,
     });
  }
}

module.exports = new UserController();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Models with Fillable Support&lt;/strong&gt;&lt;br&gt;
Models extend a base Model class and define &lt;strong&gt;fillable&lt;/strong&gt; fields to prevent mass assignment vulnerabilities. Just like Laravel’s fillable fields, models prevent mass assignment vulnerabilities.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// app/models/User.js
const Model = require('../../system/Model');

class User extends Model {
   constructor() {
     super('users', ['name', 'email', 'password']);
   }
}

module.exports = new User();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only &lt;strong&gt;name&lt;/strong&gt;, &lt;strong&gt;email&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt; can be mass-assigned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage in a controller:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;await User.create({
   name: 'Alamin',
   email: 'alamin@gmail.com',
   password: hash('1234')
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;View Engine&lt;/strong&gt;&lt;br&gt;
A minimalist templating engine allows server-side rendering with simple HTML interpolation, similar to &lt;strong&gt;Blade&lt;/strong&gt; or &lt;strong&gt;EJS&lt;/strong&gt;.&lt;br&gt;
View Template (&lt;em&gt;views/home.html&lt;/em&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;{{ title }}&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
     {{ content }}
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Render from Controller:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const html = await view('home', { 
  title: 'Hello Node.js', 
  content: 'Hello World!' 
});
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(html);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Security First&lt;/strong&gt;&lt;br&gt;
The project includes essential security protections by default:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;CSRF Tokens&lt;/strong&gt; for safe form submissions in web routes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XSS Sanitization&lt;/strong&gt; using sanitize-html&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CORS Middleware&lt;/strong&gt; for safe cross-origin requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate Limiting&lt;/strong&gt; to prevent abuse.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Request Loggin&lt;/strong&gt; for debugging and monitoring.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Form Handling &amp;amp; File Uploads&lt;/strong&gt;&lt;br&gt;
Supports &lt;em&gt;application/json&lt;/em&gt;, &lt;em&gt;x-www-form-urlencoded&lt;/em&gt; and &lt;em&gt;multipart/form-data&lt;/em&gt; (via formidable)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Validation = require('../../../system/Validation');

const { passes, errors } = await Validation.validate(
    { name, email, password },
    {
      name: 'required|min:3',
      email: 'required|email|unique:users,email',
      password: 'required|min:3'
    }
);

if (! passes) {
  return response.validationError(res, errors);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Quick Start&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone git@github.com:alamincse/mvc-app-nodejs.git
cd mvc-app-nodejs
npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run the server:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nodemon server
node server # or
npm run pm2:start # or use pm2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And create database tables with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nodemon database  # Or `node database`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Configure your &lt;strong&gt;.env&lt;/strong&gt; file for database credentials and ports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access the Application&lt;/strong&gt;&lt;br&gt;
Open your browser and navigate to &lt;strong&gt;&lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why This Architecture Stands Out ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pure JavaScript:&lt;/strong&gt; No reliance on Express or other heavy frameworks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understand MVC deeply:&lt;/strong&gt; Learn core patterns and workflows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security-first:&lt;/strong&gt; Shields common attacks with default middleware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature-rich:&lt;/strong&gt; Includes templating, validation, models, routing, APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ideal for learning:&lt;/strong&gt; Perfect for developers keen on diving into MVC fundamentals.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why You Should Try It ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Understand frameworks deeply:&lt;/strong&gt; You’ll never see Express or Laravel the same way again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Educational:&lt;/strong&gt; Great for students and self-learners.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extensible:&lt;/strong&gt; Your own middleware, validation or auth system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight:&lt;/strong&gt; Perfect for small projects and experiments.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
Building mvc-app-nodejs demonstrates that frameworks are essentially layers of abstraction. By building an MVC system from scratch, you gain insight into the inner workings of routing, controllers, models, views and middleware.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read more on the GitHub repository:&lt;/strong&gt; &lt;a href="https://github.com/alamincse/mvc-app-nodejs" rel="noopener noreferrer"&gt;MVC-APP-Nodejs&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>eParbona -An eCommerce Software(Laravel)</title>
      <dc:creator>Al-Amin Sarker</dc:creator>
      <pubDate>Fri, 18 Jun 2021 11:10:18 +0000</pubDate>
      <link>https://dev.to/alamin_php/eparbona-an-ecommerce-software-laravel-4f95</link>
      <guid>https://dev.to/alamin_php/eparbona-an-ecommerce-software-laravel-4f95</guid>
      <description>&lt;p&gt;Do you want to manage your shop in online ? If yes, here eParbona is the best solution for you. eParbona is a laravel based eCommerce software and it's 100% responsive design.&lt;/p&gt;

&lt;p&gt;Demo link: &lt;a href="https://rb.gy/wvl9nc" rel="noopener noreferrer"&gt;https://rb.gy/wvl9nc&lt;/a&gt;&lt;br&gt;
Youtube video: &lt;a href="https://youtu.be/51Hka3-emPs" rel="noopener noreferrer"&gt;https://youtu.be/51Hka3-emPs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>ecommerce</category>
      <category>eparbona</category>
      <category>php</category>
    </item>
  </channel>
</rss>
