Frontend School
DashboardProblemsLearnPracticeMock InterviewReportsStatsBuy Credits
DashboardProblemsLearnPracticeMock Interview
Frontend System Design Roadmap
  1. 1.HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)
  2. 2.TCP and TLS Handshakes: Connection Setup Costs
  3. 3.Browser Network Stack and Connection Pooling
  4. 4.GET vs POST and Idempotency in HTTP
  5. 5.The Critical Rendering Path (CRP)
  6. 6.DOM, CSSOM and the Render Tree
  7. 7.Layout, Paint and Compositing
  8. 8.Reflows and Repaints Explained
  9. 9.Event Loop: Call Stack, Task and Microtask Queues
  10. 10.Async JavaScript: Promises and async/await
  11. 11.Web Workers: Multi-threading in the Browser
  12. 12.Browser Storage: Cookies, Web Storage, IndexedDB
  13. 13.Client-Side Storage: Limits and Security Risks
  14. 14.Choosing the Right Client-Side Storage
  15. 15.HTTP Caching: Cache-Control, ETag, Last-Modified
  16. 16.Browser-Level Caching Mechanisms
  17. 17.Cache Invalidation for Frontend Apps
  18. 18.Structuring a Large Single-Page App
  19. 19.Component-Based Architecture Principles
  20. 20.Props, State and Component Lifecycle
  21. 21.Module Bundling Basics
  22. 22.Core Web Vitals: LCP, INP and CLS
  23. 23.FCP and Time to Interactive (TTI) Explained
  24. 24.Measuring Performance: Lighthouse and WebPageTest
  25. 25.Asset Compression and Minification Basics
  26. 26.What Is a CDN and How Does It Work?
  27. 27.CDN Benefits: Latency, Availability, Offload
  28. 28.CDN Cache Behavior and Invalidation
  29. 29.Global State vs Local Component State
  30. 30.State Patterns: Redux, Zustand and Context
  31. 31.Data Fetching: React Query and SWR
  32. 32.Immutable Data in Frontend State
  33. 33.SSR vs CSR: Rendering Trade-offs
  34. 34.Hydration and Time to First Byte (TTFB)
  35. 35.Static Site Generation (SSG) for Speed and SEO
  36. 36.Incremental Static Regeneration (ISR)
  37. 37.Micro-Frontends: Core Principles
  38. 38.Micro-Frontend Integration Strategies
  39. 39.Communication Between Micro-Frontends
  40. 40.Micro-Frontends: Pros and Cons for Large Teams
  41. 41.Real-Time: Polling, SSE and WebSockets
  42. 42.Real-Time Use Cases: Chat, Alerts, Live Data
  43. 43.Designing a Real-Time Data Flow
  44. 44.Scaling WebSocket Connections
  45. 45.Responsive Images: srcset, sizes and picture
  46. 46.Modern Image Formats: WebP, AVIF, JPEG XL
  47. 47.Lazy Loading Images and Videos
  48. 48.Video Streaming: HLS, DASH, Adaptive Bitrate
  49. 49.REST and GraphQL for Frontend Engineers
  50. 50.Batching, Throttling and Debouncing API Calls
  51. 51.Handling API Errors in the Frontend
  52. 52.Authentication Flows: OAuth and JWT
  53. 53.Global Error Boundaries in React
  54. 54.Error Reporting: Sentry and LogRocket
  55. 55.Graceful Degradation and Fallback UIs
  56. 56.Real User Monitoring (RUM)
  57. 57.CORS: Cross-Origin Resource Sharing
  58. 58.Preventing XSS (Cross-Site Scripting)
  59. 59.CSRF Protection for Frontend Apps
  60. 60.Content Security Policy (CSP)
  61. 61.Storing Auth Tokens: Cookies vs localStorage
  62. 62.PWA Manifest and Installability
  63. 63.Service Workers: Lifecycle and Caching Strategies
  64. 64.Offline Support and Background Sync
  65. 65.Push Notifications for Web Apps
  66. 66.Webpack vs Vite vs Parcel
  67. 67.Code Splitting, Tree Shaking, Asset Optimization
  68. 68.Module Resolution and Hot Module Replacement
  69. 69.Monorepo Tooling: Nx and Lerna
  70. 70.Atomic Design for Component Libraries
  71. 71.Theming and Customization in Design Systems
  72. 72.Accessibility in Component Libraries
  73. 73.Component Library Docs, Testing and Versioning
  74. 74.Publishing and Consuming a Component Library
  75. 75.Full-Text Search: Levenshtein and Fuzzy Matching
  76. 76.Indexing Large Datasets in the Browser
  77. 77.Search Performance: Debouncing and Web Workers
  78. 78.Integrating Backend Search Services
  79. 79.Choosing a Chart Library: D3, Chart.js, Recharts
  80. 80.Rendering Large Datasets: Canvas vs SVG
  81. 81.Interactive, Responsive Data Visualizations
  82. 82.Data Fetching and Aggregation for Dashboards
  83. 83.A/B Test Design and Rollout Strategies
  84. 84.Client-Side vs Server-Side A/B Testing
  85. 85.Feature Flags and Remote Configuration
  86. 86.Experiment Data Collection and Analytics
Frontend System Design Roadmap
04

Frontend System Design · Lesson 4 of 86 · 3 min

GET vs POST and Idempotency in HTTP

This is a foundational check. If you can't explain GET, POST, and idempotency cleanly, you're raising a red flag. Here's how to nail it.

GET is for asking, POST is for changing

The core distinction is simple: GET retrieves data, and POST submits data that changes state on the server.

GET requests are for read-only operations. You're asking the server for a resource. All the data needed for the request is in the URL as query parameters (/api/users?id=123). This makes them bookmarkable, shareable, and, most importantly, cacheable by browsers and CDNs.

POST requests are for writing data. You're telling the server to create a new resource or perform an action that has side effects. The data, or "payload," goes in the request body, which allows for sending large or complex data like JSON objects or files.

In an interview, frame it around safety. A GET request is "safe," meaning it should not change any state on the server. Calling it a million times has the same effect as calling it zero times. A POST is not safe; it's designed to cause change.

Why idempotency is your safety net

Idempotency is the single most important concept to master here. An operation is idempotent if making it multiple times has the same effect as making it once.

GET is idempotent. Requesting /users/123 twice gets you the same result and leaves the server in the same state.

POST is not idempotent. Sending a POST to /users with a new user's data twice will create two users.

This matters because networks are unreliable. A request might time out. If the client doesn't get a response, what should it do?

  • If the request was idempotent (GET), you can retry safely. Nothing bad will happen.
  • If it was non-idempotent (POST), retrying blindly is dangerous. You might create duplicate orders, charge a credit card twice, or post the same comment multiple times.

The trap: Candidates often confuse "safe" and "idempotent." A DELETE /users/123 request is idempotent (deleting the same user twice has the same final effect as deleting them once—they're gone), but it is not safe (it changes the server state). Be precise with these terms.

This is why UIs disable the "Submit" button after one click. It's a client-side guard against the user accidentally retrying a non-idempotent POST.

How this looks in code

Talk is cheap. Here's how you'd implement a GET to fetch data and a POST to create it using the fetch API. Notice the difference in the options object.

The GET request is simple. The method is the default, and all data is in the URL.

The POST request requires specifying the method, setting the Content-Type header to tell the server you're sending JSON, and putting the JSON.stringify'd data in the body.

const API_URL = 'https://api.example.com/products';

// GET: Fetch a list of products
async function getProducts(category) {
  const url = new URL(API_URL);
  url.searchParams.append('category', category);

  try {
    const response = await fetch(url); // GET is the default method
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    console.error('Failed to fetch products:', error);
  }
}

// POST: Create a new product
async function createProduct(productData) {
  try {
    const response = await fetch(API_URL, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(productData),
    });
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    console.error('Failed to create product:', error);
  }
}

// Example usage
getProducts('electronics');
createProduct({ name: 'SuperPhone', price: 999 });

Beyond GET and POST

While GET and POST cover 90% of cases, knowing the others shows you have a deeper understanding of HTTP semantics.

  • PUT: Used to replace a resource at a specific URL. It's idempotent. If you PUT the same data to /users/123 twice, the end result is the same. The user profile is updated.
  • DELETE: Used to delete a resource. It's also idempotent. Deleting /users/123 twice has the same effect as doing it once.
  • PATCH: Used for partial updates. It is not idempotent. A PATCH to /users/123 with { "age": "+1" } would increment the age each time it's called.

Bringing up PUT and DELETE as examples of idempotent-but-not-safe methods is a good way to demonstrate nuance in an interview.

Try it

Open your browser's developer tools. Go to a site like GitHub or Twitter. In the "Network" tab, watch the requests as you navigate (GET) versus when you post a comment or like something (POST). Identify the method, payload, and query parameters for three different requests.

Next: We’ll follow a request from the browser to the screen in The Critical Rendering Path (CRP).

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Browser Network Stack and Connection Pooling

Next

The Critical Rendering Path (CRP)