<?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: Basim Ghouri</title>
    <description>The latest articles on DEV Community by Basim Ghouri (@basimghouri).</description>
    <link>https://dev.to/basimghouri</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%2F867905%2F1d61f71d-6ff8-49c3-ad4c-f70a0d680dbb.jpeg</url>
      <title>DEV Community: Basim Ghouri</title>
      <link>https://dev.to/basimghouri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/basimghouri"/>
    <language>en</language>
    <item>
      <title>How We Built a Proactive Error Monitoring System (Before Clients Notice Issues)</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Fri, 30 Jan 2026 17:16:23 +0000</pubDate>
      <link>https://dev.to/basimghouri/how-we-built-a-proactive-error-monitoring-system-before-clients-notice-issues-1ehf</link>
      <guid>https://dev.to/basimghouri/how-we-built-a-proactive-error-monitoring-system-before-clients-notice-issues-1ehf</guid>
      <description>&lt;p&gt;In our projects, we designed a centralized error-monitoring and alerting architecture to ensure that any system issue is detected and reported to our team instantly—without waiting for client feedback.&lt;/p&gt;

&lt;p&gt;Here’s how we implemented it:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Global Error Capture Layer&lt;/strong&gt;&lt;br&gt;
We implemented a global error-handling mechanism at the backend level (Node.js / Laravel) that automatically catches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runtime exceptions&lt;/li&gt;
&lt;li&gt;API failures&lt;/li&gt;
&lt;li&gt;Unhandled promise rejections&lt;/li&gt;
&lt;li&gt;Server crashes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of handling errors route-by-route, we created a single centralized error handler.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Structured Error Logging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every captured error is converted into a structured format containing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error message&lt;/li&gt;
&lt;li&gt;File name&lt;/li&gt;
&lt;li&gt;Line number&lt;/li&gt;
&lt;li&gt;Stack trace&lt;/li&gt;
&lt;li&gt;Timestamp&lt;/li&gt;
&lt;li&gt;Environment (Production / Staging)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This ensures the team knows exactly what failed, where it failed, and why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Automated Email Alert System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We integrated SMTP-based email notifications that trigger instantly when an error occurs.&lt;/p&gt;

&lt;p&gt;Each alert includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error summary&lt;/li&gt;
&lt;li&gt;Code location&lt;/li&gt;
&lt;li&gt;Stack trace&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Developers can start debugging immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Crash-Level Monitoring&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Beyond normal errors, we also monitor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uncaught exceptions&lt;/li&gt;
&lt;li&gt;Unhandled promise rejections&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the server crashes, an alert is sent before shutdown.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Environment-Based Rules&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Production: Alerts enabled&lt;/li&gt;
&lt;li&gt;Development: Console logging&lt;/li&gt;
&lt;li&gt;Testing: Silent mode&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This prevents noise and keeps alerts meaningful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Fail-Safe Protection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Email sending is wrapped in try/catch to avoid infinite loops if mail service fails. System stability always comes first.&lt;/p&gt;

&lt;p&gt;Result&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The team knows about issues instantly&lt;/li&gt;
&lt;li&gt;Faster root-cause analysis&lt;/li&gt;
&lt;li&gt;Reduced downtime&lt;/li&gt;
&lt;li&gt;Clients experience fewer disruptions&lt;/li&gt;
&lt;li&gt;Higher system reliability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of being reactive, we built a proactive monitoring culture. When something breaks, our team already knows before the client does.&lt;/p&gt;

&lt;p&gt;Key Takeaway&lt;br&gt;
Building software is not only about features. It’s about designing systems that observe themselves and maintain reliability.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>mern</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why Knowing SSH Commands in Linux is Beneficial for Web Developers</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Fri, 16 Aug 2024 11:20:59 +0000</pubDate>
      <link>https://dev.to/basimghouri/why-knowing-ssh-commands-in-linux-is-beneficial-for-web-developers-26eo</link>
      <guid>https://dev.to/basimghouri/why-knowing-ssh-commands-in-linux-is-beneficial-for-web-developers-26eo</guid>
      <description>&lt;p&gt;Web developers should learn SSH commands because they simplify essential tasks like moving files within the same server, efficiently handling large database imports/exports, navigating directories quickly, downloading large files from other servers, changing file permissions, finding and searching files, automating tasks with scripts and cron jobs, monitoring system performance, managing user permissions, restarting services, and more. This not only saves time but also enhances productivity and control over web projects.&lt;/p&gt;

&lt;p&gt;By mastering SSH, you can handle complex web development tasks smoothly, giving you an edge over others. It’s a great way to improve your workflow and get more done with less hassle.&lt;/p&gt;

&lt;p&gt;Here are the &lt;a href="https://basimghouri.rf.gd/assets/uploads/ssh_commands_for_web_devs.txt" rel="noopener noreferrer"&gt;SSH commands&lt;/a&gt; that I have used in my workflow as a web developer over the years.&lt;/p&gt;

</description>
      <category>developer</category>
      <category>linux</category>
      <category>ssh</category>
      <category>cli</category>
    </item>
    <item>
      <title>Exploring Next.js Middleware</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Tue, 25 Jun 2024 11:58:55 +0000</pubDate>
      <link>https://dev.to/basimghouri/exploring-nextjs-middleware-3d78</link>
      <guid>https://dev.to/basimghouri/exploring-nextjs-middleware-3d78</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Middleware in Next.js?&lt;/strong&gt;&lt;br&gt;
Imagine that your web app is a nightclub, and middleware is the bouncer at the door. This bouncer decides who gets in based on their IDs. In Next.js, middleware acts as this gatekeeper for your app’s requests, letting you run code before the request completes. It’s perfect for tasks like authentication, logging, modifying requests, and more—all before the user even hits your page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why I Love Middleware&lt;/strong&gt;&lt;br&gt;
You might be wondering why you should bother with middleware. Let me tell you, it’s been a game-changer for me. Here’s why:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: I can make sure only logged-in users access certain parts of my app, with very little setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A/B Testing&lt;/strong&gt;: I can serve different versions of a page dynamically to see which one performs better.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logging and Analytics&lt;/strong&gt;: Middleware helps me log requests, giving me valuable insights for debugging and optimizing my app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Localization&lt;/strong&gt;: Redirecting users based on their location or language preference is super straightforward.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Getting Started with Middleware in Next.js&lt;/strong&gt;&lt;br&gt;
Let’s get our hands dirty with some code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up Middleware&lt;/strong&gt;&lt;br&gt;
Create a &lt;u&gt;middleware.js&lt;/u&gt; file in your &lt;u&gt;root&lt;/u&gt; directory. Here’s an example that uses an &lt;u&gt;config&lt;/u&gt; object to handle different middleware scenarios:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// middleware.js

import { NextResponse } from 'next/server';

export const config = {
  matcher: '/dashboard/:path*',
};

export function middleware(req) {
  const token = req.cookies.token;

  if (!token) {
    return NextResponse.redirect('/login', req.url);
  }

  return NextResponse.next();
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;u&gt;config&lt;/u&gt; object uses the &lt;u&gt;matcher &lt;/u&gt;property to specify that this middleware should apply to any route under &lt;u&gt;/dashboard&lt;/u&gt;. If there’s no &lt;u&gt;token&lt;/u&gt; cookie, the middleware redirects the user to the login page. This way, we can protect our dashboard routes efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More Cool Stuff You Can Do&lt;/strong&gt;&lt;br&gt;
Here are a few more ways I’ve found middleware to be incredibly handy:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logging Requests&lt;/strong&gt;&lt;br&gt;
Logging is crucial for keeping tabs on what’s happening in your app. Here’s how you can log requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const config = {
  matcher: '/api/:path*',
};

export function middleware(req) {
  console.log(`Request to ${req.nextUrl.pathname} at ${new Date().toISOString()}`);
  return NextResponse.next();
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every request to any route under &lt;u&gt;/api&lt;/u&gt; logs the pathname and timestamp. This simple addition has helped me a lot in debugging and understanding user behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A/B Testing&lt;/strong&gt;&lt;br&gt;
A/B testing can be a powerful tool to improve your user experience. Here’s how you can set it up with middleware:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const config = {
  matcher: '/',
};

export function middleware(req) {
  const url = req.nextUrl.clone();
  const variant = Math.random() &amp;lt; 0.5 ? 'A' : 'B';

  if (url.pathname === '/') {
    url.pathname = `/home-${variant}`;
    return NextResponse.rewrite(url);
  }

  return NextResponse.next();
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this setup, users visiting the homepage are randomly redirected to either &lt;u&gt;/home-A&lt;/u&gt; or &lt;u&gt;/home-B&lt;/u&gt;, letting you gather data on which version works better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Personal Tips for Using Middleware&lt;/strong&gt;&lt;br&gt;
From my experience, keeping middleware simple is key. Middleware runs on every request, so you want to ensure it’s efficient and doesn’t slow things down. Here are a few tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep It Lightweight&lt;/strong&gt;: Avoid complex logic in your middleware to keep performance high.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Caching&lt;/strong&gt;: When appropriate, cache responses to improve performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test Thoroughly&lt;/strong&gt;: Middleware affects every request, so thorough testing is crucial to avoid unexpected issues.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;My Takeaway&lt;/strong&gt;&lt;br&gt;
Playing around with middleware in Next.js has been a revelation. It’s given me a cleaner, more efficient way to handle common tasks like authentication and logging. I love how it centralizes control logic, making my codebase cleaner and more maintainable.&lt;/p&gt;

&lt;p&gt;I encourage you to try it out in your next project. Middleware can help you handle requests more gracefully and make your web apps more robust. Plus, it’s a lot of fun to see just how much you can do before your users even reach a page!&lt;/p&gt;

&lt;p&gt;Happy coding, and let me know in the comments how you’re using middleware in your projects. I’d love to hear your stories and tips! 🚀&lt;/p&gt;

</description>
      <category>allah</category>
      <category>prophet</category>
      <category>faith</category>
      <category>challenge</category>
    </item>
    <item>
      <title>What Is Next Js And Why Should You Use It In 2024?</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Wed, 05 Jun 2024 23:45:08 +0000</pubDate>
      <link>https://dev.to/basimghouri/what-is-next-js-and-why-should-you-use-it-in-2024-5ei9</link>
      <guid>https://dev.to/basimghouri/what-is-next-js-and-why-should-you-use-it-in-2024-5ei9</guid>
      <description>&lt;p&gt;&lt;strong&gt;INTRODUCTION&lt;/strong&gt;&lt;br&gt;
One of the top benefits of learning what is Next.js, is the knowledge of how flexible you can become in building, and adapting to online reality.&lt;/p&gt;

&lt;p&gt;As seasoned Next.js developers, we recognize the immense value in mastering this framework. One of its most compelling advantages lies in its unparalleled flexibility, empowering us to craft and seamlessly adapt to the dynamic landscape of the online realm.&lt;/p&gt;

&lt;p&gt;Within our realm as providers of Next.js development services, we view this flexibility as a cornerstone in navigating the swiftly evolving digital sphere. It affords us the agility to swiftly iterate and experiment with our concepts, enabling us to promptly respond to market demands and technological advancements. In essence, it allows us to stay ahead of the curve and maintain a competitive edge.&lt;/p&gt;

&lt;p&gt;Moreover, the current landscape of consumer behavior has undergone a seismic shift, presenting new challenges and opportunities. With the rise of e-commerce and changing consumer habits, the need for adaptable and innovative solutions has become more pressing than ever before.&lt;/p&gt;

&lt;p&gt;We became much more demanding when it comes to page loading speed (in milliseconds!) and the user experience from using websites or web shops.&lt;/p&gt;

&lt;p&gt;Our expectations regarding page loading speed, measured in milliseconds, and the overall user experience while navigating websites or online stores have significantly heightened.&lt;/p&gt;

&lt;p&gt;It allows you to build both simple and complex web applications much faster, and easier, and thanks to many great frameworks that have grown upon it, you can now build blazingly fast websites to achieve a much better UX and SEO efficiency.&lt;/p&gt;

&lt;p&gt;Let’s have a look at one of those frameworks — Next.js, which enjoys growing popularity and quickly became the first choice for many big names and companies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;# WHAT IS NEXT.JS?&lt;/strong&gt;&lt;br&gt;
Next.js is a JavaScript framework that enables you to build superfast and extremely user-friendly static websites, as well as web applications using React.&lt;/p&gt;

&lt;p&gt;In fact, thanks to &lt;a href="https://nextjs.org/docs/pages/building-your-application/rendering/automatic-static-optimization" rel="noopener noreferrer"&gt;&lt;strong&gt;Automatic Static Optimization&lt;/strong&gt;&lt;/a&gt;, “static” and “dynamic” become one now.&lt;/p&gt;

&lt;p&gt;This feature allows Next.js to build hybrid applications that contain both server-side rendered and statically generated pages.&lt;/p&gt;

&lt;p&gt;In other words,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Statically generated pages are still reactive: Next.js will hydrate your application client-side to give it full interactivity.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This opens us many advantages like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rich User Experience&lt;/strong&gt; (easier and faster)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Great performance&lt;/strong&gt; (also easier and faster)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rapid feature development&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next.js is widely used by the biggest and most popular companies all over the world like Netflix, Uber, Starbucks, or Twitch. It’s also considered as one of the fastest-growing React frameworks, perfect to work with static sites — which was the hottest topic in the web development world lately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Next.js — A 2024 Perspective&lt;/strong&gt;&lt;br&gt;
In recent years, Next.js has witnessed a huge rise in popularity.&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%2Fxghei802oaiglwksfx30.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%2Fxghei802oaiglwksfx30.png" alt=" " width="720" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the Stack Overflow survey of 2023, it ascended from the 11th to the 6th most popular framework among web developers. This rapid growth underscores its increasing acceptance and effectiveness in the developer community.&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%2F4wadfgvpe6gcis2s55i9.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%2F4wadfgvpe6gcis2s55i9.png" alt=" " width="720" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Over the years, Next.js has continually evolved, introducing features that address the ever-changing environment of web development. Its updates have consistently focused on imrpoving performance, developer experience, and providing robust SEO capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next.js 14 — A Leap Forward&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next.js 14, introduced by Lee Robinson and Tim Neutkens, marked a significant advancement in the framework’s capabilities, building upon the foundations laid by Next.js 13:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Turbopack&lt;/strong&gt;: Replaces Webpack for faster builds, offering significantly quicker server start-up and refresh rates. These changes lead to higher developer productivity and faster iteration cycles, crucial for large-scale applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server Actions (Stable)&lt;/strong&gt;: Streamlines server-side logic, allowing functions to run securely on the server. This simplifies data mutation workflows and strenghten application security, particularly vital for handling sensitive data and complex state management scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Partial Prerendering (Preview)&lt;/strong&gt;: Merges the benefits of SSR, SSG, and ISR, enabling rapid initial static loading with dynamic content streaming. This is key for applications requiring both fast loading times and dynamic content rendering.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Metadata Improvements&lt;/strong&gt;: Automates the inclusion of essential metadata in the initial page load, ensuring a seamless user experience across devices and themes. It’s especially important for responsive design and accessibility.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Next.js 14 brought some game-changing features. Turbopack, for instance, has significantly sped up server startup and code refresh times. Then there’s Server Actions, making mutations more efficient and integrated. And let’s not forget Partial Prerendering, which is still in preview but looks promising for dynamic content handling.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The features introduced in Next.js 14 represent significant advancements in the capabilities of the framework, catering to various aspects of web development and addressing key challenges faced by developers. Let’s delve into each of these features and explore their benefits in more detail:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React Server Components (RSC):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance Optimization: By rendering components server-side and accessing the backend directly, RSC reduces the client-side bundle size and enhances performance.&lt;/li&gt;
&lt;/ul&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%2Fbx5k4ku5r30qifoo6vdh.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%2Fbx5k4ku5r30qifoo6vdh.png" alt=" " width="720" height="577"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Improved Initial Load Times: With reduced initial load times, RSC contributes to a smoother user experience, especially for applications with extensive client-side rendering requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SEO Benefits: Server-side rendering improves SEO capabilities by providing search engine crawlers with pre-rendered HTML content, enhancing discoverability and search ranking.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Granular Control: Middleware empowers developers with fine-grained control over the request-response lifecycle, facilitating advanced server-side logic such as A/B testing and request manipulation.&lt;/li&gt;
&lt;/ul&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%2Fe5kmdnuf2hjpaoaafqcc.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%2Fe5kmdnuf2hjpaoaafqcc.png" alt=" " width="720" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Customized User Experience: With the ability to manipulate requests and responses at various stages, developers can tailor the user experience based on specific criteria, enhancing personalization and engagement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Efficient Implementation of Complex Logic: Middleware streamlines the implementation of complex server-side logic, enabling developers to manage application behavior more efficiently and effectively.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Edge Functions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Minimized Latency: By executing server-side code at the network’s edge, Edge Functions minimize latency and offer a serverless experience, ensuring optimal performance for users across diverse geographical locations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;High Performance: Applications requiring high performance and low response times benefit significantly from Edge Functions, delivering faster and more responsive user experiences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Global Scalability: Edge Functions enable global scalability by distributing server-side logic closer to end-users, reducing the impact of geographical distance on application performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;App Router:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Advanced Routing Features: The revamped routing system in Next.js, including support for nested routes and layouts, offers developers more flexibility and power in structuring applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability and Maintainability: For large-scale and complex web projects, App Router provides a structured approach to managing routing logic, enhancing scalability and maintainability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved Developer Productivity: With a more intuitive and feature-rich routing system, developers can streamline development workflows and accelerate the implementation of routing-related features.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall, the features introduced in Next.js 14 represent a significant leap forward in empowering developers to build high-performance, scalable, and feature-rich web applications. Whether it’s optimizing performance, customizing user experiences, reducing latency, or enhancing routing capabilities, Next.js 14 offers a comprehensive toolkit for tackling the challenges of modern web development effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NEXT.JS AND JAMSTACK&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next.js is now one of the most popular React frameworks for building superfast, and super SEO-friendly &lt;a href="https://pagepro.co/services/jamstack-development" rel="noopener noreferrer"&gt;Jamstack websites&lt;/a&gt;.It can be perfectly combined with headless CMSes, or eCommerce platforms to drive extraordinary performance and SEO results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WHAT CAN YOU BUILD WITH NEXT.JS?&lt;/strong&gt;&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%2Fhqhn4ja110jilz8tcfa6.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%2Fhqhn4ja110jilz8tcfa6.png" alt=" " width="720" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Next.js you can build a number of digital products and interfaces such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web Platform&lt;/li&gt;
&lt;li&gt;Jamstack websites&lt;/li&gt;
&lt;li&gt;MVP (Minimum Viable Product)&lt;/li&gt;
&lt;li&gt;Static websites&lt;/li&gt;
&lt;li&gt;Single web pages&lt;/li&gt;
&lt;li&gt;SaaS products&lt;/li&gt;
&lt;li&gt;eCommerce and retail websites&lt;/li&gt;
&lt;li&gt;Dashboards&lt;/li&gt;
&lt;li&gt;Complex and demanding web applications&lt;/li&gt;
&lt;li&gt;Interactive user interfaces&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And we love to use it in various projects since it gives us so many possibilities. Check out how it influenced the e-learning platform we were recently launching for our customer — Learn Squared:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Our Choice: Why We Chose Next.js for Our Website&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the heart of our decision to use Next.js for our website lies a combination of strategic factors and practical benefits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SEO Optimization&lt;/strong&gt; stands out as a primary reason — we work on SEO improvements daily, as organic is our main source of traffic. Next.js’s powerful SEO capabilities significantly boost organic traffic, a key metric for online visibility and success.&lt;/p&gt;

&lt;p&gt;Equally crucial is &lt;strong&gt;Page Speed&lt;/strong&gt; for us. This framework’s efficiency in loading times elevates the user experience and also, again, fortifies our SEO efforts.&lt;/p&gt;

&lt;p&gt;In the realm of** Content Management**, using the Jamstack architecture with Next.js has afforded us exceptional flexibility, allowing our marketing team to harness tools like Storybook for dynamic content management.&lt;/p&gt;

&lt;p&gt;This aligns perfectly with our approach to content strategy, ensuring that we can adapt and respond swiftly to market trends and user feedback.&lt;/p&gt;

&lt;p&gt;Lastly, the &lt;strong&gt;Developer Affinity&lt;/strong&gt; for Next.js within our team is noteworthy. Our developers prize its efficiency and scalability, making it a pleasure to work with, while the robust support community around Next.js provides an added layer of assurance and continuous learning.&lt;/p&gt;

&lt;p&gt;By adopting Next.js for our own website, we provided final proof of its effectiveness and adaptability in the ever-evolving digital world. (Yes, we love it very much!)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NEXT.JS AND USER EXPERIENCE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;User experience plays a key role in the success (or failure) of digital businesses.&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%2Fmwlt8n9250z762dzqief.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%2Fmwlt8n9250z762dzqief.png" alt=" " width="600" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, if you have an online shop and you don’t take care of UX properly, it will result in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Losing customers&lt;/li&gt;
&lt;li&gt;Abandoned carts&lt;/li&gt;
&lt;li&gt;High bounce rate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The design is also important — if you are using themes or templates, the chances are someone out there has a similar-looking layout. It also means that you can’t build a unique customer experience and change it over time. Even if this means changing one simple thing like adding a button to the product page or deleting one.&lt;/p&gt;

&lt;p&gt;Luckily — thanks to Next.js — you can build a fully customized user experience. Let’s see what it really means.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UX Freedom&lt;/strong&gt;: Next.js allows developers to bypass the constraints of plugins, templates, or other limitations typically imposed by CMS platforms. Technically, this is facilitated by Next.js’s flexible file-system routing and its support for various CSS-in-JS libraries, enabling a high degree of customization in the frontend design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Adaptability and Responsiveness&lt;/strong&gt;: The framework’s built-in features such as automatic image optimization and responsive loading contribute significantly to creating web applications that are adaptable to any screen size or resolution. This adaptability is bolstered by the framework’s seamless integration with modern CSS frameworks,boosting the responsive design capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Short Page Load Time&lt;/strong&gt;: Next.js’s capability for static site generation (SSG) and incremental static regeneration (ISR) plays a crucial role in achieving faster page load times. They enable serving pre-rendered pages to users, significantly reducing the time to first byte (TTFB) and repairing the overall site speed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Security&lt;/strong&gt;: In the context of static websites built with Next.js, the absence of a direct database connection reinforce security. This architectural choice minimizes the exposure of sensitive data and dependencies, making these sites inherently more secure against common web vulnerabilities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2F0d4regucreyzkmavksbc.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%2F0d4regucreyzkmavksbc.png" alt=" " width="540" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All of these things mentioned above make the user experience as great as it can possibly be.&lt;/p&gt;

&lt;p&gt;But the benefits of using Next.js don’t end there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NEXT.JS AND SEO&lt;/strong&gt;&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%2Fvzai5yrs21hepiqbp7tv.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%2Fvzai5yrs21hepiqbp7tv.png" alt=" " width="720" height="577"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another big reason to choose Next.js is its SEO efficiency, and here’s why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server-Side Rendering (SSR)&lt;/strong&gt;: One of the most influential benefits of Next.js is its use of SSR. It ensures that the full content of your page is rendered on the server before it reaches the user’s browser. For search engines, this means they can crawl and index your site content more effectively, boosting your visibility in search results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Static Site Generation (SSG)&lt;/strong&gt;: Next.js excels in generating static sites, which are faster and more reliable. Static sites load quicker, offering a better user experience, a factor that search engines, particularly Google, prioritize highly. This directly contributes to better SEO rankings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Speed and Performance&lt;/strong&gt;: Next.js websites are known for their impressive speed, a direct result of static generation and optimized code. Fast-loading sites reduce bounce rates, keep users engaged longer, and are favoured by search engines, all contributing to higher SEO rankings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Organic Traffic and High-Intent Keywords&lt;/strong&gt;: By optimizing for speed and user experience, Next.js helps in growing organic traffic faster. Its ability to rank high-intent keywords higher than competitors makes it a preferred choice for businesses aiming to be more visible to potential customers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Competitive Edge&lt;/strong&gt;: The SEO efficiency of Next.js gives websites a significant advantage over competitors. Its capabilities in speed, performance, and content visibility help sites outperform others in search engine results.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In both cases, it will help you a lot with:&lt;/p&gt;

&lt;p&gt;**- Growing organic traffic faster&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ranking your high-intent keywords higher&lt;/li&gt;
&lt;li&gt;Outperforming competitors easier&lt;/li&gt;
&lt;li&gt;Be more visible to potential customers**&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next.js websites are super-fast, easy to scan, and provide a great user experience and that’s why Google will favour them above others and rank them higher.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PROS AND CONS OF NEXT.JS&lt;/strong&gt;&lt;br&gt;
As with any other framework, some great options come with a price. Let’s have a look at the most popular pros and cons of using Next.js.&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%2Fcvn3i745knz3jba0l21b.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%2Fcvn3i745knz3jba0l21b.png" alt=" " width="720" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main Advantages of Next.js for CTOs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rich Ecosystem: Next.js benefits from the widespread adoption of JavaScript and strong backing from industry giants like Vercel and Meta. This robust ecosystem offers a rich talent pool and ease of learning, making Next.js a strategic, future-proof choice for tech leaders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Future-Proof Technology&lt;/strong&gt;: With regular updates and support from a vibrant community and industry leaders, Next.js represents a future-proof solution in web development. Additionally, its alignment with the latest web standards makes it a strategic asset for long-term business goals and technology roadmaps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Easy Scalability&lt;/strong&gt;: Next.js supports scalability through features like automatic code splitting, flexible rendering options, and optimized image handling. These features ensure efficient resource utilization and performance under high traffic, crucial for rapidly growing businesses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High Security&lt;/strong&gt;: Offering robust tools for building secure web applications, Next.js addresses critical areas like authentication and data validation. This focus on security is vital for maintaining user trust and data integrity in the face of growing number of cyber threats.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance Optimization&lt;/strong&gt;: Key features like lazy loading, image optimization, code splitting, and route prefetching in Next.js positively influence site performance. And these are essential for high user engagement and efficient resource utilization, impacting the success and growth of web applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SEO Optimization&lt;/strong&gt;: As we mentioned a few times above, Next.js boosts SEO through server-side rendering, static generation, and incremental static regeneration. It ensures that content is fully accessible to search engine crawlers, supporting site visibility and user traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits of Next.js for online businesses&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;How Next.js can positively impact your business results and help you push your ideas further?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Faster time to market&lt;/strong&gt;: many ready-to-use components and compatibility that come with it make building MVP much faster. Thanks to it, you can get feedback from real users quickly and make proper changes without wasting time and budget.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Better User Experience&lt;/strong&gt;: you have total freedom to create a front-end that fully aligns with your business goals and design vision. Thanks to it, the user experience is great and unique.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Increased organic traffic&lt;/strong&gt;: Google loves static sites as they are fast, light, and easy to scan. This translates into higher positions of these websites in search results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fully omnichannel&lt;/strong&gt;: Next.js websites and web apps work on any device, so they are accessible to everyone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Support on demand&lt;/strong&gt;: since Next.js is a React-based framework, it won’t be difficult to find another &lt;a href="https://pagepro.co/services/frontend-development" rel="noopener noreferrer"&gt;frontend developer&lt;/a&gt; without a need to build everything from scratch once again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Increased conversion rate&lt;/strong&gt;: fast loading speed, better user experience and high accessibility convert into a higher conversion. If the users are happy with the customer experience they got, they are more likely to buy and come back later for more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Community support&lt;/strong&gt;: as Next.js is becoming a number one framework for many big brands, it’s becoming more famous, and naturally, so the number of its contributors. That means, even if you face any issue, there will be probably a solution for that already.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros of Next.js for developers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Regardless of whether you are looking for benefits from a business perspective or a technical one, you will find some reasons to seriously consider choosing Next.js.&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%2Fsriizuf4vli7by9atcb4.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%2Fsriizuf4vli7by9atcb4.png" alt=" " width="720" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to build a complex and demanding application, React development nature of Next.js allows for saving a lot of time. Developers especially favour features like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Zero Config&lt;/strong&gt; — Next allows you to focus on the business logic of your application instead of the application logic. And to help you, it provides automatic compilation and bundling. In other words, Next is optimized for production right from the start.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Incremental Static Regeneration&lt;/strong&gt; — it allows you to update the pages by re-rendering them in the background as traffic comes in. So in other words, static content can become dynamic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A hybrid of server-side rendering SSR and static site generation SSG&lt;/strong&gt; — prerender pages at build time or request time in a single project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;TypeScript support&lt;/strong&gt; — automatic TypeScript configuration and compilation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fast Refresh&lt;/strong&gt; — fast, live-editing experience — edits made on React components are live within seconds. It works analogically to Hot Module Replacement (HMR).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CSS parsers&lt;/strong&gt; — the possibility to import CSS files from a JavaScript file. New parses improved the handling of CSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Built-in Image Component and Automatic Image Optimization&lt;/strong&gt; — this feature automatically optimizes images.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic code splitting&lt;/strong&gt; — automatically reduces the size of the page by splitting the code and serving components only when needed. Modules can be automatically imported too, thanks to the dynamic import option.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data fetching&lt;/strong&gt; — this option allows rendering the content in different ways, accordingly to the app’s use case. It can be done by pre-rendering with server-side rendering SSR or static site generation and by updating or creating content with ISR.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Release of Next.js 14: even more promising future&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The list of Next.js benefits is growing with every release. In October 2023, Next.js 14 was introduced, together with a bunch of new features. The most important among them are:&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%2Fakxn3dxsigcxlbhn1or0.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%2Fakxn3dxsigcxlbhn1or0.png" alt=" " width="720" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improved Image Component&lt;/strong&gt;: Next.js 14 introduces enhancements to the Image component, making it even more efficient and versatile for handling images in web applications. With optimizations for performance and accessibility, developers can seamlessly integrate high-quality images while maintaining a fast and responsive user experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Incremental Static Regeneration (ISR) Enhancements&lt;/strong&gt;: Building upon the ISR feature introduced in previous versions, Next.js 14 further refines and expands its capabilities. With improved support for dynamic data fetching and caching strategies, developers can leverage ISR to generate and update static pages with minimal effort, ensuring up-to-date content delivery while maximizing performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced TypeScript Support&lt;/strong&gt;: Next.js continues to prioritize TypeScript support, with version 14 delivering even more robust typings and tooling for TypeScript users. This includes better integration with popular TypeScript libraries and improved error handling, enabling developers to write safer and more maintainable code with confidence.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Streamlined API Routes&lt;/strong&gt;: Next.js 14 introduces optimizations to API routes, simplifying the process of building backend functionality within Next.js applications. With enhanced routing capabilities and improved middleware support, developers can create powerful APIs more efficiently, facilitating seamless communication between client-side and server-side logic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Advanced Internationalization (i18n) Support&lt;/strong&gt;: Next.js 14 expands its i18n capabilities with new features and enhancements tailored for building multilingual applications. With built-in support for locale-specific routing, content translation, and date formatting, developers can easily create immersive user experiences for global audiences while maintaining code simplicity and clarity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optimized Build Performance&lt;/strong&gt;: Building upon previous optimizations, Next.js 14 introduces further improvements to build performance, reducing build times and enhancing developer productivity. Through enhancements to the build pipeline and caching mechanisms, developers can iterate more quickly and deploy changes with confidence, ensuring a smooth development experience from start to finish.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced Developer Experience&lt;/strong&gt;: Next.js 14 focuses on enhancing the overall developer experience with improvements to tooling, documentation, and community resources. With updated documentation, interactive examples, and comprehensive guides, developers can onboard quickly and leverage Next.js effectively for their projects, regardless of experience level.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Expanded Ecosystem Integrations&lt;/strong&gt;: Next.js 14 strengthens its integration with popular frameworks, libraries, and services within the JavaScript ecosystem. From seamless integration with React Suspense to enhanced compatibility with GraphQL APIs and headless CMS platforms, developers have access to a rich ecosystem of tools and resources to streamline development workflows and build cutting-edge web applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improved Accessibility&lt;/strong&gt;: Next.js 14 prioritizes accessibility by providing developers with tools and best practices to ensure that their applications are inclusive and usable by all users. With enhanced accessibility auditing tools, automatic aria-label generation, and built-in support for keyboard navigation, developers can create accessible web experiences with ease, meeting the highest standards of accessibility compliance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Future-ready Architecture&lt;/strong&gt;: Next.js 14 lays the foundation for future innovations in web development with a forward-thinking architecture and design principles. By embracing emerging technologies, standards, and best practices, Next.js empowers developers to build modern, scalable, and resilient web applications that are ready for the challenges of tomorrow.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next.js 14 represents a significant milestone in the evolution of the framework, offering developers a comprehensive toolkit for building modern web applications with speed, efficiency, and confidence. With its rich feature set, robust performance optimizations, and commitment to developer experience, Next.js continues to solidify its position as a leading choice for JavaScript developers worldwide.&lt;/p&gt;

&lt;p&gt;To learn more about the new Next.js, visit the &lt;a href="https://nextjs.org/blog" rel="noopener noreferrer"&gt;Next.js official website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons of using Next.js&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The number of Next benefits is huge and clearly outweighs its cons. However, let’s write them down to be as objective as it’s possible.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Development and management&lt;/strong&gt; — the flexibility, given by Next, has its cost — continuous management. To make all desired changes properly, you will need a dedicated person with proper knowledge. The good news is that this person doesn’t have to be a developer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ongoing cost&lt;/strong&gt; — since Next.js does not provide many built-in front pages, you have to create your own front-end, which will require changes from time to time. It means that you will have to pay a frontend developer to get the job done.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lack of built-in state manager&lt;/strong&gt; — so if you need a state manager in your app, you have to add Redux, MobX or something else.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Low on plug-ins&lt;/strong&gt; — you cannot use much of easy-to-adapt plugins.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;EXAMPLES OF NEXT.JS WEBSITES&lt;br&gt;
Here are just three of &lt;a href="https://pagepro.co/blog/nextjs-websites-examples/" rel="noopener noreferrer"&gt;the great examples of websites build in Next.js.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also check out &lt;a href="https://nextjs.org/showcase" rel="noopener noreferrer"&gt;their official showcase&lt;/a&gt; for even more inspiration.&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%2Fb2lri0o9zb5sfkygbmzz.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%2Fb2lri0o9zb5sfkygbmzz.png" alt=" " width="720" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ferrari.com" rel="noopener noreferrer"&gt;https://ferrari.com&lt;/a&gt;&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%2Fj5kpr5i54rlydakq3220.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%2Fj5kpr5i54rlydakq3220.png" alt=" " width="720" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://m.twitch.tv" rel="noopener noreferrer"&gt;https://m.twitch.tv&lt;/a&gt;&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%2Ft4yehw7vmdkzayjncuu8.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%2Ft4yehw7vmdkzayjncuu8.png" alt=" " width="720" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nike.com/help" rel="noopener noreferrer"&gt;https://nike.com/help&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SUMMARY&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It doesn’t matter if you are planning to build a huge and demanding app to serve millions of users, nor if you are a growing web shop on Shopify. In both cases, you can use the advantages of modern web technology to &lt;strong&gt;make your business more efficient online.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Uplift your page speed, SEO, and UX, and remember that technologies such as Next.js are making the web a better, cleaner, and more user-centric place. And that will always be favourable, not only to Google but, most importantly, to users.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>nextjs</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Moment.js Is Now Legacy Project | Alternatives?</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Wed, 22 Nov 2023 01:14:17 +0000</pubDate>
      <link>https://dev.to/basimghouri/momentjs-is-now-legacy-project-alternatives-12ke</link>
      <guid>https://dev.to/basimghouri/momentjs-is-now-legacy-project-alternatives-12ke</guid>
      <description>&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%2Fowklns52nw1h2j4fhcrq.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%2Fowklns52nw1h2j4fhcrq.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your project deals with complex date and time then you probably have been use to of moment.js. Be aware, Moment.js has become a legacy project. You can check the project status here,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;We now generally consider Moment to be a legacy project in maintenance mode.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Furthermore,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; It is not dead, but it is indeed done.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, what's next?&lt;/p&gt;

&lt;p&gt;Go for these:&lt;/p&gt;

&lt;h2&gt;
  
  
  dayjs
&lt;/h2&gt;

&lt;p&gt;Fast 2kB alternative to Moment.js with the same modern API. I myself have used this for more than a year and found it really cool, easy and super helpful.&lt;/p&gt;

&lt;p&gt;Get started here:&lt;br&gt;
&lt;a href="https://day.js.org/docs/en/installation/installation" rel="noopener noreferrer"&gt;https://day.js.org/docs/en/installation/installation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  date-fns
&lt;/h2&gt;

&lt;p&gt;date-fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser &amp;amp; Node.js.&lt;/p&gt;

&lt;p&gt;Get started here:&lt;br&gt;
&lt;a href="https://date-fns.org/docs/Getting-Started" rel="noopener noreferrer"&gt;https://date-fns.org/docs/Getting-Started&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  luxon
&lt;/h2&gt;

&lt;p&gt;A powerful, modern, and friendly wrapper for JavaScript dates and times.&lt;/p&gt;

&lt;p&gt;Get started here:&lt;br&gt;
&lt;a href="https://moment.github.io/luxon/#/?id=luxon" rel="noopener noreferrer"&gt;https://moment.github.io/luxon/#/?id=luxon&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding! 🚀👨‍💻🌐&lt;/p&gt;

&lt;p&gt;Follow me for more such content:&lt;br&gt;
LinkedIn: &lt;a href="https://www.linkedin.com/in/basimghouri" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/basimghouri&lt;/a&gt;&lt;br&gt;
Github: &lt;a href="https://github.com/ghourigeeks" rel="noopener noreferrer"&gt;https://github.com/ghourigeeks&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Command Injection Affecting Apache Directory</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Wed, 22 Nov 2023 00:46:47 +0000</pubDate>
      <link>https://dev.to/basimghouri/apache-directory-studio-command-injection-2mkk</link>
      <guid>https://dev.to/basimghouri/apache-directory-studio-command-injection-2mkk</guid>
      <description>&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%2Fzya9ikkr7lgujd9niesz.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%2Fzya9ikkr7lgujd9niesz.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Apache Directory Studio is a Desktop application which basically is used as an LDAP tooling platform for the LDAP server which was intentionally designed for Apache DS. The basic purpose of the application is to handle LDAP databases of the Apache HTTPD server&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%2F8m03zac5kwqbeul9g09z.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%2F8m03zac5kwqbeul9g09z.png" alt=" " width="639" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As i have openly admitted many times that i am guy who research is based totally on logics, this once again was a command injection vulnerability whose misuse was based on logical thought process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Main modules of Apache Directory Studio
&lt;/h2&gt;

&lt;p&gt;Basically Apache LDAP studio and Apache Directory studio have several components which include&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;LDAP Editor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;LDAP browser&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Schema Editor&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Workflow of Apache Directory Studio
&lt;/h2&gt;

&lt;p&gt;The functions of the modules can be interpreted by their names. Since the main modules of the application is LDAP Editor using which one can actively add LDAP queries to the ApacheDS integration, it was obvious to me that the inputs i give would be passed through the Editor and reflected in the Browser. Upon researching more, i came to know that symbols such =,+,-,, are not filtered in the LDAP Editor queries and once can add attributes like =1+1 etc, which can be observed in LDAP browser module.&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%2F6whp76yxaoqjfyl8aqc9.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%2F6whp76yxaoqjfyl8aqc9.png" alt=" " width="478" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Researchers who normally test Desktop application are aware of the fact that the malicious input being reflected in a Desktop application has no value unless an active exploit is possible which is contrary to the case in Web applications. So i directed my search to the export features of the LDAP module and came across a CSV export wizard whose function i learned from the link below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://directory.apache.org/studio/users-guide/ldap_browser/tools_csvexport_wizard.html" rel="noopener noreferrer"&gt;https://directory.apache.org/studio/users-guide/ldap_browser/tools_csvexport_wizard.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Testing Methodology&lt;/p&gt;

&lt;p&gt;In my methodology of Business Logic testing. which i am sure would be disagreed by several researchers is that discovering the logical flaw in mere black and white manner is not enough. There should to be two aspects of the flaw that should be worked on which are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Coming up with a concrete exploit&lt;/li&gt;
&lt;li&gt;Possible ways of remote misuse&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Payload Generation
&lt;/h2&gt;

&lt;p&gt;The first part was not that difficult as there are several sources on the web that can be used to craft payloads which can be used in excel CSV exploits. So i came up with the exploit payload that could be used to execute a calculator using the CSV which would be&lt;/p&gt;

&lt;p&gt;-10+33 cmd| /C calc!A0&lt;/p&gt;

&lt;h2&gt;
  
  
  Misuse Interpretation
&lt;/h2&gt;

&lt;p&gt;The second part however took sometime, to convert this into a remotely usable exploit it was mandatory to know what users are granted what permissions in the LDAP module which i studied from the link below&lt;/p&gt;

&lt;p&gt;&lt;a href="http://fideloper.com/user-group-permissions-chmod-apache" rel="noopener noreferrer"&gt;http://fideloper.com/user-group-permissions-chmod-apache&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I came to know that users with least of the privileges are able to insert comments in the LDAP queries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploit Flow
&lt;/h2&gt;

&lt;p&gt;So here is the exploit flow i devised in the end.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Admin creates an LDAP query using LDAP editor in the Directory studio module&lt;/li&gt;
&lt;li&gt;Admin allows malicious user to edit comments&lt;/li&gt;
&lt;li&gt;User enters remote execution payload in the comments or the query itself&lt;/li&gt;
&lt;li&gt;Admin exports the excel spreadsheet&lt;/li&gt;
&lt;li&gt;Admins system gets compromised&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I sent this complete report along with the CVE details to Apache team and they timely acted on the issue. However the Internet Bug bounty team considered this an issue but an out of scope as the issue is partially related to Apache Directory Studio not Apache HTTPD server.&lt;/p&gt;

&lt;p&gt;The Bugtraq CVE link is where you would find the official CVE writeup and the patch details about the flaw. Apache assigned the CVE on my behalf that is CVE: 2015–5349&lt;br&gt;
&lt;a href="http://seclists.org/bugtraq/2016/Jan/5" rel="noopener noreferrer"&gt;http://seclists.org/bugtraq/2016/Jan/5&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Credits to Researchers
&lt;/h2&gt;

&lt;p&gt;I believe in giving proper credits to the ones from whom i got bits of knowledge about this flaw.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;I would like to thank Appsec for coming up with the initial exploits for this issue targeted for web applications which helped out alot in the research. &lt;a href="https://hackerone.com/appsec3" rel="noopener noreferrer"&gt;https://hackerone.com/appsec3&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I would also like to thank James Kettle, the author of contextis.com whose article helped me out in devising the proper payloads &lt;a href="http://www.contextis.com/resources/blog/comma-separated-vulnerabilities/" rel="noopener noreferrer"&gt;http://www.contextis.com/resources/blog/comma-separated-vulnerabilities/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And in the end of course all of you lovely people for taking time to read this post. I will soon be doing another posts of my learning break knowledge applied in Cloud testing.&lt;/p&gt;

&lt;p&gt;Follow me for more such content:&lt;br&gt;
LinkedIn: &lt;a href="https://www.linkedin.com/in/basimghouri" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/basimghouri&lt;/a&gt;&lt;br&gt;
Github: &lt;a href="https://github.com/ghourigeeks" rel="noopener noreferrer"&gt;https://github.com/ghourigeeks&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>hacking</category>
      <category>apache</category>
      <category>owasp</category>
    </item>
    <item>
      <title>Security in Laravel: How to Protect Your App Part 4</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Sat, 28 May 2022 21:38:49 +0000</pubDate>
      <link>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-4-20ie</link>
      <guid>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-4-20ie</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Exposed Files&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;By default, Laravel only exposes the public directory. This is intended to avoid security breaches. Considering that any file that will be exposed can be accessed by anyone, you should avoid adding their sensitive data.&lt;/p&gt;

&lt;p&gt;If you want to expose files to download, the best way to do this is by keeping the files on the storage directory and just adding a symbolic link on a public directory. Laravel provides a command to make it easier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan storage:link
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, any file that your app stores in the storage directory will be available. Avoid adding manual permissions to any other directory as this could lead to a potential breach.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>security</category>
      <category>exposefile</category>
    </item>
    <item>
      <title>Security in Laravel: How to Protect Your App Part 3</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Fri, 27 May 2022 23:09:48 +0000</pubDate>
      <link>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-3-24p6</link>
      <guid>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-3-24p6</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Request Origin&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In your application, you can get requests from multiple sites. It could be a webhook, a mobile application, requests from a Javascript project, etc.&lt;/p&gt;

&lt;p&gt;In these cases, we should take a defensive approach. A lot of antiviruses are great examples that a non-trust list simply does not work as we cannot keep updating different origins and sites all the time. In this case, a trust list can be the best approach to only validate some origins.&lt;/p&gt;

&lt;p&gt;In short, a trust list could work if we know the origins that we are going to allow. But what if we do not?&lt;/p&gt;

&lt;p&gt;Maybe an unknown origin could try to send unauthenticated requests. In this case, Laravel once again provides a great tool out of the box. We can use the throttles middleware to protect a route or group of routes from malicious requests. This is one of Laravel's security best practices to consider.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('dashboard', DashboardController::class)    -&amp;gt;middleware('throttle:3,10');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The param:3,10 represents that it allows 3 requests during 10 minutes. At the fourth request, it would throw an error 429 in the browser. If it is a request that has a content-type: application/json and accept: application-json, it would return a response with 429 status and a message with the exception.&lt;/p&gt;

&lt;p&gt;You can go even further and add a RateLimiter on the app/Providers/RouteServiceProvider.php:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;protected function configureRateLimiting() 
{  
    RateLimiter::for('global', function (Request $request) {
        return Limit::perMinute(1000);     
    }); 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in your route file, you can define a route like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('dashboard', DashboardController::class)-&amp;gt;middleware('throttle:global');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to dive deeper into the rate limiter, you can visit this resource. And if you want to get something more robust in terms of a trusts list, here is a great package for adding a white list implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Do Not Trust Sites Without an SSL Certificate&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A site that does not have an SSL certificate should not be allowed. No data should be sent without proper encrypted channels as this could lead to a potential man-in-the-middle attack where your data can be exposed.&lt;/p&gt;

&lt;p&gt;Lastly, do not share session ids or cookies with insecure connections that do not use the HTTPS protocol. Doing so can also expose sensitive data.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>security</category>
      <category>requestorgin</category>
    </item>
    <item>
      <title>Security in Laravel: How to Protect Your App Part 2</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Thu, 26 May 2022 21:32:40 +0000</pubDate>
      <link>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-2-agf</link>
      <guid>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-2-agf</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;XSS Attack&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This attack could be divided into two sections. The first one restricts special tags on the server and does not return special tags in the views.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Restrict Special Tags in the Server&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You could use different approaches. PHP natively has some methods like strip_tags that only protect against HTML and PHP tags. You can even use a regex or use the PHP native method htmlentities() or filter_var both, although it does not protect completely against all the possible tags. In this case, my best recommendation is to use a specific package to solve this, like &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;HTML Purifier.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Does Not Return Special Tags in the Views&lt;br&gt;
If you are working with the Blade template engine, you should take care about how you are printing your data in your template:&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;p&amp;gt;{{ $user-&amp;gt;name }}&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The double mustaches syntax would protect you against XSS attacks by automatically escaping the tags for you.&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;p&amp;gt;{!! $user-&amp;gt;name !!}&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the other hand, this syntax is dangerous. If you do not trust the data that could come, do not use it because the bang-bang syntax could interpret PHP.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Using Another PHP Template Engine&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Laravel also provides an escape method that we use on any other template engine like Twig:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{ e($user-&amp;gt;name) }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Using a Javascript Framework&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Any modern Javascript framework automatically protects us to inject a script. VueJS, for example, has a v-html directive that already protects us against this type of attack.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>security</category>
      <category>xss</category>
    </item>
    <item>
      <title>Security in Laravel: How to Protect Your App Part 1</title>
      <dc:creator>Basim Ghouri</dc:creator>
      <pubDate>Wed, 25 May 2022 20:03:29 +0000</pubDate>
      <link>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-1-2kof</link>
      <guid>https://dev.to/basimghouri/security-in-laravel-how-to-protect-your-app-part-1-2kof</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;SQL Injections&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In plain PHP, we need to bind all the parameters on SQL queries. But in Laravel, we have the query builder and Eloquent ORM that provides automatic protection against SQL injections by adding param binding by default. Even with this, you should watch out for malicious requests, like for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User::query()-&amp;gt;create($request-&amp;gt;all());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code could lead to a mass assignment. In this case, a user can send a payload like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "name": "Basim Ghouri",
    "email": "basim@gmail.com",
    "role_id": "admin" 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another code that could lead to the same issue could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$user-&amp;gt;fill($request-&amp;gt;all());
$user-&amp;gt;save();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are hydrating an eloquent model with all the data from a request and then saving it.&lt;/p&gt;

&lt;p&gt;A malicious user can try with different payloads. Or, they can add extra inputs with different names and try to find a weak implementation like this.&lt;/p&gt;

&lt;p&gt;Hopefully, with this example, we can see that we need to take care of mass assignments. We cannot trust any user request, because any user can open the browser inspector and add an input in a monolith or modify the payload from an API.&lt;/p&gt;

&lt;p&gt;Laravel provides different ways to handle this:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Set Fillable Property&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We can prevent mass assignment by adding explicitly the fields that a model contains by using protected properties, "fillable" or "guarded":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;protected $fillable = ['name', 'email', 'password', 'role_id'];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, we are adding explicitly the columns that a model contains. You can use the guarded property as an empty array. Personally, I do not like this approach as many projects have more than one developer and there is no guaranty that other developers would validate the data.&lt;/p&gt;

&lt;p&gt;The forceFill() method can skip this protection, so take care when you are using this method.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Validate Request Data&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You should validate any type of resource no matter where it came from. The best policy is to not trust the user. Laravel provides FormRequest so we only need to create one with artisan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:request UserRequest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can define the rules to validate your requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function authorize() 
{
    return $this-&amp;gt;user()-&amp;gt;check(); 
} 

public function rules() 
{     
    return [
        'name' =&amp;gt; ['required', 'string', 'min:5', 'max:255'],
        'email' =&amp;gt; ['required', 'email', 'unique:users'],
        'password' =&amp;gt;   ['required', Password::default()]
    ]; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The authorize method must return a boolean. It is a convenient way to return an authorization validation before starting to validate the requested content. This is something to take in mind and it would apply in any route that has the middleware auth for web or sanctum/API if you are using token-based authentication.&lt;/p&gt;

&lt;p&gt;The rules method returns an array with the rules that are validating your request. You can use a lot of rules out of the box or create your own custom rules. If you are interested to dive in deeper into this topic, you can find all the rules in the doc: &lt;a href="https://laravel.com/docs/8.x/validation#available-validation-rules" rel="noopener noreferrer"&gt;https://laravel.com/docs/8.x/validation#available-validation-rules&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>security</category>
      <category>sqlinjection</category>
    </item>
  </channel>
</rss>
