← Back to ADR Collection
Architecture Handbook
ADR-002
1.0
Accepted
Data Architecture
High
July 2026

ADR-002

Data Architecture

Selection of PostgreSQL as the Primary Database

This Architecture Decision Record documents why PostgreSQL was selected as the primary relational database for the AI Business Assistant & CRM.

This document preserves the engineering reasoning behind a foundational data architecture decision, including requirements, alternatives, benefits, and trade-offs.

Document Information

Decision PostgreSQL
Status Accepted
Category Data Architecture
Impact High
Date July 2026
Alternatives MySQL · SQL Server Express · MongoDB

Context

The AI Business Assistant & CRM required persistent storage for customer records, leads, appointments, conversation history, SMS messages, and administrative information.

These business entities have relationships that benefit from a structured relational data model, SQL queries, constraints, and transactional operations.

The database also needed to integrate with the Python and FastAPI backend while supporting maintainable application development and potential future cloud deployment.

Decision

PostgreSQL was selected as the primary relational database for the AI Business Assistant & CRM.

The application accesses PostgreSQL from its Python backend using the psycopg2 database adapter. SQL queries support CRM operations, customer information retrieval, appointment records, and communication history.

Architecture Objectives

Why This Decision Was Made

Transactional Reliability

PostgreSQL supports ACID transactions, allowing related database operations to be committed or rolled back together. Correct transaction handling remains an application responsibility.

Relational Integrity

Primary keys, foreign keys, constraints, and normalized schemas provide mechanisms for maintaining relationships among clients, appointments, leads, and communication records.

Querying & Performance

SQL querying, indexing, and query-planning capabilities support efficient data access. Performance depends on schema design, query patterns, workload, and infrastructure.

Python & AI Integration

PostgreSQL integrates with Python through database adapters such as psycopg2, used by this application. Its ecosystem also provides options for future analytics and AI-related data workloads.

Alternatives Considered

MySQL

MySQL is a mature relational database with transactional storage engines, broad adoption, and strong application support.

PostgreSQL was preferred for its combination of relational features, extensibility, SQL capabilities, and fit with the selected Python development stack.

SQL Server Express

SQL Server Express provides a capable relational database with strong Microsoft tooling and integration options.

However, its edition-specific resource limits and the project's preference for an open-source, cross-platform database favored PostgreSQL.

MongoDB

MongoDB provides flexible document-oriented storage and supports transactional operations.

The application's customer, appointment, and communication relationships were a more natural fit for a relational model and SQL-based access patterns.

Consequences

Positive Outcomes

Trade-offs

Future Evolution

PostgreSQL currently supports the application's CRM records, leads, appointments, chat messages, and SMS communication history.

Potential future capabilities include reporting dashboards, business analytics, vector search using suitable PostgreSQL extensions, and additional AI-assisted data workflows.

Cloud-managed PostgreSQL services and multi-tenant data architectures may also be evaluated as the application evolves.

These enhancements are future architectural options, not features claimed as already implemented.

Architect's Reflection

Choosing a database is rarely about storing information. It is about protecting the integrity of every business decision that depends upon that information.

Customer relationships, appointments, conversations, and operational workflows depend on data that remains consistent, accessible, and trustworthy.

PostgreSQL was selected because its relational capabilities, transaction support, and Python integration provide a practical foundation for the AI Business Assistant & CRM.

Continue the Handbook

Every architectural decision builds upon the previous one. Continue exploring the decisions that shaped the AI Business Assistant & CRM.