# Project Overview - Pig Farm Controller

## 1. Project Name and Purpose

**Project Name**: Pig Farm Controller

**Purpose**: The Pig Farm Controller is a backend application designed to manage various aspects of a pig farm. Its core functionalities include user management, device control, plan execution, comprehensive pig batch management, and real-time data monitoring. It aims to provide a centralized system for efficient and automated pig farm operations.

## 2. Executive Summary

The Pig Farm Controller is a robust backend application developed in Go, leveraging the Echo web framework for its API and GORM for database interactions. It is structured as a layered, API-centric backend service, ensuring modularity and maintainability. The application integrates with PostgreSQL (with TimescaleDB support) for data storage and is designed to handle complex farm management logic, including LoRaWAN device communication via ChirpStack. It provides a comprehensive set of RESTful APIs for external system integration and internal operational control.

## 3. Technology Stack Summary

| Category        | Technology      | Version |
| :-------------- | :-------------- | :------ |
| Language        | Go              | 1.25    |
| Web Framework   | Echo            | v4.13.4 |
| ORM             | GORM            | v1.30.5 |
| Database Driver | PostgreSQL      |         |
| Database Driver | SQLite          |         |
| Logging         | Zap             | v1.27.0 |
| Documentation   | Swaggo          | v1.16.6 |

## 4. Architecture Type Classification

**Architecture Type**: Layered/API-centric Backend Service

**Repository Structure**: Monolith

## 5. Links to Detailed Documentation

*   [API Contracts](./api-contracts-main.md)
*   [Data Models](./data-models-main.md)
*   [Source Tree Analysis](./source-tree-analysis.md)
*   [Development Guide](./development-guide-main.md)
*   [Architecture Document](./architecture-main.md)
