Big-Link-Man/docs/architecture/overview.md

59 lines
3.6 KiB
Markdown

# Architecture Overview
## Introduction
This document outlines the overall project architecture for the Content Automation & Syndication Platform, based on the requirements detailed in the PRD v1.0. Its primary goal is to serve as the guiding architectural blueprint for AI-driven development, ensuring consistency and adherence to chosen patterns and technologies. The architecture is designed as a Python-based monolithic application with a Command-Line Interface (CLI), focusing on modularity to support future scalability, including an eventual migration from SQLite to PostgreSQL.
**Starter Template or Existing Project**: N/A - This is a greenfield project to be built from scratch.
## Change Log
*To be maintained as the project evolves*
## High-Level Architecture
### Technical Summary
The system is designed as a modular monolith written in Python, operating primarily through a command-line interface. The core architecture emphasizes a clean separation of concerns, with distinct modules for data ingestion, AI content generation, HTML templating, interlinking, and multi-cloud deployment. A crucial design principle is the implementation of a database-agnostic Repository Pattern to abstract data access, ensuring the initial SQLite database can be seamlessly replaced with a more robust solution like PostgreSQL in the future. An internal REST API, built with FastAPI, will facilitate communication with other internal systems, starting with the link-building machine.
### High-Level Project Diagram
```mermaid
graph TD
subgraph User Interaction
User(User/Admin) -- Runs CLI Commands --> CLI(CLI Interface)
end
subgraph "Python Application (Monolith)"
CLI -- Invokes --> CoreModules(Core Modules)
CoreModules --> D(Database Module)
CoreModules --> AI(AI Generation Module)
CoreModules --> T(Templating Module)
CoreModules --> IL(Interlinking Module)
CoreModules --> DP(Deployment Module)
CoreModules --> API(Internal REST API)
end
subgraph "Data & Configuration"
D -- "Reads/Writes" --> DB[(SQLite Database)]
CoreModules -- Reads --> ENV(Secrets /.env)
CoreModules -- Reads --> JSON(Config /master.json)
end
subgraph "External Services"
AI -- "Sends Prompts / Gets Content" --> AIService(AI Service API)
DP -- "Deploys HTML" --> Cloud(Multi-Cloud Storage)
API -- "Sends Job Data" --> LBM(Link-Building Machine)
end
style User fill:#d3f3d3
style LBM fill:#f3e5d3
```
## Architectural and Design Patterns
- **Modular Monolith**: The application will be a single deployable unit, but its internal structure will be divided into loosely-coupled modules with well-defined responsibilities. This provides the simplicity of a monolith with the organizational benefits of microservices.
- **Repository Pattern**: This is a non-negotiable requirement from the PRD. We will create a data access layer that separates business logic from data persistence details. This involves defining repository interfaces (abstract base classes) and concrete implementations for SQLite, making a future switch to PostgreSQL trivial.
- **CLI Command Pattern**: We will use a library like Click or Typer to structure the command-line interface, providing clear, self-documenting commands for all user interactions (e.g., content-tool user add, content-tool job run).
- **Strategy Pattern**: For the multi-cloud deployment module, we will use the Strategy Pattern. A unified DeploymentStrategy interface will be defined, with concrete implementations for each cloud provider (S3, Azure Blob, Bunny.net, etc.). This makes adding new providers straightforward.