Midaz Components

This multi-database approach ensures that the system can manage structured, semi-structured, and unstructured data efficiently while maintaining high performance and scalability.

Each database system is selected for its unique strengths in handling different types of data across Midaz's service domains.


Database Overview


  • PostgreSQL is chosen for its robustness in handling structured data, particularly in scenarios that require transactional integrity and complex query operations. This makes it ideal for managing financial transactions and API interactions where data consistency and reliability are critical.
  • MongoDB, with its flexibility in managing unstructured and semi-structured data, is well-suited for handling metadata that can vary and evolve over time. Its dynamic schema allows for rapid development and scaling, making it perfect for components that require agility.
  • Redis is employed as an in-memory data store to provide high-speed access to frequently accessed data. Its real-time performance capabilities are critical for caching, session management, and scenarios where speed is of the essence.

Together, these databases form a cohesive system that balances data integrity, flexibility, and performance, catering to the diverse data management needs of Midaz.


Why PostgreSQL?

PostgreSQL is the backbone of Midaz for managing structured data that demands transactional reliability and consistency.

  • ACID Compliance: PostgreSQL ensures strong ACID (Atomicity, Consistency, Isolation, Durability) compliance, which is critical for maintaining the accuracy and reliability of financial transactions. Data integrity is paramount in such applications, and PostgreSQL excels in this regard.
  • Advanced SQL Capabilities: PostgreSQL supports rich and advanced SQL functionalities, making it ideal for handling complex queries that involve multiple tables or require advanced data manipulation. This is particularly important for API-driven components such as transaction management and portfolio operations.
  • Performance and Scalability: Known for its ability to handle high transaction volumes without compromising performance, PostgreSQL is well-suited for the transaction-heavy operations in financial systems.
  • Security Features: With robust security features, including fine-grained access controls and support for SSL encryption, PostgreSQL ensures that sensitive data, especially financial and user information, is handled securely.

Why MongoDB?

MongoDB’s flexibility and scalability make it the perfect choice for managing evolving and less structured data.

  • Schema Flexibility: MongoDB stores data in BSON (binary JSON) format, allowing for a dynamic schema. This flexibility is crucial when dealing with metadata that varies widely or evolves, such as user attributes or system configurations.
  • Scalability: MongoDB is known for its horizontal scalability via sharding, making it an excellent choice for managing large volumes of unstructured data that can scale dynamically as the system grows.
  • High Performance for Unstructured Data: MongoDB can efficiently store and retrieve unstructured or semi-structured data, which is particularly useful in managing the metadata and other flexible datasets within Midaz.
  • Rich Query Language: Despite being a NoSQL database, MongoDB offers a powerful query language and an aggregation framework that enables complex data analysis and processing directly within the database, optimizing the performance of queries on unstructured data.

Why Redis?

Redis is used to handle scenarios where real-time performance and fast data retrieval are essential.

  • Speed: As an in-memory data store, Redis provides exceptionally fast read and write operations, making it ideal for caching frequently accessed data or supporting real-time features like session management and transaction histories.
  • Versatile Data Structures: Redis supports a variety of data structures—such as strings, lists, sets, and hashes—allowing it to address a wide range of use cases beyond simple caching, from implementing counters to managing real-time analytics.
  • Persistence Options: While Redis is primarily in-memory, it offers options for data persistence to disk, ensuring reliability by recovering its state after restarts. This combination of speed and durability makes Redis a valuable component in maintaining fast data access without sacrificing data integrity.
  • Scalability: Redis supports master-slave replication, enabling horizontal scaling and ensuring high availability by distributing read operations across multiple servers. This is particularly important in high-traffic systems that demand quick response times.

Domain-Specific Database Utilization


Midaz strategically deploys PostgreSQL, MongoDB, and Redis across various service domains, leveraging the strengths of each database to meet the specific requirements of different components.

Authentication and Authorization

  • PostgreSQL: Handles structured data, ensuring secure and consistent storage of API-related authentication information.

Onboarding

  • PostgreSQL: Manages structured data related to the onboarding process, ensuring transaction reliability.
  • MongoDB: Stores metadata that may vary or evolve during user onboarding, allowing for rapid adaptation and scalability.
  • Redis: Caches onboarding information for faster access and reduced load times during heavy usage periods.

Portfolio

  • PostgreSQL: Used for managing structured data related to portfolio transactions and asset management.
  • MongoDB: Stores dynamic metadata related to portfolios, such as user preferences or additional asset information that may evolve.
  • Redis: Provides caching for fast access to portfolio data, improving performance during high-traffic events.

Transactions

  • PostgreSQL: Manages structured financial transactions, ensuring high accuracy and consistency.
  • MongoDB: Stores auxiliary transaction data or metadata that doesn’t require the rigidity of a relational database.
  • Redis: Used to cache frequently accessed transaction data, ensuring that real-time operations, such as transaction histories, remain fast and responsive.

Strategic Database Integration


The combination of PostgreSQL, MongoDB, and Redis offers Midaz a comprehensive and efficient solution to manage its data. By utilizing PostgreSQL for structured, transactional data, MongoDB for unstructured, flexible data, and Redis for high-speed, real-time caching, Midaz ensures that it can handle a variety of workloads efficiently.

This multi-database architecture allows Midaz to maintain the data integrity required for financial operations, while also benefiting from the flexibility and scalability needed for rapid development and evolving data requirements. Each database system is purposefully integrated to handle the specific demands of Midaz’s authentication, onboarding, portfolio, and transaction management components.