<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Satyam Sharma on Medium]]></title>
        <description><![CDATA[Stories by Satyam Sharma on Medium]]></description>
        <link>https://medium.com/@satyamsharma21689?source=rss-ca61f6dd55fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qF1rxhSwxnlcYbvDzTAzXQ.jpeg</url>
            <title>Stories by Satyam Sharma on Medium</title>
            <link>https://medium.com/@satyamsharma21689?source=rss-ca61f6dd55fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:54:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@satyamsharma21689/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Http on big picture]]></title>
            <link>https://medium.com/@satyamsharma21689/understanding-http-on-big-picture-633f10fac613?source=rss-ca61f6dd55fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/633f10fac613</guid>
            <dc:creator><![CDATA[Satyam Sharma]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 19:36:16 GMT</pubDate>
            <atom:updated>2026-07-01T19:36:16.477Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*xl2qcAvOUVpJxrbholsunw.jpeg" /></figure><p>Http stands for hyper text transfer protocol, It is a medium through which your browser(client) talks to the server.</p><p>The 2 main ideas which are heart of http protocol:</p><ol><li>Stateless (No memory of past interactions, that’s why we use state management techniques such as cookies and tokens for process like user login etc)</li><li>Client-Server Model (there is a client typically(web browser) and a server performs a request and server responds with a response in form of json, image etc)</li></ol><p>(Http and Https are interchangeable as they are on same base principle meanwhile https is more secure with features like encryption and security certificates i.e. ssl or tls)</p><p>Behind the scene to establish connection between the client and server http uses TCP(transmission control protocol) a connection based secure protocol(It doesn’t used User datagram protocol ,as it is a connectionless protocol as it’s not a reliable).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iamhLUYRePe4av4VTSPrBg.png" /></figure><p>Evolution of http:-</p><p>a) HTTP/0.9 : Basic web pages</p><p>b) HTTP/1.0 : included Headers, status codes, multimedia.</p><p>c) HTTP/1.1 : included Persistent connections, caching.</p><p>d) HTTP/2 : included multiplexing,header compression.</p><p>e) HTTP/3 : included QUIC transport, lower latency, better reliability.</p><p>Http Message: It is the unit of communication exchanged between a client and a server, there are 2 types of http message:</p><p>a) Http request: sent by client to request a resource.</p><p>b) Http response: sent by server to return the requested resource or an error.</p><p>Why do we need HTTP header? HTTP headers are used to transmit metadata between the client and server, providing information such as content type, authentication, caching, compression, cookies, and other instructions needed to correctly process HTTP requests and responses.</p><p>Types of HTTP headers:</p><p>a) General Headers: applied to both requests and responses ; provide general information about the message. e.g. Date, Connection, Cache-Control, Via .</p><p>b) Request Headers: sent by client to provide the information about the request or the client. e.g. Host, User-Agent, Accept, Authorization, Cookie, Referer .</p><p>c) Response Headers: Sent by the server to provide information about the response or server. e.g. Server, Set-Cookie, Location, WWW-Authenticate.</p><p>d) Entity/Representative Headers: Describe the content (message body) being transferred in either a request or response. e.g. Content-Type, Content-Length, Content-Encoding, Content-Language, Last-Modified</p><p>e) Security Headers: headers that instruct web browsers to enforce security rules, helping protect web applications from attacks such as XSS, clickjacking, MIME type sniffing, and insecure HTTP connections.</p><p>HTTP Methods:-</p><p>a) GET method: Retrieves data , used for fetching data and it doesn’t change the data.</p><p>real world examples: Loading a profile page, Viewing products,searching etc.</p><p>b) POST method: Create new data/resource,Usually sends data in the request body.</p><p>real world examples : creating a social media post, registering a new user, placing an online order</p><p>c) PUT method: Replace Entire Resource, replaces existing user</p><p>d) PATCH method: Update part of data (specific fields)</p><p>e) DELETE method: used for deleting the resources.</p><p>f)Idempotent vs Non-Idempotent HTTP methods:</p><p>A request is <strong>idempotent</strong> if: <strong><em>Making the same request multiple times produces the same final state on the server as making it once. e.g. get,put,delete.</em></strong></p><p>A request is <strong>non-idempotent</strong> if: <strong>Repeating the same request changes the server state each time.e.g. post.</strong></p><p>HTTP response codes:</p><p>Whenever a client (browser, mobile app, Postman) sends an HTTP request, the server responds with a <strong>status code</strong>.</p><p>Status Code Categories</p><p>a) 1xx — Informational (The request has been received, and the server is still processing it.)</p><p>b) 2xx — Success (everything worked) e.g. 200 OK,201 CREATED,204 NO-CONTENT.</p><p>c) 3xx — Redirection (resources have been moved) e.g. 301 moved permanently,302 Found (Temporary Redirect),304 Not Modified(used for caching)</p><p>d) 4xx — Client Errors (problem lies on client side) e.g. 400 Bad Request,401 Unauthorized,403 Forbidden,404 Not Found etc.</p><p>e) 5xx — Server Errors(problem on server side) e.g. 500 Internal Server Error,502 Bad Gateway,503 Service Unavailable etc.</p><p>HTTP caching: technique used to store copies of response for reuse , reducing the need of repeated request to server, thus improves load time, reduces bandwidth and decreases server load.</p><p>HTTP Content Negotiation: is a mechanism that allows the client to specify its preferred response format, language, or encoding using request headers, and the server responds with the best available representation of the resource. it is mainly of 4 types: Media Type Negotiation, language Negotiation, Encoding Negotiation, Charset Negotiation</p><p>HTTP compression: is a technique used to reduce the size of data sent from the server to the client, making websites load faster and reducing bandwidth usage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=633f10fac613" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backend First Principles]]></title>
            <link>https://medium.com/@satyamsharma21689/backend-first-principles-c672ca813bf4?source=rss-ca61f6dd55fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/c672ca813bf4</guid>
            <dc:creator><![CDATA[Satyam Sharma]]></dc:creator>
            <pubDate>Fri, 22 May 2026 17:14:31 GMT</pubDate>
            <atom:updated>2026-05-22T17:14:31.384Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*-BLa-Z9eEwe9b0jTqzZSKg.jpeg" /></figure><h3>What is Backend, How Does It Work and Why Do We Need It?</h3><p>The backend is the server-side part of an application responsible for processing requests, executing business logic, managing data, and communicating with other systems. Whenever a user interacts with an application — whether logging in, placing an order, uploading a file, or sending a message — the backend receives the request, processes it, and returns an appropriate response.</p><p>Backend systems communicate using protocols such as HTTP, WebSockets, and gRPC. They interact with databases, caches, external APIs, authentication providers, message queues, and storage systems to perform their tasks.</p><p>Without a backend, applications would be unable to securely store data, verify user identities, enforce business rules, or coordinate communication between multiple users and services.</p><p>The primary responsibilities of a backend system include:</p><ul><li>Security and access control</li><li>Persistent data storage</li><li>Business logic execution</li><li>Authentication and authorisation</li><li>Integration with external services</li><li>Communication between distributed systems</li><li>Performance optimisation and scalability</li></ul><p>To understand how backend systems work, we must first understand the fundamental principles that make them possible.</p><h3>a) Understanding Backend Workflows</h3><p>Every action performed by a user follows a workflow inside the backend.</p><p>Consider an e-commerce application. When a user clicks the <strong>“Buy Now”</strong> button, many operations happen behind the scenes:</p><pre>User clicks &quot;Buy Now&quot;<br>↓<br>Request sent to server<br>↓<br>Verify user authentication<br>↓<br>Validate payment information<br>↓<br>Check inventory<br>↓<br>Create order record<br>↓<br>Process payment<br>↓<br>Store order in database<br>↓<br>Send confirmation email<br>↓<br>Return success response</pre><p>This sequence of steps is called a <strong>backend workflow</strong>.</p><p>A workflow defines how data moves through different components of the system and how decisions are made before returning a response to the user.</p><p>Understanding workflows is important because every backend feature is essentially a workflow composed of multiple smaller operations.</p><h3>b) HTTP Protocol</h3><p>HTTP (HyperText Transfer Protocol) is the standard communication protocol used between clients and servers.</p><p>Whenever a browser requests a webpage or a mobile application requests data, it sends an HTTP request to the server. The server processes the request and returns an HTTP response.</p><p>Example:</p><pre>GET /users/1</pre><p>Response:</p><pre>{<br>  &quot;id&quot;: 1,<br>  &quot;name&quot;: &quot;Satyam&quot;<br>}</pre><h3>c) Routing</h3><p>Routing is the process of mapping incoming URLs to specific functions or handlers within the application.</p><p>Example:</p><pre>app.get(&quot;/users&quot;, getUsers)</pre><p>When the request arrives:</p><pre>GET /users</pre><p>The router forwards the request to:</p><pre>getUsers()</pre><p>Routing acts like a traffic controller that directs requests to the correct destination.</p><p>Without routing, the server would not know which piece of code should handle a particular request.</p><h3>d) Serialisation and Deserialisation</h3><p>Applications work with objects and data structures, but networks transfer text-based formats.</p><p><strong>Serialisation</strong> is the process of converting an object into JSON before sending it across a network.</p><p>Example:</p><pre>{<br>  name: &quot;Satyam&quot;<br>}</pre><p>becomes:</p><pre>{<br>  &quot;name&quot;: &quot;Satyam&quot;<br>}</pre><p><strong>Deserialisation</strong> is the process of converting received JSON back into application objects.</p><p>Every API request and response depends on serialisation and deserialisation.</p><h3>e) Authentication and Authorisation</h3><p>Authentication and authorisation are responsible for controlling access to resources.</p><h3>Authentication</h3><p>Authentication answers:</p><p><strong>Who are you?</strong></p><p>Examples:</p><ul><li>Username and Password</li><li>JWT</li><li>OAuth</li><li>Google Sign-In</li></ul><p>The goal is to verify identity.</p><h3>Authorisation</h3><p>Authorisation answers:</p><p><strong>What are you allowed to do?</strong></p><p>Example:</p><pre>Admin → Can delete users<br>User → Cannot delete users</pre><p>A user may be authenticated but still lack permission to perform certain actions.</p><p>Authentication verifies identity, while authorisation determines permissions.</p><h3>f) Validation and Transformation</h3><p>Incoming data must be checked before processing.</p><p><strong>Validation</strong> ensures that data follows predefined rules.</p><p>Example:</p><pre>{<br>  &quot;email&quot;: &quot;abc&quot;<br>}</pre><p>The email format is invalid.</p><p><strong>Transformation</strong> converts incoming data into the required format.</p><p>Example:</p><pre>{<br>  &quot;age&quot;: &quot;22&quot;<br>}</pre><p>becomes:</p><pre>age = 22</pre><p>Validation prevents incorrect data from entering the system, while transformation ensures consistent data structures.</p><h3>g) Middleware</h3><p>Middleware is software that executes between receiving a request and reaching the final business logic.</p><p>Flow:</p><pre>Request<br>↓<br>Middleware<br>↓<br>Controller</pre><p>Common middleware responsibilities:</p><ul><li>Authentication</li><li>Logging</li><li>Error handling</li><li>Rate limiting</li><li>CORS handling</li></ul><p>Middleware allows shared functionality to be reused across multiple routes without duplicating code.</p><h3>h) Request Context</h3><p>Request Context stores information related to a specific request and makes it available throughout the request lifecycle.</p><p>Examples:</p><pre>req.user<br>req.requestId<br>req.permissions</pre><p>Request context allows different parts of the application to access request-specific information without passing it manually through every function call.</p><h3>i) Handlers, Controllers and Services</h3><p>Modern backend applications are commonly divided into layers.</p><h3>Controllers</h3><p>Controllers receive HTTP requests and return HTTP responses.</p><p>Example:</p><pre>loginController(req, res)</pre><h3>Services</h3><p>Services contain business logic.</p><p>Example:</p><pre>authService.login()</pre><p>Flow:</p><pre>Controller<br>↓<br>Service<br>↓<br>Database</pre><p>This separation improves maintainability, testing, and code organisation.</p><h3>j) CRUD</h3><p>CRUD represents the four fundamental database operations.</p><p>OperationHTTP MethodCreatePOSTReadGETUpdatePUT/PATCHDeleteDELETE</p><p>Example:</p><pre>POST /users<br>GET /users<br>PUT /users/1<br>DELETE /users/1</pre><p>Most backend systems primarily revolve around CRUD operations.</p><h3>k) RESTful Architecture</h3><p>REST (Representational State Transfer) is a widely adopted architectural style for designing APIs.</p><p>Key principles:</p><ul><li>Resource-based URLs</li><li>Stateless communication</li><li>Standard HTTP methods</li><li>Consistent API structure</li></ul><p>Examples:</p><pre>GET /users/1<br>POST /orders<br>DELETE /products/5</pre><p>REST provides a predictable and standardised approach for building APIs.</p><h3>l) Database</h3><p>Databases store and retrieve persistent application data.</p><h3>Relational Databases (SQL)</h3><p>Examples:</p><ul><li>PostgreSQL</li><li>MySQL</li><li>SQL Server</li></ul><p>Data is organised into tables with relationships.</p><h3>Non-Relational Databases (NoSQL)</h3><p>Examples:</p><ul><li>MongoDB</li><li>Cassandra</li><li>DynamoDB</li></ul><p>Data is stored as documents, key-value pairs, or other flexible structures.</p><p>Databases ensure information remains available even after application restarts.</p><h3>m) Business Logic Layer</h3><p>The Business Logic Layer contains the rules that define how the application behaves.</p><p>Examples:</p><pre>If order amount &gt; ₹5000<br>Apply 10% discount</pre><pre>Only premium users can access premium content</pre><p>Business rules should remain separate from controllers and databases to keep applications maintainable.</p><h3>n) Caching</h3><p>Caching stores frequently accessed data in memory for faster retrieval.</p><p>Without Cache:</p><pre>Request<br>↓<br>Database<br>↓<br>Response</pre><p>With Cache:</p><pre>Request<br>↓<br>Cache<br>↓<br>Response</pre><p>Popular tools:</p><ul><li>Redis</li><li>Memcached</li></ul><p>Caching reduces latency, decreases database load, and improves overall application performance.</p><h3>o) Transactional Emails</h3><p>Transactional emails are automatically triggered by specific user actions.</p><p>Examples:</p><ul><li>Account verification</li><li>Password reset</li><li>OTP verification</li><li>Order confirmation</li><li>Welcome emails</li></ul><p>Popular providers:</p><ul><li>SendGrid</li><li>Mailgun</li><li>Amazon SES</li></ul><p>These emails are essential for user communication and account-related operations.</p><h3>p) Task Queuing and Scheduling</h3><p>Some tasks take a long time to execute and should not block user requests.</p><p>Example:</p><pre>User uploads image<br>↓<br>Queue job<br>↓<br>Image processing<br>↓<br>Store result</pre><p>Scheduled jobs run automatically at specific times.</p><p>Examples:</p><pre>Daily reports<br>Nightly backups<br>Weekly cleanup jobs</pre><p>Popular tools:</p><ul><li>RabbitMQ</li><li>Kafka</li><li>BullMQ</li><li>Celery</li></ul><p>Queues improve responsiveness while scheduling automates repetitive tasks.</p><h3>q) Elastic search</h3><p>Elastic search is a distributed search engine designed for high-performance searching and analytics.</p><p>Example:</p><pre>Search: iphone 15</pre><p>Features:</p><ul><li>Full-text search</li><li>Auto-complete</li><li>Fuzzy matching</li><li>Search analytics</li></ul><p>Traditional databases become inefficient for advanced search operations on large datasets, which is why dedicated search engines are used.</p><h3>r) Error Handling</h3><p>Applications inevitably encounter failures. Error handling ensures failures are managed gracefully.</p><p>Bad:</p><pre>Application crashed</pre><p>Good:</p><pre>{<br>  &quot;message&quot;: &quot;User not found&quot;<br>}</pre><p>Common error categories:</p><ul><li>Validation errors</li><li>Authentication errors</li><li>Database errors</li><li>Network errors</li><li>Internal server errors</li></ul><p>Proper error handling improves reliability and user experience.</p><h3>s) Config Management</h3><p>Configuration management separates environment-specific settings from application code.</p><p>Example:</p><pre>PORT=3000<br>DATABASE_URL=...<br>JWT_SECRET=...</pre><p>Different environments:</p><ul><li>Development</li><li>Testing</li><li>Staging</li><li>Production</li></ul><p>Configuration management enables applications to run consistently across environments.</p><h3>t) Logging, Monitoring and Observability</h3><h3>Logging</h3><p>Records important application events.</p><p>Examples:</p><pre>User logged in<br>Payment completed<br>Order created</pre><h3>Monitoring</h3><p>Tracks system metrics.</p><p>Examples:</p><ul><li>CPU usage</li><li>Memory usage</li><li>Response times</li><li>Error rates</li></ul><h3>Observability</h3><p>Provides insight into system behaviour using logs, metrics, and traces.</p><p>Popular tools:</p><ul><li>ELK Stack</li><li>Prometheus</li><li>Grafana</li></ul><p>These practices help teams detect, investigate, and resolve production issues.</p><h3>u) Graceful Shutdown</h3><p>Graceful shutdown allows an application to stop safely without losing active requests.</p><p>Process:</p><pre>Stop accepting new requests<br>↓<br>Finish current requests<br>↓<br>Close database connections<br>↓<br>Release resources<br>↓<br>Shutdown server</pre><p>Graceful shutdown prevents data loss and ensures reliable deployments.</p><h3>v) Security</h3><p>Security protects systems, users, and data from malicious activity.</p><p>Common security measures:</p><ul><li>HTTPS</li><li>Password hashing</li><li>JWT authentication</li><li>Input validation</li><li>SQL Injection prevention</li><li>XSS protection</li><li>CSRF protection</li><li>Rate limiting</li></ul><p>Security should be considered throughout the entire application lifecycle rather than added as an afterthought.</p><h3>w) Scaling and Performance</h3><p>As traffic increases, applications must handle more users efficiently.</p><h3>Vertical Scaling</h3><p>Increase resources on a single server.</p><pre>More CPU<br>More RAM<br>More Storage</pre><h3>Horizontal Scaling</h3><p>Add additional servers.</p><pre>Server 1<br>Server 2<br>Server 3</pre><p>Performance optimisation techniques include:</p><ul><li>Caching</li><li>Load balancing</li><li>Database optimisation</li><li>CDN usage</li><li>Query optimisation</li></ul><p>Scaling ensures applications remain fast and reliable under heavy traffic.</p><h3>x) Concurrency and Parallelism</h3><h3>Concurrency</h3><p>Multiple tasks make progress during the same period.</p><p>Example:</p><pre>Request A waiting for database<br>Request B processing</pre><h3>Parallelism</h3><p>Multiple tasks execute simultaneously on separate CPU cores.</p><p>Example:</p><pre>Core 1 → Task A<br>Core 2 → Task B</pre><p>These concepts improve responsiveness, throughput, and resource utilisation.</p><h3>y) Real-Time Backend Systems</h3><p>Real-time systems deliver updates instantly without requiring page refreshes.</p><p>Examples:</p><ul><li>Chat applications</li><li>Multiplayer games</li><li>Live notifications</li><li>Trading platforms</li><li>Collaborative editors</li></ul><p>Technologies:</p><ul><li>WebSockets</li><li>Server-Sent Events (SSE)</li><li>gRPC Streaming</li></ul><p>Flow:</p><pre>User A sends message<br>↓<br>Server<br>↓<br>User B receives instantly</pre><p>Real-time systems enable interactive and responsive user experiences.</p><h3>z) Object Storage and Large Files</h3><p>Object storage systems are designed for storing large unstructured files.</p><p>Examples:</p><ul><li>Images</li><li>Videos</li><li>PDFs</li><li>Audio files</li><li>Backups</li></ul><p>Popular solutions:</p><ul><li>Amazon S3</li><li>Google Cloud Storage</li></ul><p>Flow:</p><pre>Upload file<br>↓<br>Store in object storage<br>↓<br>Save file URL in database</pre><p>Object storage is more scalable and cost-effective than storing large files directly inside databases.</p><h3>DevOps for Backend Engineers</h3><p>DevOps combines software development and operations practices to automate building, testing, deployment, and infrastructure management.</p><h3>Docker</h3><p>Packages applications and dependencies into portable containers.</p><h3>CI/CD</h3><p>Automates building, testing, and deployment.</p><pre>Code Push<br>↓<br>Build<br>↓<br>Test<br>↓<br>Deploy</pre><h3>Kubernetes</h3><p>Manages and scales containerised applications.</p><h3>Nginx</h3><p>Acts as a reverse proxy, load balancer, and web server.</p><h3>Cloud Platforms</h3><ul><li>AWS</li><li>Google Cloud Platform (GCP)</li><li>Microsoft Azure</li></ul><h3>Infrastructure as Code (IaC)</h3><p>Infrastructure is managed through code.</p><p>Popular tools:</p><ul><li>Terraform</li><li>Ansible</li></ul><p>DevOps practices improve deployment reliability, automation, scalability, and operational efficiency.</p><h3>Complete Backend Request Lifecycle</h3><pre>Client (Browser/Mobile App)<br>↓<br>HTTP Request<br>↓<br>Routing<br>↓<br>Middleware<br>↓<br>Authentication<br>↓<br>Validation &amp; Transformation<br>↓<br>Controller / Handler<br>↓<br>Service Layer<br>↓<br>Business Logic<br>↓<br>Cache Check<br>↓<br>Database / External APIs<br>↓<br>Serialise Response<br>↓<br>HTTP Response Returned<br>↓<br>Client Receives Data</pre><p>This lifecycle represents the fundamental flow followed by most modern backend applications. A strong understanding of these first principles provides the foundation required to design, build, scale, and maintain production-grade backend systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c672ca813bf4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>