PhonePe Architecture Explained: How PhonePe Handles Billions of Payments
Short answer: PhonePe runs its systems in two data centres in active-active mode: both handle live traffic, so one can fail without stopping payments. It uses data centres, not a public cloud region. Transaction history lives in TStore, built on HBase with Elasticsearch for complex queries (2024). Kafka carries about 100 billion events a day (2023). Chat-style payment timelines run on Bullhorn (2025) and real-time analytics on Garfield, built on Apache Druid (2025).
Suppose you pay your friend through UPI on PhonePe
You split a dinner bill in Hyderabad and send your friend 450 rupees on PhonePe. In simple terms:
- Your app sends the payment request to PhonePe's servers in one of its two data centres.
- PhonePe's payments orchestrator runs the money flow and talks to the UPI network and banks.
- The transaction is written to TStore, whose main store is HBase.
- Events about the payment go into Kafka; MirrorMaker 2 copies them to the other data centre.
- Your chat-style timeline with your friend is updated through Bullhorn, PhonePe's pub-sub platform.
- Dashboards on Garfield (Apache Druid) show payment success rates in real time to engineers.
What architecture style does PhonePe use?
PhonePe focuses on building strong shared platforms early.
- Platform first: in 2019 PhonePe prioritised platform capabilities and system scaling over growth hacks, with a generic payments orchestrator for all money flows.
- Active-active everywhere: TStore and Garfield both run in two data centres at the same time.
- Polyglot storage (2024): HBase is the source of truth, Elasticsearch handles aggregations; Kafka and RabbitMQ move messages.
- Event backbone: Kafka with separate write and read clusters in each data centre (2023).
PhonePe architecture diagram (public parts)
This diagram shows only what PhonePe or its partners have shared publicly. Press Play to follow a request step by step.
- You start a UPI payment.
- The request enters one of two data centres.
- The payments orchestrator runs the money flow.
- The transaction is stored in TStore on HBase.
- Events go to Kafka and are mirrored to the other DC.
- RabbitMQ handles retries; ZooKeeper holds routing config.
- Garfield on Druid shows live success rates.
- Bullhorn updates your chat timeline.
- You see Payment Successful.
What does PhonePe use? Main technologies
| Layer | What PhonePe uses (public) | What it does in simple words |
|---|---|---|
| Hosting | Two data centres, active-active | Keeps payments running if one DC fails |
| Transactions | TStore on HBase (2024) | Source of truth for transactions |
| Search / aggregation | Elasticsearch | Complex queries on transactions |
| Events | Kafka, MirrorMaker 2 | About 100 billion events per day |
| Queues | RabbitMQ | Retries, dead letter queues |
| Pub-sub | Bullhorn (2025) | Chat timelines, in-app inbox |
| Analytics | Garfield on Apache Druid (2025) | 500M+ messages/day, real time |
Which cloud provider does PhonePe use?
PhonePe runs two geographically separate data centres running active-active. There is no public record of a public cloud like AWS for the core payments path. Exactly who owns and runs the data centre hardware is not publicly shared.
How does PhonePe keep payments running if a data centre fails?
The 2024 TStore design in detail:
- Two full copies: TStore runs two independent clusters in separate data centres. Both take reads and writes.
- Routing by config: a Discovery Service backed by a central ZooKeeper cluster tells the TStore client where to send writes, so traffic can be shifted quickly.
- Replication: each data centre has its own Kafka cluster; MirrorMaker 2 streams topics to the other side, so writes made in one cluster are applied in the other with little delay.
- Failed messages: messages that cannot be processed go to RabbitMQ dead letter exchanges for separate handling.
- Kafka layout (2023): PhonePe moved from one Kafka cluster per data centre to separate write and read clusters per data centre, and services send events through a client library and an ingestion service.
Bullhorn (2025) reuses this kind of platform thinking: one pub-sub system powers peer-to-peer payment chats and the in-app inbox for alerts, which is more reliable than push notifications that people can easily dismiss.
How it started: PhonePe in 2019
- In May 2019, three years after launch, PhonePe had over 150 million users, 10 million daily transactions and 2 billion data events per day.
- Its core payments orchestrator used a flexible Databuilder framework to support all types of money flows.
- Risk detection and offers used a generic in-house entity store for real-time aggregation.
How does PhonePe store data?
- HBase on large HDFS fleets: transaction data (TStore).
- Elasticsearch: aggregations and search over transactions.
- Apache Druid: real-time analytics with 5:1 rollup (Garfield).
- Data is replicated between the two data centres (Kafka MirrorMaker 2 and cluster replication).
How does PhonePe monitor its systems?
- Garfield turns raw events into real-time dashboards for incident detection, at about 40,000 messages per second peak (2025).
- Other monitoring tools are not publicly shared.
If we built an app like PhonePe on AWS (illustrative)
Please read this first
This section is a learning design by Ravindra Bagale. It is not PhonePe's real setup. PhonePe runs in its own data centres, not on AWS, as far as is publicly known. We use AWS here because it is what you learn in the AWS course.
Suppose you want to build "PaisaPal", a payments app for a co-operative bank. Here is a simple AWS layout. Real payment apps must also follow RBI and NPCI rules.
1. Network: VPC, subnets, route tables, gateways
- Create one VPC with CIDR
10.0.0.0/16in the Mumbai region (ap-south-1). - Use two Availability Zones (A and B), so one AZ failing does not stop the app.
- In each AZ make three subnets: public (load balancer, NAT gateway), private app (your code) and private data (databases, cache).
- 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. - Private app route table:
0.0.0.0/0 → NAT gateway, so servers can download updates but nobody can connect in from the internet. - 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
- ALB in public subnets with AWS WAF.
- Payment services on EKS in private subnets.
- SQS FIFO queues keep payment events in order.
3. Storage and databases
- Aurora for the ledger (strong consistency).
- DynamoDB for transaction history.
- ElastiCache for sessions; S3 for statements.
4. Monitoring
- CloudWatch alarms on payment success rate.
- X-Ray traces; CloudTrail for audit.
Request flow diagram
Press Play. The numbered list below the diagram lights up with each step.
- You open PaisaPal. Route 53 answers.
- Static files via CloudFront.
- Stored in S3.
- API calls enter through the internet gateway.
- The ALB forwards to a pod.
- The payments API checks limits.
- Session from ElastiCache.
- Ledger in Aurora; history in DynamoDB.
- Events go to SQS FIFO.
- CloudWatch watches success rate.
- Payment done.
PhonePe versus our AWS design
| Part | PhonePe (public info) | Our AWS design |
|---|---|---|
| Hosting | Two active-active data centres | AWS, two AZs (add a second region for DR) |
| Transactions | HBase (TStore) | Aurora + DynamoDB |
| Events | Kafka | SQS FIFO / MSK |
| Analytics | Druid (Garfield) | OpenSearch or Athena |
| Monitoring | Garfield + more | CloudWatch, X-Ray |
Quick quiz: check what you learned
How do PhonePe's two data centres work?
- Active-active, both serve traffic
- One is only a backup
- Only for testing
- They store photos
Show answer
A. TStore and Garfield run active-active in two DCs.
Which database is TStore's source of truth?
- MongoDB
- HBase
- SQLite
- Redis
Show answer
B. HBase is the primary store; Elasticsearch handles aggregations.
About how many events does Kafka carry daily at PhonePe?
- 1 million
- 1 billion
- 100 billion
- 1 trillion
Show answer
C. About 100 billion (2023) events per day.
What is Garfield built on?
- MySQL
- Excel
- Hadoop MapReduce
- Apache Druid
Show answer
D. Garfield is PhonePe's real-time analytics platform on Apache Druid.
Learn it properly
Build the AWS parts yourself with these free guides and lessons:
- How to create a custom VPC with subnets, internet gateway and route tables
- Public vs private subnet in AWS · 3-tier architecture project on AWS
- How to launch an EC2 instance · Install the CloudWatch agent on EC2
- AWS course: What is a VPC? Default VPC vs custom VPC
- Related architectures: Paytm Architecture Explained: AWS, Microservices, Paxos Databases · JioHotstar Architecture Explained: AWS EKS, Envoy, Multi-CDN Live · Zomato Architecture Explained: AWS, Microservices, DynamoDB, Kafka · Swiggy Architecture Explained: AWS, Kafka, DynamoDB and CloudFront
- All famous app architectures explained