Architecture Overview
This section documents the architectural decisions, patterns, and standards referenced throughout the Qarion platform. It serves as the authoritative guide for understanding how the system is built and how to extend it.
Core Principles
The Qarion platform is built on a set of core architectural principles designed to ensure scalability, maintainability, and security.
1. Explicit Hydration Safety
We enforce proactive relationship hardening (Standard #330-SL). Key models use lazy='raise' to prevent asynchronous hydration traps, ensuring that data is explicitly loaded when needed and avoiding N+1 query issues in async contexts.
2. Provider-Based Architecture
To support diverse environments and integrations, we utilize a provider pattern for core services (Storage, Authentication, Notifications). This allows the platform to be agnostic to specific infrastructure choices while maintaining a unified API.
3. Instance-Based Service Layer
Services are instantiated per request or context, rather than being static singletons. This promotes testability and allows for better state management within the scope of a request.
4. Consolidated Governance
Governance logic is centralized. Authorization is handled via the @authorize decorator and a unified policy engine, ensuring consistent access control across the application.
System Map
The documentation is divided into the following key areas:
- Backend Architecture: FastAPI implementation, async patterns, and service layer design.
- Frontend Architecture: React application structure, Glass UI design system, and component patterns.
- Database Design: PostgreSQL schema, SQLAlchemy ORM usage, and migration strategies.
- Authentication & Authorization: JWT-based auth, RBAC, and the permission model.
- Workflow Engine: The graph-based orchestration engine powering business logic.
- Data Quality Engine: Architecture of the automated data quality and observability system.
- Search System: Global search architecture and indexing.
Standards & Patterns
Throughout this documentation, you will see references to specific standards (e.g., Standard #330-SL). these represent codified decisions that must be adhered to when contributing to the codebase.