Citronix is a comprehensive farm management system designed specifically for lemon farms. It enables farmers to efficiently track production, harvesting, and sales of their products while optimizing tree productivity based on age. The system provides tools for managing farms, fields, trees, harvests, and sales with a focus on maintaining strict agricultural constraints and maximizing productivity.
- Create, update, and view farm information (name, location, area, creation date)
- Multi-criteria search using Criteria Builder
- Comprehensive farm analytics and reporting
- Associate fields with farms with defined areas
- Automatic area consistency validation
- Maximum 10 fields per farm
- Field area must be between 0.1 and 50% of farm area
- Track planting date and age
- Calculate productivity based on tree age:
- Young trees (<3 years): 2.5 kg/season
- Mature trees (3-10 years): 12 kg/season
- Old trees (>10 years): 20 kg/season
- Maximum density: 100 trees per hectare
- Planting restricted to March-May period
- Seasonal harvest tracking (Winter, Spring, Summer, Fall)
- One harvest per season (every 3 months)
- Detailed tracking per tree
- Prevention of double harvesting in the same season
- Record sales with date, unit price, and customer information
- Automatic revenue calculation (Revenue = quantity * unit price)
- Link sales to specific harvests
- Sales analytics and reporting
- Backend Framework: Spring Boot
- Database: PostgreSQL
- Architecture: Layered Architecture
- Controllers
- Services
- Repositories
- Entities
- Data Validation: Spring Validation
- Testing: JUnit 5 & Mockito
- Code Generation: Lombok with Builder Pattern
- Object Mapping: MapStruct
- Exception Handling: Centralized exception management
- Documentation: Swagger/OpenAPI
- Containerization: Docker
- Docker and Docker Compose installed
- Git (optional, for development)
- Minimum 4GB RAM recommended
- 10GB free disk space
Create an .env
file in your project directory:
POSTGRES_DB=your_db_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
PGADMIN_DEFAULT_EMAIL=your_email@example.com
PGADMIN_DEFAULT_PASSWORD=your_pgadmin_password
Create a docker-compose.yml
file:
version: '3.8'
services:
app:
image: mraxel01/citronix:latest
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB}
SPRING_DATASOURCE_USERNAME: ${DB_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
depends_on:
- postgres
networks:
- app-network
restart: unless-stopped
postgres:
image: 'postgres:latest'
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USERNAME}
ports:
- "5432:5432"
networks:
- app-network
pgadmin:
image: 'dpage/pgadmin4:latest'
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
PGADMIN_LISTEN_PORT: 5050
ports:
- '5050:5050'
networks:
- app-network
networks:
app-network:
driver: bridge
# Start all services
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker-compose logs -f
- API: http://localhost:8080
- Swagger Documentation: http://localhost:8080/swagger-ui.html
- PgAdmin: http://localhost:5050
- Database: localhost:5432
citronix/
βββ src/
β βββ main/
β β βββ java/
β β β βββ net/
β β β βββ axel/
β β β βββ citronix/
β β β βββ controller/
β β β βββ domain/
β β β β βββ dtos/
β β β β β βββ farm/
β β β β β βββ field/
β β β β β βββ harvest/
β β β β β βββ harvestDetail/
β β β β β βββ sale/
β β β β β βββ tree/
β β β β βββ embeddeds/
β β β β βββ entities/
β β β β βββ enums/
β β β βββ exception/
β β β β βββ domains/
β β β βββ mapper/
β β β βββ repository/
β β β βββ service/
β β β β βββ impl/
β β β βββ validation/
β β β βββ validator/
β β βββ resources/
β βββ test/
- Minimum area: 0.1 hectare (1,000 mΒ²)
- Maximum area: 50% of farm's total area
- Maximum 10 fields per farm
- Maximum density: 100 trees per hectare (10 trees per 1,000 mΒ²)
- Maximum productive age: 20 years
- Trees can only be planted between March and May
- Productivity varies by age group:
- Young: <3 years
- Mature: 3-10 years
- Old: >10 years
- One harvest per season per field
- No double harvesting of trees in the same season
- Seasonal harvests: Winter, Spring, Summer, Fall
- Each tree can only be harvested once per season
Complete API documentation is available through Swagger UI at http://localhost:8080/swagger-ui.html
when the application is running.
The application implements a centralized error handling mechanism that provides:
- Consistent error response format
- Detailed error messages
- Appropriate HTTP status codes
- Validation error details
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Port Conflicts: Ensure ports 8080, 5432, and 5050 are available
- Memory Issues: Ensure Docker has enough allocated memory
- Database Connection: Check environment variables in .env file
# Check container logs
docker-compose logs [service_name]
# Restart services
docker-compose restart
# Reset everything
docker-compose down
docker-compose up -d --force-recreate
- Project Link: https://github.com/Mr-AXEL01/citronix
- Email: abdelhakazrour3@gmail.com
- LinkedIn: Abdelhak Azrour
- X (Twitter): @azrourax
Feel free to reach out for any questions, suggestions, or collaboration opportunities!