- 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—allowing institutions to unify data from multiple sources effortlessly. With built-in encryption, fine-grained access controls, and high availability, MongoDB ensures secure and compliant data management.
By leveraging MongoDB, financial institutions can accelerate innovation, offer personalized financial insights, and seamlessly adapt to evolving regulations—all without the complexity of traditional relational databases.
At the center of this architecture is our 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—like Green Bank or MongoDB Bank—via 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 retrieved financial data is then pushed into MongoDB Atlas, where it is centrally stored. MongoDB’s flexible document model makes it easy to handle diverse data structures from different banks. From here, Leafy Bank can leverage MongoDB Aggregation Pipelines to analyze and enrich the data, giving users a holistic financial view while enabling the bank to offer personalized financial insights.
In the demo solution for open finance using MongoDB as the central data store, 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. Here’s a detailed description of the data model approach:
Simplified components for demonstration purposes
External accounts collection:
External products collection:
In a real-world implementation, each financial entity would have its own data model definitions, which could vary significantly. The following considerations would be essential:
By using MongoDB's flexible document model, the demo solution effectively 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 you can follow the steps outlined in our 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. This code may include simplified or emulated components for demonstration purposes.
How to build the solution step-by step:
Step 1: Set up MongoDB database and collections
Create a new database in MongoDB Atlas named open_finance, then add three collections: tokens, external_accounts, and external_products. Import the provided sample data.
Step 2: Add MongoDB user
Create a new user with readWrite access to the open_finance database to manage data securely.
Step 3: Configure environment variables
Add the necessary database credentials and API origins to a .env file for seamless connectivity.
Step 4: Run it locally
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.
Frontend for this solution
The frontend for this solution is available in the Leafy Bank UI repository. The different components of Leafy Bank are designed as microservices, with the UI repository serving as the main hub, providing an overview of all integrated services.