Skip to content

Micro services for Agri App based on service oriented architecture

Notifications You must be signed in to change notification settings

Mahamadou-dev/AgriServices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

103 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌾 AgriServices - Plateforme SOA de Gestion Agricole

Système de gestion agricole distribué basé sur une architecture orientée services (SOA) avec microservices REST et SOAP.

Java Node.js Spring Boot MongoDB Docker


🎯 Description

AgriServices est une plateforme complète de gestion agricole permettant aux agriculteurs, coopératives et experts de gérer leurs exploitations, cultures, prédictions et factures de manière centralisée et sécurisée.

Fonctionnalités principales

  • 🔐 Authentification JWT : Sécurisation des accès avec tokens JWT
  • 👨‍🌾 Gestion des agriculteurs : CRUD complet avec MongoDB
  • 🌱 Gestion des cultures : Service SOAP pour les cultures et parcelles
  • 📊 Prédictions agricoles : Estimations de rendement et risques
  • 💰 Facturation : Service SOAP pour la gestion des factures
  • 🔗 API Gateway : Point d'entrée unique avec routage intelligent

🏗️ Architecture

Le système est composé de 6 microservices indépendants :

                          ┌─────────────────┐
                          │   API Gateway   │
                          │   (Port 8080)   │
                          └────────┬────────┘
                                   │
        ┌──────────────────────────┼──────────────────────────┐
        │              │           │           │              │
        ▼              ▼           ▼           ▼              ▼
  ┌──────────┐  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
  │   Auth   │  │  Farmer  │ │   Crop   │ │Prediction│ │ Billing  │
  │ Service  │  │ Service  │ │ Service  │ │ Service  │ │ Service  │
  │  :8081   │  │  :3001   │ │  :8082   │ │  :8000   │ │  :8085   │
  └────┬─────┘  └────┬─────┘ └──────────┘ └──────────┘ └────┬─────┘
       │             │                                        │
       ▼             ▼                                        ▼
  ┌──────────┐ ┌────────────┐                         ┌────────────┐
  │PostgreSQL│ │MongoDB     │                         │MongoDB     │
  │ Auth DB  │ │ Farmer DB  │                         │ Billing DB │
  └──────────┘ └────────────┘                         └────────────┘

Technologies par service

Service Technologie Port Base de données
API Gateway Spring Cloud Gateway 8080 -
Auth Service Spring Boot 3.4 8081 PostgreSQL 16
Farmer Service Node.js 22 + Express 3001 MongoDB Atlas
Crop Service Java JAX-WS (SOAP) 8082 -
Prediction Service Python FastAPI 8000 -
Billing Service .NET 9 (SOAP) 8085 MongoDB Atlas

🚀 Démarrage Rapide

Prérequis

Installation

  1. Cloner le repository
git clone https://github.com/Mahamadou-dev/AgriServices.git
cd AgriServices
  1. Configurer les variables d'environnement
cd docker
cp .env.example .env
# Éditer .env avec vos configurations MongoDB Atlas
  1. Démarrer tous les services
docker compose up -d
  1. Vérifier le démarrage
# Vérifier les services
docker compose ps

# Vérifier les logs
docker compose logs -f

# Tester l'API Gateway
curl http://localhost:8080/health

📖 Documentation

Documentation complète disponible dans le dossier /documentation :

🚀 Guides de Démarrage

🖥️ Documentation Frontend

📚 Documentation Technique

⚙️ Configuration & Déploiement


🔧 Développement

Structure du projet

AgriServices/
├── documentation/          # Documentation complète
├── docker/                # Docker Compose et Dockerfiles
│   ├── Dockerfiles/
│   ├── docker-compose.yml
│   └── .env.example
├── services/
│   ├── auth-service/      # Service d'authentification (Spring Boot)
│   ├── farmer-service/    # Service agriculteurs (Node.js)
│   ├── crop-service/      # Service cultures (JAX-WS SOAP)
│   ├── prediction-service/# Service prédictions (FastAPI)
│   ├── billing-service/   # Service facturation (.NET SOAP)
│   └── api-gateway/       # Passerelle API (Spring Cloud)
└── README.md

Compilation locale

Auth Service & API Gateway (Java)

cd services/auth-service
./mvnw clean compile

Farmer Service (Node.js)

cd services/farmer-service
npm install
npm start

📡 API Endpoints

Via API Gateway (http://localhost:8080)

Authentification

  • POST /auth/register - Créer un compte
  • POST /auth/login - Se connecter
  • GET /auth/validate - Valider un token

Farmers

  • POST /api/farmers - Créer un agriculteur
  • GET /api/farmers - Lister les agriculteurs
  • GET /api/farmers/:id - Obtenir un agriculteur
  • PUT /api/farmers/:id - Modifier un agriculteur
  • DELETE /api/farmers/:id - Supprimer un agriculteur

Prédictions

  • POST /api/predict/yield - Prédire le rendement
  • POST /api/predict/risk - Évaluer les risques

Services SOAP

  • /crop/** - Service cultures (WSDL disponible)
  • /billing/** - Service facturation (WSDL disponible)

Voir le Manuel d'utilisation pour des exemples détaillés.


🧪 Tests

Le projet inclut un fichier de tests complet tests-api.json avec des exemples pour tous les services.

# Vérifier la santé de tous les services
curl http://localhost:8080/health  # Gateway
curl http://localhost:8081/auth/health  # Auth
curl http://localhost:3001/health  # Farmer
curl http://localhost:8000/health  # Prediction
curl http://localhost:8082/crop?wsdl  # Crop WSDL
curl http://localhost:8085/billing?wsdl  # Billing WSDL

Voir les guides détaillés:


🛠️ Technologies

  • Backend: Spring Boot, Node.js, FastAPI, .NET Core
  • Base de données: PostgreSQL, MongoDB Atlas
  • Sécurité: JWT (HS256), Spring Security, BCrypt
  • Communication: REST, SOAP (JAX-WS, CoreWCF)
  • Conteneurisation: Docker, Docker Compose
  • Gateway: Spring Cloud Gateway

👥 Contributeurs

  • MAHAMADOU AMADOU HABOU - Développeur principal

📄 Licence

Projet académique — Usage pédagogique uniquement.


🆘 Support

Pour toute question ou problème :

  1. Consulter la documentation
  2. Ouvrir une issue GitHub
  3. Consulter le guide de dépannage

Version: 1.0
Dernière mise à jour: 17 décembre 2025