- Published on
Architecture of a Neobank - Revolut
- Authors
- Name
- AbnAsia.org
- @steven_n_t
Revolut is the largest neobank in the UK and Europe with more than 30 million retail customers for 2023.
It became popular among travelers and expats who send money abroad thanks to its low fees and attractive exchange rates.
Revolut successfully built an event-driven microservices architecture that lots of companies are struggling to implement. This architecture was the result of trial and error; it went through a transformation from a monolith and matured in the way it is presented in the diagram.
The backend consists of numerous independent microservices that communicate by sending and receiving events. The events are persisted in the single event store, which is a Postgres DB. Information from the event store is consumed by different modules such as Risk, PnL, and fraud detection.
Technology stack
1️⃣ Java, Kotlin for the backend
2️⃣ GCP as a public cloud provider
3️⃣ PostgreSQL (replicated to support streaming)
4️⃣ JetBrains Ktor and Kotlin coroutines to send events and streaming
5️⃣ jOOQ to write sql queries
6️⃣ RSocket Reactive Streams
7️⃣ ReactJS for the frontend
Event-driven microservices
1️⃣ Microservices communicate by exchanging events (using Kotlin Coroutines).
2️⃣ Prior to sending, an event gets persisted in the event store table in Postgres DB.
3️⃣ A receiver service implements onEvent handler to process an event.
4️⃣ A reconciler process delivers events that are present in the DB but not delivered.
5️⃣ The events store is used for queries, streaming, analytics, and reporting.
Event streaming
1️⃣ SingleEventConsumer and MultiEventConsumer are used by clients to subscribe to events.
2️⃣ Every application that consumes events relies on the event-processor.
3️⃣ The event-processor is responsible for dispatching the subscription’s events to the consumers.
4️⃣ The implementation of streaming is based on the Scrollable JDBC ResultSets (Cursors).
5️⃣ A read replica of the event store is used to improve performance.
Data consistency
☑️ Use transactions when possible, e.g., for actions that have boundaries within the system.
☑️ When transactions are not applicable, the platform implements a job-based reconciliation, e.g., when invoking external APIs.
☑️ Revolut uses Transaction Manager to initiate transactions and move expensive checks outside.
Interestingly, they made a conscious decision to not use Kafka, which already existed when they built their platform. One of the main reasons is the complexity of maintenance and configuration and, probably, the steep learning curve. When developed in-house, the proprietary solution based on a relational DB is easy to maintain, customize, and query data from.
Author
AiUTOMATING PEOPLE, ABN ASIA was founded by people with deep roots in academia, with work experience in the US, Holland, Hungary, Japan, South Korea, Singapore, and Vietnam. ABN Asia is where academia and technology meet opportunity. With our cutting-edge solutions and competent software development services, we're helping businesses level up and take on the global scene. Our commitment: Faster. Better. More reliable. In most cases: Cheaper as well.
Feel free to reach out to us whenever you require IT services, digital consulting, off-the-shelf software solutions, or if you'd like to send us requests for proposals (RFPs). You can contact us at [email protected]. We're ready to assist you with all your technology needs.
© ABN ASIA