Docs Menu
Docs Home
/ /
Atlas Architecture Center
/ / /

Open Finance Data Store

MongoDB powers open finance with flexible data integration, built-in security, and scalable financial services.

  • Use cases: App Driven-Analytics

  • Industries: Financial Services

  • Products and tools: Aggregation Pipeline, MongoDB Atlas

Open finance is transforming the financial industry, enabling seamless data sharing across banks, fintech companies, and third-party providers. However, integrating diverse financial data while ensuring security, compliance, and scalability is a major challenge.

MongoDB provides the ideal foundation for open finance with its flexible document model, native JSON support, and powerful aggregation framework. These features allow institutions to unify data from multiple sources and ensure secure and compliant data management.

By leveraging MongoDB, financial institutions can accelerate innovation, offer personalized financial insights, and adapt to evolving regulations without the complexity of traditional relational databases.

Open Finance demo in gif format

Figure 1. Open finance application with MongoDB

This example focuses on a fictional demo bank, Leafy Bank, which allows users to connect external bank accounts securely.

First, the user initiates a request to connect their external bank accounts. This requires explicit user consent, ensuring security and compliance with regulations like PSD2. To authenticate, Leafy Bank emulates OAuth 2.0, generating Bearer tokens for secure communication between institutions.

Once authorized, Leafy Bank communicates with external banks through APIs. These banks expose financial data such as accounts, transactions, and balances through their microservices. The response is returned in JSON format, ensuring compatibility and seamless data exchange.

The financial data is then pushed into MongoDB Atlas, where it is centrally stored. MongoDB's flexible document model lets you handle diverse data structures from different banks. From here, Leafy Bank can use aggregation pipelines to analyze and enrich the data, giving users a holistic financial view while enabling the bank to offer personalized financial insights.

Open Finance architecture diagram

Figure 2. Open finance architecture diagram

In the demo solution, the data model is a simplified design that emulates real-world financial data integration. The approach leverages MongoDB's flexible document model to handle diverse data structures from different financial entities.

Collection
Description
Sample Document

tokens

Stores Bearer tokens used for authenticating and authorizing API requests between Leafy Bank and external banks.

{
"_id": { "$oid": "unique_id" },
"UserName": "string",
"BearerToken": "string",
"TokenDates": {
"CreationDate": { "$date": "ISODate" },
"LastUseDate": { "$date": "ISODate" }
},
}

external_accounts

Stores information about external bank accounts linked by users.

{
"_id": { "$oid": "unique_id" },
"AccountId": "string",
"AccountBank": "string",
"AccountStatus": "string",
"AccountType": "string",
"AccountBalance": "number",
"AccountCurrency": "string",
"AccountDate": {
"OpeningDate": { "$date": "ISODate" }
},
"AccountUser": {
"UserName": "string",
"UserId": { "$oid": "unique_id" }
},
"GreenAccountNarrative": "string"
}

external_products

Stores information about financial products (such as loans and mortgages) associated with users.

{
"_id": { "$oid": "unique_id" },
"ProductId": "string",
"ProductBank": "string",
"ProductStatus": "string",
"ProductType": "string",
"ProductAmount": "number",
"ProductCurrency": "string",
"ProductInterestRate": "number",
"ProductDate": {
"OpeningDate": { "$date": "ISODate" }
},
"ProductCustomer": {
"UserName": "string",
"UserId": { "$oid": "unique_id" }
},
"GreenProductNarrative": "string",
"RepaymentPeriod": "number",
"LoanCollateral": "string"
}

In a real-world scenario, these collections would involve more complex security mechanisms and detailed information. Additionally, each financial entity would have its own data model definitions, which could vary significantly. You would need to consider the following factors:

Data mapping and relationships
Implementing a robust data mapping and relationship layer to translate diverse data models from different financial entities into a unified format.
Security and compliance
Ensuring data security and compliance with regulations such as GDPR, PSD2, and other local financial regulations. This includes encryption, access controls, and audit trails.
Scalability and performance
Designing the data model to handle large volumes of data efficiently, with considerations for indexing, sharding, and performance optimization.
Integration and interoperability
Building APIs and microservices that can integrate with various external systems, ensuring interoperability and real-time data exchange.

By using MongoDB's flexible document model, the demo solution showcases how financial institutions can unify and manage diverse data sources. However, a production-grade implementation would require addressing the complexities and nuances of real-world financial data integration.

For detailed setup instructions, follow the steps outlined in the Industry Solutions public GitHub repository. This repository hosts the backend for Leafy Bank's open finance demo service. It demonstrates integration with third-party banks and showcases secure data exchange. MongoDB serves as the central data store. The code may include simplified or emulated components for demonstration purposes.

To build the solution step-by-step, follow these instructions:

1

Create a new database in MongoDB Atlas named open_finance. Then add three collections:

  • tokens

  • external_accounts

  • external_products

2
3

Create a new user with readWrite access to the open_finance database to manage data securely.

4

Add the necessary database credentials and API origins to a .env file.

5

Set up a virtual environment using Poetry, install dependencies, and start the backend with Uvicorn. Ensure the service runs on the correct port for API communication.

The frontend for this solution is available in the Leafy Bank UI repository. The different components of Leafy Bank are designed as microservices. The UI repository serves as the main hub and provides an overview of all integrated services.

  • Central data store: MongoDB acts as a flexible and efficient central data store that supports open finance ecosystems.

  • Secure data management: MongoDB provides secure data management with built-in encryption, granular access controls, and high availability, helping organizations protect sensitive information and comply with evolving regulatory requirements.

  • Luis Pazmino Diaz, MongoDB

  • Ainhoa Mugica, MongoDB

  • Julian Boronat, MongoDB

  • Andrea Alaman Calderon, MongoDB

  • Real-Time Card Fraud Solution Accelerator

  • Payments Modernization Solution Accelerator

  • MongoDB and Hasura for Modern Fintech Services

Back

Modern Fintech Services

On this page