<?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: Adnan al-emran ontor</title>
    <description>The latest articles on DEV Community by Adnan al-emran ontor (@adnanalemran).</description>
    <link>https://dev.to/adnanalemran</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%2F971730%2F0ef1ecc0-53a7-497e-ab81-5bdd5e91a5b6.jpg</url>
      <title>DEV Community: Adnan al-emran ontor</title>
      <link>https://dev.to/adnanalemran</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adnanalemran"/>
    <language>en</language>
    <item>
      <title>Integrating Scalar API Documentation in ASP.NET Core</title>
      <dc:creator>Adnan al-emran ontor</dc:creator>
      <pubDate>Mon, 16 Mar 2026 07:44:59 +0000</pubDate>
      <link>https://dev.to/adnanalemran/integrating-scalar-api-j59</link>
      <guid>https://dev.to/adnanalemran/integrating-scalar-api-j59</guid>
      <description>&lt;h1&gt;
  
  
  Integrating Scalar API Documentation in ASP.NET Core
&lt;/h1&gt;

&lt;p&gt;Modern APIs require clear and interactive documentation so developers can easily understand and test endpoints. &lt;strong&gt;Scalar&lt;/strong&gt; is a modern API documentation UI built on top of &lt;strong&gt;OpenAPI&lt;/strong&gt;, providing a clean and developer-friendly interface for exploring APIs.&lt;/p&gt;

&lt;p&gt;In this article, we will integrate &lt;strong&gt;Scalar API Documentation&lt;/strong&gt; into an &lt;strong&gt;ASP.NET Core Web API&lt;/strong&gt; project.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Scalar?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Scalar&lt;/strong&gt; is a modern API documentation tool designed for OpenAPI specifications. It allows developers to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explore API endpoints
&lt;/li&gt;
&lt;li&gt;View request and response schemas
&lt;/li&gt;
&lt;li&gt;Test APIs directly from the browser
&lt;/li&gt;
&lt;li&gt;Generate ready-to-use client code examples
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compared to traditional documentation tools, Scalar provides a more modern and intuitive user interface.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1 — Install Scalar
&lt;/h2&gt;

&lt;p&gt;Install the &lt;strong&gt;Scalar.AspNetCore&lt;/strong&gt; NuGet package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package Scalar.AspNetCore &lt;span class="nt"&gt;--version&lt;/span&gt; 2.1.13
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or install it from NuGet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.nuget.org/packages/Scalar.AspNetCore" rel="noopener noreferrer"&gt;https://www.nuget.org/packages/Scalar.AspNetCore&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2 — Configure Services
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;Program.cs&lt;/strong&gt; and register the required services.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddControllers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddEndpointsApiExplorer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Required for OpenAPI generation&lt;/span&gt;
&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddOpenApi&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;AddControllers()&lt;/code&gt; enables controller-based APIs
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AddEndpointsApiExplorer()&lt;/code&gt; generates API metadata
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AddOpenApi()&lt;/code&gt; generates the OpenAPI specification used by Scalar
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 3 — Configure the HTTP Pipeline
&lt;/h2&gt;

&lt;p&gt;Add Scalar and OpenAPI to the request pipeline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;IsDevelopment&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;MapOpenApi&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;MapScalarApiReference&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;options&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithTitle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ServerSide API"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithDefaultHttpClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ScalarTarget&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CSharp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ScalarClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HttpClient&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="c1"&gt;// Redirect root URL to Scalar documentation&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;MapGet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/scalar/v1"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ExcludeFromDescription&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What this configuration does
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;MapOpenApi()&lt;/code&gt; exposes the OpenAPI JSON document
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;MapScalarApiReference()&lt;/code&gt; enables the Scalar documentation UI
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WithTitle()&lt;/code&gt; sets the API documentation title
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WithDefaultHttpClient()&lt;/code&gt; generates C# HttpClient examples
&lt;/li&gt;
&lt;li&gt;The root URL automatically redirects to the documentation page
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 4 — Run the Application
&lt;/h2&gt;

&lt;p&gt;Run the ASP.NET Core project and open the documentation in your browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost:5000/scalar/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://localhost:5001/scalar/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will see the interactive Scalar API documentation interface.&lt;/p&gt;




&lt;h2&gt;
  
  
  Benefits of Using Scalar
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Modern API documentation interface
&lt;/li&gt;
&lt;li&gt;Built-in API testing
&lt;/li&gt;
&lt;li&gt;Automatic OpenAPI integration
&lt;/li&gt;
&lt;li&gt;Code examples for multiple programming languages
&lt;/li&gt;
&lt;li&gt;Easy integration with ASP.NET Core
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Integrating &lt;strong&gt;Scalar API documentation&lt;/strong&gt; into an ASP.NET Core project is simple and significantly improves the developer experience. With only a few lines of configuration, you can provide a powerful and interactive API documentation interface.&lt;/p&gt;

&lt;p&gt;Scalar helps developers understand and test APIs more efficiently.&lt;/p&gt;




&lt;h2&gt;
  
  
  Author
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Adnan Al Emran&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Software Engineer  &lt;/p&gt;

&lt;p&gt;GitHub&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/adnanalemran" rel="noopener noreferrer"&gt;https://github.com/adnanalemran&lt;/a&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>csharp</category>
      <category>dotnet</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Software Architecture: The Foundation of Great Software</title>
      <dc:creator>Adnan al-emran ontor</dc:creator>
      <pubDate>Wed, 04 Dec 2024 05:16:15 +0000</pubDate>
      <link>https://dev.to/adnanalemran/software-architecture-the-foundation-of-great-software-4ihm</link>
      <guid>https://dev.to/adnanalemran/software-architecture-the-foundation-of-great-software-4ihm</guid>
      <description>&lt;p&gt;When you build a house, you need a solid blueprint to ensure it stands strong and functions well. Software is no different. Software architecture is the blueprint that defines how a system is structured, how its parts work together, and how it can grow over time. It’s what makes software reliable, scalable, and maintainable. Without it, even the most well-written code can crumble under pressure.&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%2Fo7dhbf1kurxgqagylzur.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%2Fo7dhbf1kurxgqagylzur.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Exactly is Software Architecture?&lt;/strong&gt;&lt;br&gt;
At its core, software architecture is about making big-picture decisions. It answers questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How will different parts of the system communicate?&lt;/li&gt;
&lt;li&gt;Which technologies will we use?&lt;/li&gt;
&lt;li&gt;How will we handle future changes and scaling?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good architecture doesn’t just focus on the technical stuff. It also considers user needs, business goals, and practical constraints like deadlines and budgets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Parts of Software Architecture&lt;/strong&gt;&lt;br&gt;
Architectural Patterns&lt;/p&gt;

&lt;p&gt;Think of these as tried-and-tested recipes for building systems. Some common patterns include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monolithic: Everything in one big block (simple but hard to scale).&lt;/li&gt;
&lt;li&gt;Microservices: Breaking the system into small, independent parts (complex but flexible).&lt;/li&gt;
&lt;li&gt;Event-Driven: Components talk to each other using events (great for real-time systems).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;System Components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Any software system usually has these pieces:_&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend: What the user interacts with (like a website or app).&lt;/li&gt;
&lt;li&gt;Backend: The engine that processes requests and handles data.&lt;/li&gt;
&lt;li&gt;Database: Where all the data lives.&lt;/li&gt;
&lt;li&gt;APIs: Bridges that let different parts of the system talk to each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Design Principles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A good architecture follows principles like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep it simple: Don’t overcomplicate things.&lt;/li&gt;
&lt;li&gt;Separation of concerns: Each part should focus on one task.&lt;/li&gt;
&lt;li&gt;Flexibility: Make it easy to add new features or fix bugs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Does Software Architecture Matter?&lt;/strong&gt;&lt;br&gt;
Here’s why you need good architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability: As more users join, your system needs to handle the load.&lt;/li&gt;
&lt;li&gt;Maintainability: Easy-to-understand architecture saves time when fixing bugs or adding features.&lt;/li&gt;
&lt;li&gt;Performance: A well-thought-out design ensures speed and reliability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best Practices for Software Architecture&lt;/strong&gt;&lt;br&gt;
Start Simple&lt;/p&gt;

&lt;p&gt;Don’t over-engineer. Build what you need now but leave room for future growth.&lt;/p&gt;

&lt;p&gt;Think About the Future&lt;/p&gt;

&lt;p&gt;Plan for features and changes your system might need in a year or two.&lt;/p&gt;

&lt;p&gt;Document Everything&lt;/p&gt;

&lt;p&gt;Diagrams and notes help your team understand the architecture and avoid confusion later.&lt;/p&gt;

&lt;p&gt;Test Early and Often&lt;/p&gt;

&lt;p&gt;Regular testing ensures your architecture holds up under real-world conditions.&lt;/p&gt;

&lt;p&gt;Focus on Security&lt;/p&gt;

&lt;p&gt;Build protections like encryption and authentication into your system from the start.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Architect’s Role&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A software architect is like the captain of a ship. They make the big decisions, keep the project on course, and ensure everyone on the team is aligned. They don’t write every line of code, but their guidance is crucial for success.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Popular Software Architecture Styles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When it comes to building software, choosing the right architecture is like choosing the right foundation for a house. Each architecture has its strengths and trade-offs, so picking the right one depends on your needs. Let’s break down some of the most common styles:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Monolithic Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the “all-in-one” approach, where every feature and function is packaged into a single codebase.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to develop and deploy initially.&lt;/li&gt;
&lt;li&gt;Simple debugging since everything is in one place.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hard to scale as the app grows.&lt;/li&gt;
&lt;li&gt;Even small changes require redeploying the whole system.&lt;/li&gt;
&lt;li&gt;Best for: Small applications or MVPs where speed is more important than scalability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Two-Tier Architecture&lt;/strong&gt;&lt;br&gt;
Two-tier architecture separates the system into two main layers: the client and the server. The client handles the user interface, while the server manages data and business logic.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clear separation of concerns between frontend and backend.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easier to maintain than monolithic systems.&lt;br&gt;
Cons:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Limited scalability for complex or large applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Best for: Simple applications that don’t require extensive scaling.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. N-Tier Architecture&lt;/strong&gt;&lt;br&gt;
Think of this as the upgraded version of two-tier architecture. It adds more layers, like a presentation layer, a business logic layer, and a data access layer.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better organization and modularity.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easier to scale and maintain compared to two-tier systems.&lt;br&gt;
Cons:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More complex to design and implement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can introduce latency if layers are too tightly connected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Best for: Large, enterprise-level systems that need to handle high traffic and frequent updates.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Modular Monolithic Architecture&lt;/strong&gt;&lt;br&gt;
This is like monolithic architecture but with better organization. The application is split into distinct modules that handle specific tasks, while still being part of the same codebase.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easier to maintain and update compared to traditional monoliths.&lt;/li&gt;
&lt;li&gt;Retains the simplicity of a single deployment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability is still limited.&lt;/li&gt;
&lt;li&gt;Modules remain tightly coupled in some areas.&lt;/li&gt;
&lt;li&gt;Best for: Medium-sized applications where you want structure without the complexity of microservices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Microservices Architecture&lt;/strong&gt;&lt;br&gt;
This is the “divide and conquer” approach. Instead of one big system, you build multiple small, independent services that communicate through APIs.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each service can be developed, deployed, and scaled independently.&lt;/li&gt;
&lt;li&gt;Fault isolation: If one service goes down, the rest can keep running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More complex to manage because there are many moving parts.&lt;/li&gt;
&lt;li&gt;Requires advanced tools for orchestration and monitoring.&lt;/li&gt;
&lt;li&gt;Best for: Large systems with diverse features that need high flexibility and scalability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Event-Driven Architecture&lt;/strong&gt;&lt;br&gt;
In this approach, components communicate by sending and receiving events. It’s like a messaging system where different parts of the system only react when something important happens.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Real-time responsiveness and high decoupling.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easily scalable and flexible.&lt;br&gt;
Cons:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Debugging can be tricky due to asynchronous communication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Requires careful planning of event flows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Best for: Real-time applications, like stock trading platforms or IoT systems.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. Cloud-Native Architecture&lt;/strong&gt;&lt;br&gt;
Built specifically for the cloud, this architecture uses containers, microservices, and CI/CD pipelines to maximize flexibility and scalability.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scales easily to meet demand.&lt;/li&gt;
&lt;li&gt;Enables faster deployment and iteration cycles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires expertise in cloud technologies.&lt;/li&gt;
&lt;li&gt;Costs can add up if not managed properly.&lt;/li&gt;
&lt;li&gt;Best for: Applications with global reach or fluctuating workloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8. Serverless Architecture&lt;/strong&gt;&lt;br&gt;
This is the ultimate “hands-off” approach. Developers write code, and the cloud provider handles all the infrastructure behind the scenes.&lt;/p&gt;

&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No need to manage servers or scale resources manually.&lt;/li&gt;
&lt;li&gt;Pay only for what you use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Limited control over infrastructure.&lt;/li&gt;
&lt;li&gt;Vendor lock-in is a potential concern.
Best for: Event-driven systems or applications with unpredictable traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Choosing the Right Architecture&lt;/strong&gt;&lt;br&gt;
There’s no one-size-fits-all solution. A monolithic architecture might be perfect for your small startup, while an event-driven or cloud-native approach might be better for a fast-growing enterprise. The key is to match the architecture to your project’s size, goals, and team expertise.&lt;/p&gt;

&lt;p&gt;Good architecture is about building something that doesn’t just work today but continues to perform well as your needs grow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s Next in Software Architecture?&lt;/strong&gt;&lt;br&gt;
Technology never stands still, and neither does architecture. Here are some trends shaping the future:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serverless Computing: Let cloud providers handle your infrastructure.&lt;/li&gt;
&lt;li&gt;AI-Driven Architecture: Use artificial intelligence to optimize your system’s design.&lt;/li&gt;
&lt;li&gt;Edge Computing: Process data closer to where it’s generated for faster responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Wrapping Up&lt;/strong&gt;&lt;br&gt;
Software architecture isn’t just about building software — it’s about building software that lasts. It’s the invisible framework that ensures everything works smoothly, scales easily, and adapts to new challenges. Whether you’re designing a simple app or a complex system, investing time in good architecture is always worth it. After all, great software starts with a solid foundation.&lt;/p&gt;

</description>
      <category>softwaredevelopment</category>
      <category>architecture</category>
      <category>softwareengineering</category>
      <category>software</category>
    </item>
    <item>
      <title>Linux File Permissions Cheat Sheet</title>
      <dc:creator>Adnan al-emran ontor</dc:creator>
      <pubDate>Sun, 17 Nov 2024 01:01:14 +0000</pubDate>
      <link>https://dev.to/adnanalemran/linux-file-permissions-cheat-sheet-1671</link>
      <guid>https://dev.to/adnanalemran/linux-file-permissions-cheat-sheet-1671</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;What Are File Permissions?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Linux file permissions control &lt;strong&gt;who can read, write, or execute&lt;/strong&gt; a file or directory. They are set for three user groups:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Owner&lt;/strong&gt;: The file creator.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Group&lt;/strong&gt;: A user group that can access the file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Others&lt;/strong&gt;: All other users.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Viewing File Permissions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Use the &lt;code&gt;ls -l&lt;/code&gt; command to display file permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example Output&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;
&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;rwxr&lt;/span&gt;&lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;xr&lt;/span&gt;&lt;span class="p"&gt;--&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="k"&gt;group&lt;/span&gt; &lt;span class="m"&gt;1234&lt;/span&gt; &lt;span class="n"&gt;Nov&lt;/span&gt; &lt;span class="m"&gt;16&lt;/span&gt; &lt;span class="m"&gt;14&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;00&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;txt&lt;/span&gt;

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

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Part&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-rwxr-xr--&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Permissions (explained below).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Number of hard links.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;user&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Owner of the file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;group&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Group associated with the file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;1234&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;File size in bytes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Nov 16 14:00&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Last modification date.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;file.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;File name.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Permission Breakdown&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Each permission has three parts:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[Type][Owner][Group][Others]&lt;/code&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Symbol&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Type/Permission&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Regular file.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;d&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Directory.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read permission.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;w&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Write permission.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;x&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Execute permission (or enter a folder).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Changing File Permissions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Using &lt;code&gt;chmod&lt;/code&gt; (Symbolic Mode)&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;permissions] &lt;span class="o"&gt;[&lt;/span&gt;file]

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


&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Add execute permission to the owner:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;u+x file.txt

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


&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Symbol&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Meaning&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;u&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;User (owner).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;g&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Group.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;o&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Others.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;a&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;All (user, group, others).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Symbol&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Action&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Add permission.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remove permission.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;=&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Set exact permission.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Remove write permission for others:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;o-w file.txt

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

&lt;/li&gt;
&lt;/ol&gt;




&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Using &lt;code&gt;chmod&lt;/code&gt; (Numeric Mode)&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Each permission level is represented by a number:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Permission&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;r&lt;/code&gt; (read)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;w&lt;/code&gt; (write)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;x&lt;/code&gt; (execute)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;-&lt;/code&gt; (none)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Combine values to set permissions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Owner (u)&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Group (g)&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Others (o)&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Command&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;rwx&lt;/code&gt; (7)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;r-x&lt;/code&gt; (5)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;r--&lt;/code&gt; (4)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;chmod 754 file.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Changing Ownership&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Change file owner&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chown&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;owner] &lt;span class="o"&gt;[&lt;/span&gt;file]

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


&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;sudo chown &lt;/span&gt;user file.txt

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

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Change group&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chown&lt;/span&gt; :[group] &lt;span class="o"&gt;[&lt;/span&gt;file]

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


&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;sudo chown&lt;/span&gt; :staff file.txt

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

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Change both owner and group&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chown&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;owner]:[group] &lt;span class="o"&gt;[&lt;/span&gt;file]

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


&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;sudo chown &lt;/span&gt;user:staff file.txt

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

&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Recursive Changes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To apply changes to all files and directories:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Change permissions recursively&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;permissions] &lt;span class="o"&gt;[&lt;/span&gt;directory]

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


&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; 755 /path/to/folder

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

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Change ownership recursively&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;owner]:[group] &lt;span class="o"&gt;[&lt;/span&gt;directory]

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


&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; user:staff /path/to/folder

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

&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Testing Permissions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create a test file or directory to practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;touch &lt;/span&gt;test.txt
&lt;span class="nb"&gt;chmod &lt;/span&gt;600 test.txt  &lt;span class="c"&gt;# Owner can read/write, others denied.&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;755 test.txt  &lt;span class="c"&gt;# Everyone can read, owner can write.&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; 770 /test  &lt;span class="c"&gt;# Owner/group full access, others denied.&lt;/span&gt;

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>AWK Cheat Sheet</title>
      <dc:creator>Adnan al-emran ontor</dc:creator>
      <pubDate>Sun, 17 Nov 2024 00:53:00 +0000</pubDate>
      <link>https://dev.to/adnanalemran/awk-cheat-sheet-1gm</link>
      <guid>https://dev.to/adnanalemran/awk-cheat-sheet-1gm</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;What is AWK?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;awk&lt;/code&gt; is a powerful text-processing tool in Linux used to manipulate and analyze text files by processing patterns and performing actions.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Basic Syntax&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'pattern {action}'&lt;/span&gt; file

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;pattern&lt;/code&gt;&lt;/strong&gt;: The condition to match (optional).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;action&lt;/code&gt;&lt;/strong&gt;: Commands to execute on matching lines (optional).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;file&lt;/code&gt;&lt;/strong&gt;: The file to process.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Common Examples&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Print All Lines&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print}'&lt;/span&gt; file.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Outputs all lines in &lt;code&gt;file.txt&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Print Specific Columns&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $1, $3}'&lt;/span&gt; file.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Prints the 1st and 3rd columns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Match a Pattern&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'/error/ {print}'&lt;/span&gt; log.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Prints lines containing the word &lt;code&gt;error&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Conditional Filtering&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'$3 &amp;gt; 100 {print $1, $3}'&lt;/span&gt; data.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Prints rows where the 3rd column is greater than 100.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5. Add or Modify Columns&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $1, $2, $2 + $3}'&lt;/span&gt; data.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Adds a column with the sum of the 2nd and 3rd columns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;6. Count Matching Lines&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'/pattern/ {count++} END {print count}'&lt;/span&gt; file.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Counts and prints lines matching &lt;code&gt;pattern&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;7. Format Output&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{printf "Name: %s, Age: %d\n", $1, $2}'&lt;/span&gt; names.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Formats and prints fields with a custom output.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;8. Use Field Separator&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-F&lt;/span&gt; &lt;span class="s1"&gt;':'&lt;/span&gt; &lt;span class="s1"&gt;'{print $1, $NF}'&lt;/span&gt; /etc/passwd

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Uses &lt;code&gt;:&lt;/code&gt; as a separator and prints the 1st and last columns.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Key Concepts&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Symbol&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Meaning&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Represents the 1st, 2nd columns (fields).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NR&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Line number (e.g., &lt;code&gt;NR == 5&lt;/code&gt; matches line 5).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NF&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Total number of fields in a line.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FS&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Field Separator (&lt;code&gt;-F&lt;/code&gt; or &lt;code&gt;FS=","&lt;/code&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;BEGIN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Executes before processing lines.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;END&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Executes after processing all lines.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Advanced Examples&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Print Line Numbers&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print NR, $0}'&lt;/span&gt; file.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Prints line numbers alongside the content.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Find Maximum in a Column&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'$3 &amp;gt; max {max = $3} END {print max}'&lt;/span&gt; data.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finds and prints the maximum value in the 3rd column.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Sum a Column&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{sum += $3} END {print sum}'&lt;/span&gt; data.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Sums up all values in the 3rd column.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Filter by Field Count&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'NF == 3 {print}'&lt;/span&gt; file.txt

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Prints lines with exactly 3 fields.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Practice Data&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create a &lt;code&gt;sample.txt&lt;/code&gt; to test commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
John 25 500
Mary 30 600
Alex 28 450

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;Tips&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Test commands with &lt;code&gt;awk&lt;/code&gt; on small files before applying to large ones.&lt;/li&gt;
&lt;li&gt;Combine with other commands like &lt;code&gt;grep&lt;/code&gt; or &lt;code&gt;sed&lt;/code&gt; for complex workflows.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Multi language in react i18next (easy example)</title>
      <dc:creator>Adnan al-emran ontor</dc:creator>
      <pubDate>Wed, 13 Nov 2024 19:03:03 +0000</pubDate>
      <link>https://dev.to/adnanalemran/multi-language-in-react-i18next-easy-example-1k3n</link>
      <guid>https://dev.to/adnanalemran/multi-language-in-react-i18next-easy-example-1k3n</guid>
      <description>&lt;h3&gt;
  
  
  Step 1: Install Required Dependencies
&lt;/h3&gt;

&lt;p&gt;First, install the required packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;react-i18next i18next i18next-http-backend

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

&lt;/div&gt;



&lt;p&gt;This will install &lt;code&gt;react-i18next&lt;/code&gt; for React integration, &lt;code&gt;i18next&lt;/code&gt; for managing translations, and &lt;code&gt;i18next-http-backend&lt;/code&gt; to load JSON translation files from the server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Set Up Translation Files
&lt;/h3&gt;

&lt;p&gt;Create translation JSON files for each language in the &lt;code&gt;public&lt;/code&gt; folder of your React project.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
/public
  /locales
    /en
      home.json
      about.json
    /bn
      home.json
      about.json
    /th
      home.json
      about.json

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

&lt;/div&gt;



&lt;p&gt;Each language folder contains JSON files for each page (home, about, etc.). You can add more languages or pages as needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of &lt;code&gt;/locales/en/home.json&lt;/code&gt;:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"welcome"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Welcome to our website"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"slogan"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CONNECT, SHARE, GROW - ALL IN ONE TAP"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example of &lt;code&gt;/locales/en/about.json&lt;/code&gt;:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"aboutTitle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"About Us"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"aboutDescription"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"We are a company dedicated to growth and innovation."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

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

&lt;/div&gt;



&lt;p&gt;Similarly, add the corresponding files for other languages (&lt;code&gt;bn&lt;/code&gt;, &lt;code&gt;th&lt;/code&gt;, etc.).&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Initialize i18n
&lt;/h3&gt;

&lt;p&gt;Create an &lt;code&gt;i18n.js&lt;/code&gt; file to configure &lt;code&gt;i18next&lt;/code&gt; with the backend loader and set up the languages and namespaces.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;/src/i18n.js&lt;/code&gt;:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;i18next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;initReactI18next&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;HttpBackend&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;i18next-http-backend&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;i18n&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HttpBackend&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Enables loading JSON files&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initReactI18next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// Initializes react-i18next&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;fallbackLng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Default language if not set&lt;/span&gt;
    &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;loadPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/locales/{{lng}}/{{ns}}.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Load path pattern for the JSON files&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;ns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;home&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;about&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;// Define namespaces for each page&lt;/span&gt;
    &lt;span class="na"&gt;defaultNS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;home&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Default namespace&lt;/span&gt;
    &lt;span class="na"&gt;interpolation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;escapeValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Disable escaping for simplicity&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;loadPath&lt;/code&gt; specifies where to fetch the translation files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ns&lt;/code&gt; defines the namespaces, which are the translation files like &lt;code&gt;home.json&lt;/code&gt;, &lt;code&gt;about.json&lt;/code&gt;, etc.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;defaultNS&lt;/code&gt; is the default namespace used for missing keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 4: Load Translations in Components
&lt;/h3&gt;

&lt;p&gt;Use the &lt;code&gt;useTranslation&lt;/code&gt; hook to load translations in different components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of &lt;code&gt;Header.js&lt;/code&gt; Component:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useTranslation&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;home&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Use 'home' namespace&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changeLanguage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;selectedLanguage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selectedLanguage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;language&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;selectedLanguage&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// Store selected language in localStorage&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Language change error:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;savedLanguage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;language&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Load saved language&lt;/span&gt;
        &lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;savedLanguage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Language load error:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"navbar container mx-auto"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"navbar-start"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Link&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"font-queensides text-3xl text-primary font-bold"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                            Card&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'text-5xl text-secondary'&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;X.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;br&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
                            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'relative bottom-3 text-[8px]'&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                                &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;slogan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Use translation key */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
                            &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Link&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

                &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"navbar-end flex gap-8 font-poppins"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;select&lt;/span&gt;
                        &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;changeLanguage&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
                        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
                        &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"p-1 border rounded-md bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"&lt;/span&gt;
                    &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;🇺🇸 English&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bn"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;🇧🇩 বাংলা&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"th"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;🇹🇭 Thai&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;select&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

                    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Link&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-sm text-black whitespace-nowrap"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;contactUs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Link&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;useTranslation('home')&lt;/code&gt; loads the &lt;code&gt;home.json&lt;/code&gt; file. For the "about" page, you would use &lt;code&gt;useTranslation('about')&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: Use Translations in Other Pages
&lt;/h3&gt;

&lt;p&gt;Similarly, use the &lt;code&gt;useTranslation&lt;/code&gt; hook in other components and pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of &lt;code&gt;About.js&lt;/code&gt; Component:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useTranslation&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;About&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;about&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Use 'about' namespace&lt;/span&gt;

    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;aboutTitle&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;aboutDescription&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;About&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Update &lt;code&gt;App.js&lt;/code&gt; or Routes
&lt;/h3&gt;

&lt;p&gt;Ensure that your routes are set up properly to render different components and load translations based on the selected language.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BrowserRouter&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Route&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Routes&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Header&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;About&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./About&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Routes&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Route&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt; &lt;span class="na"&gt;element&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Home&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Route&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt; &lt;span class="na"&gt;element&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;About&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Routes&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 7: Test the Language Switch
&lt;/h3&gt;

&lt;p&gt;Now, you should be able to switch languages using the dropdown in the &lt;code&gt;Header&lt;/code&gt;, and the translations should be updated accordingly across your pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Directory Structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
/src
  /components
    Header.js
    About.js
  i18n.js
/App.js

/public
  /locales
    /en
      home.json
      about.json
    /bn
      home.json
      about.json
    /th
      home.json
      about.json

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Namespaces&lt;/strong&gt; are used to organize translations per page or component (e.g., &lt;code&gt;home.json&lt;/code&gt;, &lt;code&gt;about.json&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;useTranslation&lt;/code&gt;&lt;/strong&gt; hook loads translations based on the current namespace.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;i18next-http-backend&lt;/code&gt;&lt;/strong&gt; plugin loads JSON files from the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LocalStorage&lt;/strong&gt; helps persist the selected language across sessions.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to Set Up GitHub with SSH Keys on Windows 10 or 11</title>
      <dc:creator>Adnan al-emran ontor</dc:creator>
      <pubDate>Fri, 08 Nov 2024 07:53:27 +0000</pubDate>
      <link>https://dev.to/adnanalemran/title-setting-up-github-with-ssh-keys-on-windows-10-539a</link>
      <guid>https://dev.to/adnanalemran/title-setting-up-github-with-ssh-keys-on-windows-10-539a</guid>
      <description>&lt;h2&gt;
  
  
  Why Use RSA with SSH Keys?
&lt;/h2&gt;

&lt;p&gt;RSA (Rivest-Shamir-Adleman) encryption is one of the most widely supported algorithms for SSH keys. It provides a balance between strong security and compatibility, making it ideal for authenticating with services like GitHub.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Guide&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Generate an SSH Key
To generate an RSA SSH key with your email as a comment, follow these steps:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open Command Prompt or PowerShell on Windows 10.&lt;/p&gt;

&lt;p&gt;Type the following command to create a new SSH key using RSA encryption:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh-keygen -o -t rsa -C "youremail@email.com"&lt;/code&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%2Fblvgu1fjmz11xv8hvh1b.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%2Fblvgu1fjmz11xv8hvh1b.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When prompted to specify a location to save the key, press Enter to use the default directory (C:\Users\YourUsername.ssh\id_rsa).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Press Enter (no passphrase needed).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;like : &lt;br&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%2Fy6mmpsurqvb7g05t501q.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%2Fy6mmpsurqvb7g05t501q.png" alt="Image description" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Access the SSH Key
Navigate to the .ssh folder located in:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;C:\Users\YourUsername.ssh\&lt;/p&gt;

&lt;p&gt;like :&lt;br&gt;&lt;br&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%2Fbeyotm9u3gfhjygscm3c.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%2Fbeyotm9u3gfhjygscm3c.png" alt="Image description" width="774" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the id_rsa.pub file with Notepad and copy the public key.&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%2Fq9own6aro8z6amscza55.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%2Fq9own6aro8z6amscza55.png" alt="Image description" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the SSH Key to GitHub
Now, you need to add the SSH public key to your GitHub account.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Go to your GitHub profile.&lt;/p&gt;

&lt;p&gt;Navigate to Settings &amp;gt; SSH and GPG keys.&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%2F6u0hg1cd8gtyoenvcgzr.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%2F6u0hg1cd8gtyoenvcgzr.png" alt="Image description" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Click New SSH Key.&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%2Fnlfu88qsj2byl1p5w5cr.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%2Fnlfu88qsj2byl1p5w5cr.png" alt="Image description" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Paste the SSH public key in the "Key" field and give it a meaningful title.&lt;br&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%2Fbcyog3k08uc0xte9crc1.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%2Fbcyog3k08uc0xte9crc1.png" alt="Image description" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Add SSH key, and you're done! &lt;br&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%2Fbwmezu2ck23k73l2vbue.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%2Fbwmezu2ck23k73l2vbue.png" alt="Image description" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;use SSH  : &lt;br&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%2F40stge9nzkiiyk8ee3qn.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%2F40stge9nzkiiyk8ee3qn.png" alt="Image description" width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>git</category>
      <category>ssh</category>
      <category>github</category>
    </item>
    <item>
      <title>Understanding Constraints for Designing a REST API</title>
      <dc:creator>Adnan al-emran ontor</dc:creator>
      <pubDate>Tue, 08 Oct 2024 05:46:39 +0000</pubDate>
      <link>https://dev.to/adnanalemran/test-4hng</link>
      <guid>https://dev.to/adnanalemran/test-4hng</guid>
      <description>&lt;p&gt;In the world of web development, REST (Representational State Transfer) has become a dominant architectural style for building APIs. A well-designed REST API is not just about functionality but also about adhering to specific principles and constraints that ensure scalability, maintainability, and usability. Let’s dive into the essential constraints that guide RESTful API design.&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%2Fx83xmdo7icg40brw57ge.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%2Fx83xmdo7icg40brw57ge.png" alt="Image description" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Client-Server Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the fundamental principles of REST is the separation of concerns between the client and server. The server handles the backend logic, data storage, and resource management, while the client interacts with these resources through a well-defined interface. This decoupling allows the two to evolve independently, enabling flexibility and scalability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Statelessness&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In a RESTful system, each request from the client must contain all the information necessary to process it. The server does not store any state information about the client session. This stateless nature simplifies server design and improves scalability, as any server can handle any request without relying on session data.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;GET /users/123&lt;br&gt;
Authorization: Bearer &amp;lt;token&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The request includes all the information (like authentication) required for processing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Uniform Interface&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A consistent and uniform interface is a cornerstone of REST. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resource Identification: Resources are identified through URIs (e.g., /users/123).&lt;/li&gt;
&lt;li&gt;Standard HTTP Methods: Use verbs like GET (read), POST (create), PUT (update), and DELETE (remove).&lt;/li&gt;
&lt;li&gt;Consistent Responses: Provide responses in a predictable format, such as JSON, across all endpoints.
This uniformity makes APIs easier to understand and use, even for developers unfamiliar with them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Cacheability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To enhance performance, REST APIs should allow caching of responses wherever possible. Responses must include appropriate HTTP headers to indicate their cacheability, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cache-Control: max-age=3600 (caches the resource for 1 hour).&lt;/li&gt;
&lt;li&gt;ETag: "unique-resource-id" (validates the resource's freshness).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Layered System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RESTful architecture is designed to support a layered system. Clients should not know whether they are interacting with the actual server or an intermediary like a load balancer or cache. This abstraction enhances security, scalability, and flexibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Code on Demand (Optional)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While optional, REST allows servers to extend client functionality by transferring executable code, such as JavaScript, to the client. This is rarely used in practice but can be helpful for dynamic applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Resource and Representation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In REST, resources are the key entities, represented as nouns rather than verbs. Each resource can have multiple representations, such as JSON, XML, or HTML. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A user resource might be accessed via /users/123.&lt;/li&gt;
&lt;li&gt;The client can request the resource in JSON (Accept: application/json) or XML (Accept: application/xml).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8. Stateless Authentication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Statelessness extends to authentication. Token-based mechanisms like JWT (JSON Web Tokens) are commonly used. These tokens, included in every request, eliminate the need for server-side session management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Pagination, Sorting, and Filtering&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For APIs dealing with large datasets, pagination and filtering are essential for performance and usability. Example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;GET /users?page=2&amp;amp;limit=10&amp;amp;sort=name&amp;amp;filter=active&lt;/code&gt;&lt;br&gt;
This query retrieves the second page of active users, sorted by name, with 10 results per page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Versioning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;APIs evolve over time, and breaking changes are sometimes unavoidable. Versioning ensures backward compatibility. Common approaches include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;URI versioning: /v1/users.&lt;/li&gt;
&lt;li&gt;Header versioning: Accept: application/vnd.api+json; version=1.0.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;11. Error Handling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A well-designed API provides clear and consistent error messages. For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
  "error": {&lt;br&gt;
    "code": 404,&lt;br&gt;
    "message": "Resource not found."&lt;br&gt;
  }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Standard HTTP status codes like 400 Bad Request, 401 Unauthorized, and 500 Internal Server Error should be used.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rate Limiting
To prevent abuse and ensure availability, REST APIs should implement rate limiting. This can be communicated to clients through headers:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;X-RateLimit-Limit: 100&lt;/li&gt;
&lt;li&gt;X-RateLimit-Remaining: 50&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;12. Security&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Security is critical in any API design. Best practices include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using HTTPS for encrypted communication.&lt;/li&gt;
&lt;li&gt;Implementing token-based authentication (e.g., JWT, OAuth).&lt;/li&gt;
&lt;li&gt;Validating and sanitizing inputs to prevent injection attacks.&lt;/li&gt;
&lt;li&gt;Avoiding sensitive information (e.g., passwords) in responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Designing a RESTful API is not just about making endpoints functional; it’s about adhering to constraints that ensure the system is robust, scalable, and user-friendly. By following these principles, you can build APIs that are not only efficient but also a pleasure for developers to work with. Whether you’re building a simple application or a complex system, these constraints will guide you toward a better design.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
