Ravindra BagaleCourses & study guides Track your progress

Guides

Swiggy Architecture Explained: How Swiggy Runs Food and Grocery Delivery

Short answer: Swiggy runs on AWS. Its web front end uses server-side rendering services on EC2 and Kubernetes behind Kong and HAProxy, and static pages from S3 with CloudFront (2025). Microservices talk through Kafka, the event backbone. Transactional data sits in stores such as DynamoDB, whose change streams feed Swiggy's data lake. Real-time features run on Rill, a Flink platform on Amazon EMR.

Suppose you order groceries on Swiggy Instamart

It is Sunday evening in Gurugram. You order milk and vegetables on Instamart. In simple terms:

  1. The Swiggy app or website calls Swiggy's services on AWS; web pages come from server-side rendering services or from S3 through CloudFront.
  2. Kong and HAProxy route traffic, and can send a small percentage to a new version first.
  3. Order, cart and delivery microservices handle your request and publish events to Kafka.
  4. Transactional data is stored in databases such as DynamoDB.
  5. Rill (Flink) uses live events, for example to keep state in Redis or Valkey for real-time features.
  6. Klaxon watches business metrics in real time and alerts teams if orders suddenly drop.

What architecture style does Swiggy use?

Swiggy uses event-driven microservices with strong release safety and cost control.

  1. Event backbone: Kafka connects microservices and real-time analytics.
  2. Controlled rollouts (2025): SSR services shift traffic from 1% to 100% via Kong/HAProxy while watching latency and errors; static pages use CloudFront continuous deployment with a canary distribution.
  3. Cost engineering: Swiggy cut CloudFront costs by about half with smaller error pages, compression and caching, and cut ALB data costs with compression in its ingestion service (2024).
  4. Change data capture: DynamoDB Streams feed a CDC system that copies transactional data into the data lake.

Swiggy architecture diagram (public parts)

This diagram shows only what Swiggy or its partners have shared publicly. Press Play to follow a request step by step.

Watch the orange dot follow each numbered step.
Swiggy architecture from public information (simplified)AWSStatic web deliverySimplified; based on publicly shared information.Customerapp or websiteKong + HAProxyrouting, canary %Microservices + SSREC2 and KubernetesDynamoDBtransactions, Streams for CDCKafkaevent backboneRill (Flink on EMR)Redis / Valkey stateKlaxonreal-time business alertsS3 + CloudFrontstatic pages, ImageKit
  1. You place an Instamart order.
  2. Kong and HAProxy route the request.
  3. Microservices handle cart, order and delivery.
  4. Order data is stored in DynamoDB.
  5. Events go onto Kafka.
  6. Rill processes live events.
  7. Klaxon watches order rates.
  8. Static pages come from S3 through CloudFront.
  9. Your groceries are on the way.
Diagram 1: the public parts of Swiggy's architecture. Simplified; based only on publicly shared information. Open the diagram as an image (PNG) · WebP

What does Swiggy use? Main technologies

LayerWhat Swiggy uses (public)What it does in simple words
CloudAWSHosts Swiggy
ComputeEC2, KubernetesMicroservices and SSR
GatewaysKong, HAProxy, ALBRouting and canary splits
EventsKafkaEvent backbone
DatabaseDynamoDB (with Streams)Transactional data
StreamingRill: Flink on Amazon EMRReal-time features
Static deliveryS3, CloudFront, ImageKitWeb pages and images
AlertsKlaxonReal-time business monitoring

Which cloud provider does Swiggy use?

Swiggy runs on AWS (EC2, S3, CloudFront, ALB, DynamoDB, EMR, SES).

How did Swiggy cut its CloudFront bill by about half?

A set of small changes that added up to about 52% savings on CloudFront:

  1. Smaller error pages: one error HTML page was 179 KB. Shrinking it to about 2.1 KB alone cut daily CloudFront cost by about 30%, because error pages are served very often.
  2. Minify and compress: smaller HTML, CSS and JavaScript means fewer bytes sent.
  3. Better caching: more requests answered from the edge.
  4. Move heavy screens: high-traffic chat screens moved from CloudFront to ImageKit, saving another 35% a month.

How a front-end release rolls out (2025)

  1. For server-rendered pages, Kong and HAProxy send 1% of traffic to the new version, then more, up to 100%, while latency and errors are watched.
  2. For static pages in S3, CloudFront continuous deployment uses a separate canary distribution; production traffic is then shifted to a canary S3 path, starting at about 10%.
  3. ImageKit falls back between production and canary asset folders so users never see missing files.

How it started: logistics and serviceability

  1. Earlier, Swiggy re-architected its logistics systems and built a serviceability platform that decides, at high scale, which restaurants can deliver to you.
  2. Its "Where is my order?" system uses machine learning for delivery time prediction.
  3. Exact dates and details of these older systems are not publicly shared.

How does Swiggy store data?

  1. DynamoDB for transactional data, streamed into the data lake via CDC.
  2. S3 for static web assets and data lake files (Delta).
  3. Redis / Valkey for real-time state written by Rill.
  4. Other main databases are not publicly shared.

How does Swiggy monitor its systems?

  1. Klaxon: real-time business monitoring using Kafka, Rill, Databricks and Snowflake, with alerts by email (AWS SES).
  2. A unified production-changes timeline helps reduce time to detect and fix issues.
  3. Rollouts are watched for latency and error rates before each traffic step.

If we built an app like Swiggy on AWS (illustrative)

Please read this first

This section is a learning design by Ravindra Bagale. It is not Swiggy's real setup. Swiggy really runs on AWS. We use AWS here because it is what you learn in the AWS course.

Suppose you want to build "KiranaNow", a 20-minute grocery delivery app for one city. Here is a simple AWS layout.

1. Network: VPC, subnets, route tables, gateways

  1. Create one VPC with CIDR 10.0.0.0/16 in the Mumbai region (ap-south-1).
  2. Use two Availability Zones (A and B), so one AZ failing does not stop the app.
  3. In each AZ make three subnets: public (load balancer, NAT gateway), private app (your code) and private data (databases, cache).
  4. Attach one internet gateway (IGW) to the VPC. Public route table: 0.0.0.0/0 → IGW. This route is what makes a subnet public.
  5. Private app route table: 0.0.0.0/0 → NAT gateway, so servers can download updates but nobody can connect in from the internet.
  6. Private data route table: only the local VPC route. Use VPC endpoints to reach S3, DynamoDB and SQS without going over the internet.

2. Compute: where the code runs

  1. ALB with weighted target groups for canaries.
  2. Services on EKS.
  3. Events via SQS or MSK (Kafka).

3. Storage and databases

  1. DynamoDB for orders, with Streams.
  2. Aurora for stores; ElastiCache for stock and carts.
  3. S3 + CloudFront for images.

4. Monitoring

  1. CloudWatch alarms on order rate drops.
  2. X-Ray traces.

Request flow diagram

Press Play. The numbered list below the diagram lights up with each step.

Watch the orange dot follow each numbered step.
If we built a Swiggy-like app on AWS (illustrative)AWS Region (for example ap-south-1, Mumbai)VPC 10.0.0.0/16Availability Zone AAvailability Zone BPublic subnet 10.0.1.0/24RT: 0.0.0.0/0 → IGWPublic subnet 10.0.2.0/24RT: 0.0.0.0/0 → IGWApp subnet 10.0.11.0/24RT: 0.0.0.0/0 → NATApp subnet 10.0.12.0/24RT: 0.0.0.0/0 → NATData subnet 10.0.21.0/24RT: local onlyData subnet 10.0.22.0/24RT: local onlyvia VPC endpointsIllustrative learning design only. This is NOT the company's real setup.Userphone appRoute 53DNS lookupCloudFrontCDN edge cacheAmazon S3product imagesIGWApplication Load Balancerspans both AZsNAT gatewayNAT gatewayOrder APIEKS pods (auto scaling)Order APIEKS pods (auto scaling)ElastiCachecart, stock, sessionsAurorastores, usersElastiCachecart, stock, sessionsAuroraread replicaSQSorder eventsDynamoDBordersCloudWatch + X-Raymetrics, logs, traces
  1. You open KiranaNow. Route 53 answers.
  2. Images via CloudFront.
  3. From S3.
  4. API calls through the internet gateway.
  5. The ALB forwards to a pod.
  6. The order API runs.
  7. Stock from ElastiCache.
  8. Stores in Aurora; order in DynamoDB.
  9. Event to SQS.
  10. CloudWatch watches.
  11. Groceries on the way.
Diagram 2: an illustrative AWS design for learning. Swiggy does not necessarily run like this; see the sections above for what is publicly known. Open the diagram as an image (PNG) · WebP

Swiggy versus our AWS design

PartSwiggy (public info)Our AWS design
CloudAWSAWS
GatewaysKong, HAProxyALB weighted targets
EventsKafkaSQS / MSK
DatabaseDynamoDBDynamoDB, Aurora
StreamingFlink on EMR (Rill)Managed Flink
MonitoringKlaxonCloudWatch

Quick quiz: check what you learned

  1. Which cloud does Swiggy use?

    1. AWS
    2. Only own servers
    3. IBM Cloud
    4. Alibaba Cloud
    Show answer

    A. Swiggy runs on AWS services.

  2. What is Swiggy's event backbone?

    1. Email
    2. Kafka
    3. FTP
    4. Cron
    Show answer

    B. Kafka connects microservices and analytics.

  3. What is Rill?

    1. A delivery bike
    2. A payment card
    3. A Flink stream platform
    4. A CDN
    Show answer

    C. Rill runs Flink on Amazon EMR.

  4. How does Swiggy release front-end changes safely?

    1. All at once
    2. Only on Sundays
    3. By email
    4. Controlled percentage rollouts
    Show answer

    D. Traffic moves gradually from 1% to 100%.