<?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: Shrouk Abozeid</title>
    <description>The latest articles on DEV Community by Shrouk Abozeid (@shroukabozeid).</description>
    <link>https://dev.to/shroukabozeid</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4008684%2Fddf07757-4921-49f6-8aa8-bd77aeda61b0.jpg</url>
      <title>DEV Community: Shrouk Abozeid</title>
      <link>https://dev.to/shroukabozeid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shroukabozeid"/>
    <language>en</language>
    <item>
      <title>Understanding Rack #1 : Notes from Rebuilding Rails by Noah Gibbs</title>
      <dc:creator>Shrouk Abozeid</dc:creator>
      <pubDate>Tue, 30 Jun 2026 15:00:00 +0000</pubDate>
      <link>https://dev.to/shroukabozeid/understanding-rack-1-notes-from-rebuilding-rails-by-noah-gibbs-ma8</link>
      <guid>https://dev.to/shroukabozeid/understanding-rack-1-notes-from-rebuilding-rails-by-noah-gibbs-ma8</guid>
      <description>&lt;h3&gt;
  
  
  What is Rack?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Rack&lt;/strong&gt; is a Ruby gem that acts as a &lt;strong&gt;middleman&lt;/strong&gt; between your Ruby framework (like Rails or Sinatra) and the web server/application server that runs your code.&lt;/p&gt;

&lt;p&gt;Think of it like a translator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser &amp;lt;--&amp;gt; Web Server/App Server &amp;lt;--&amp;gt; Rack &amp;lt;--&amp;gt; Rails App
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a browser sends a request:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The server receives it.&lt;/li&gt;
&lt;li&gt;Rack converts the request into a format Rails understands.&lt;/li&gt;
&lt;li&gt;Rails processes the request and generates a response.&lt;/li&gt;
&lt;li&gt;Rack converts the response back into a format the server can send to the browser.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  What is an application server?
&lt;/h3&gt;

&lt;p&gt;An application server is a program that actually &lt;strong&gt;runs your Ruby application&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Puma&lt;/li&gt;
&lt;li&gt;Thin&lt;/li&gt;
&lt;li&gt;Passenger&lt;/li&gt;
&lt;li&gt;WEBrick&lt;/li&gt;
&lt;li&gt;Unicorn&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These servers execute your Rails code and return the result to users.&lt;/p&gt;




&lt;h3&gt;
  
  
  Development vs Production
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Development (your local machine)
&lt;/h3&gt;

&lt;p&gt;Usually you run only one application server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rails server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rails starts Puma by default.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser &amp;lt;--&amp;gt; Puma &amp;lt;--&amp;gt; Rails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is simple and works well for development.&lt;/p&gt;




&lt;h3&gt;
  
  
  Production (real website)
&lt;/h3&gt;

&lt;p&gt;In production, there is often a dedicated web server in front of the application server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser &amp;lt;--&amp;gt; Nginx/Apache &amp;lt;--&amp;gt; Puma &amp;lt;--&amp;gt; Rails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nginx/Apache can serve static files efficiently.&lt;/li&gt;
&lt;li&gt;They can handle SSL/HTTPS.&lt;/li&gt;
&lt;li&gt;They can distribute traffic to multiple Puma processes.&lt;/li&gt;
&lt;li&gt;They provide better performance and security.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Real-world analogy
&lt;/h3&gt;

&lt;p&gt;Imagine a restaurant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Browser&lt;/strong&gt; = customer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nginx/Apache&lt;/strong&gt; = receptionist&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rack&lt;/strong&gt; = waiter translating orders&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rails app&lt;/strong&gt; = chef&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Puma&lt;/strong&gt; = kitchen where the chef works&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The customer doesn't talk directly to the chef. The request passes through several layers, and Rack helps them communicate using a common language.&lt;/p&gt;

&lt;h3&gt;
  
  
  So in one sentence we can say
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Rack is the standard interface that allows Ruby web servers (Puma, Unicorn, etc.) and Ruby web frameworks (Rails, Sinatra, etc.) to communicate with each other.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>ruby</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
