Library / Blogs
Swift Engineering Blog
Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
By Swift engineers · Swift · Added 2026-10-12
All content belongs to Swift engineers / Swift. We only link to it and give credit. Report a problem
Learn this article
About 37 min left. Your work is saved as you go.
What you are about to study
Swift wrote this to explain how they thought about a problem. You should know the basics: caching, queues and replication.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Real-World Systems · 9 minCross-border payments: SWIFT and foreign exchangeHow money moves between countries and currencies, what SWIFT actually is, and why international transfers are slow and costly.Read here
The problem
Paying someone across borders or currencies is harder than paying next door. Different banks, rules, currencies and time zones are involved, and there is no single global bank.
Messages versus money
Two things happen and they are often confused:
- Messaging: telling the other bank what to do. SWIFT (the Society for Worldwide Interbank Financial Telecommunication) is a secure messaging network with standard message formats. It does not hold or move money.
- Settlement: actually moving the value, by adjusting balances in accounts that banks hold with each other, or at a central bank.
100%Figure SDA-RWS-08-1 · A payment message crossing a messaging network · © forcsguy.com
Correspondent banking
If your bank has no direct relationship with the recipient's bank, it uses correspondent banks. Banks hold accounts with each other:
- A nostro account: "our money held at your bank, in your currency".
- A vostro account: the mirror view, "your money held at our bank".
100%Figure SDA-RWS-08-2 · Correspondent banking chain · © forcsguy.com
Each additional hop can add fees, delay, and a chance of error or manual review, and the sender often cannot see where the payment is.
Foreign exchange
Paying in another currency needs currency conversion:
- Rates come from the FX market (banks and liquidity providers). A provider quotes you a rate that includes a spread (their margin) over the market rate.
- A quote can be locked for a short time, since rates move constantly, so the system must record the quoted rate and its expiry.
- The cost of a transfer is fees plus spread, so a "free" transfer may still be expensive.
- Hedging and netting (offsetting payments in opposite directions) reduce a provider's risk and cost.
100%Figure SDA-RWS-08-3 · A currency conversion inside a transfer · © forcsguy.com
The layers of the currency market
Behind a single conversion sit three layers. A payment company's own funding pool serves retail needs and is usually topped up in advance. When the pool runs low it trades with wholesale providers, who batch many such orders. Those wholesalers in turn trade with the large international banks at the top. Pre-buying currency in bulk is why a customer's conversion can feel instant even though the settlement happens later.
Compliance
Cross-border payments pass sanctions screening, anti-money-laundering (AML) monitoring and know-your-customer (KYC) checks. Suspicious payments are held for manual review, which causes much of the delay. A design must keep full audit trails and be able to stop and explain any payment.
Faster alternatives
- Local payment rails (for example SEPA in Europe, Faster Payments in the UK, UPI in India, Pix in Brazil) are cheap and quick domestically. Some services pre-fund local accounts in each country, so a transfer becomes two local payments with the FX done in between, without moving money across borders each time.
- Instant, standards-based schemes and new interbank initiatives aim to shorten the chain and improve tracking.
- Some systems use stablecoins or other digital rails for settlement, with their own regulatory and operational risks.
Designing a system that sends money abroad
- Treat each transfer as a long-running workflow with states (quoted, submitted, in review, settled, failed, returned).
- Store the quote (rate, fees, expiry) and show the customer the total up front.
- Use idempotency keys and a ledger (previous lesson), with separate accounts per currency.
- Handle returns and rejections: money can come back days later, and the workflow must refund and notify correctly.
- Reconcile with every partner bank or provider daily, in each currency.
Real-world reading
Related reading
- Nubank BlogNubank engineers · NubankBlogs
- Klarna BlogKlarna engineers · KlarnaBlogs
- Coinbase BlogCoinbase engineers · CoinbaseBlogs
- Kraken BlogKraken engineers · KrakenBlogs
Show 6 moreShow fewer
- Capital One BlogCapital One engineers · Capital OneBlogs
- Stripe Engineering BlogStripe engineers · StripeBlogs
- Monzo: How Peer-To-Peer Payments WorkMonzo engineers · MonzoBlogs
- Architectures of Finance, Banking, and Payment SystemsRedhat engineers · RedhatCase Studies
- Google Cloud BlogGoogle Cloud engineers · Google CloudBlogs
- Algolia Engineering BlogAlgolia engineers · AlgoliaBlogs
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Swift Engineering Blog.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs · Free from the author · Read here
Scalable Web Architecture and Distributed Systems
A full chapter on the building blocks of large websites: availability, performance, reliability, scalability, caches, proxies, indexes, load balancers and queues. Free to read here under CC BY 3.0.
The Architecture of Open Source ApplicationsBeginner40 min
Papers · Read here
Facebook’s photo storage
This paper describes Haystack, an object storage system optimized for Facebook’s Photos application. Facebook currently stores over 260 billion images, which translates to over 20 petabytes of data.
USENIXIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…