Zing Forum

Reading

SATRIA: A Microservice-Based Aquaculture Water Quality Early Warning System

A machine learning water quality early warning system built with FastAPI, MLflow, React, and Docker, using a microservice architecture to enable water quality classification prediction and real-time monitoring.

machine learningaquaculturewater qualitymicroservicesFastAPIMLflowReactSupabaseearly warning systemMLOps
Published 2026-06-09 19:16Recent activity 2026-06-09 19:22Estimated read 9 min
SATRIA: A Microservice-Based Aquaculture Water Quality Early Warning System
1

Section 01

SATRIA: Introduction to the Microservice-Based Aquaculture Water Quality Early Warning System

Core Introduction to the SATRIA Project

SATRIA is a microservice-based aquaculture water quality early warning system built with FastAPI, MLflow, React, and Docker, enabling water quality classification prediction and real-time monitoring.

This system aims to solve the problems of poor timeliness and high cost in traditional water quality monitoring. Through real-time early warning of water quality changes using machine learning models, it helps farmers reduce risks and increase yields.

2

Section 02

Project Background and Significance

Project Background and Significance

Aquaculture is an important part of the global food supply chain, and water quality management directly affects breeding efficiency and ecological safety. Traditional monitoring relies on manual sampling and laboratory analysis, which has the following problems:

  • Poor timeliness: Cannot reflect water quality changes in real time
  • High cost: Expensive manual and laboratory fees
  • Difficulty in large-scale monitoring: Cannot cover large breeding areas

The SATRIA project emerged as an early warning system for aquaculture scenarios. It uses machine learning models to perform real-time classification and prediction of water quality parameters, helping farmers take timely measures to reduce risks.

3

Section 03

System Architecture and Tech Stack

System Architecture and Tech Stack

System Architecture

Adopting a microservice architecture, it is divided into four core modules:

  1. API Gateway: Unified entry point, JWT authentication, routing traffic to ML or data services
  2. Machine Learning Service: Built with FastAPI, MLflow for model version management, offline packaged pre-trained models to ensure zero-latency inference
  3. Data Service: Interacts with Supabase PostgreSQL, handling data operations such as user profiles and prediction records
  4. Frontend Dashboard: Built with React + Vite, providing real-time monitoring, data visualization, and user authentication

Tech Stack

  • Frontend: Vite, React + TypeScript, Supabase JS Client, native SVG/CSS charts
  • Backend: FastAPI + Uvicorn, HTTPX, Pydantic, Pandas, LightGBM + Scikit-learn, MLflow
  • Database and Authentication: Supabase Auth (JWT), Supabase PostgreSQL (row-level security policies)
4

Section 04

Dataset and Prediction Model

Dataset and Prediction Model

Dataset

Uses the "Refined Aquaculture Water Suitability Signals" dataset from Kaggle, containing 4300 records and 17 feature columns.

Input Features

The model receives 13 water quality parameters:

  • Physical indicators: Temperature, turbidity
  • Dissolved gases: Dissolved oxygen, biochemical oxygen demand, carbon dioxide
  • Chemical indicators: pH value, total alkalinity, total hardness, calcium
  • Nutrients: Ammonia nitrogen, nitrate, phosphate
  • Others: Hydrogen sulfide, plankton count

Prediction Output

  • predicted_class_id: Water quality category ID
  • predicted_suitability_tier: Suitability level (e.g., suitable, critical, unsuitable)
  • Probability distribution of each category: Supports decision confidence evaluation
5

Section 05

Deployment Plan

Deployment Plan

Local Development

  • One-click startup: Use the run.bat script to start all microservices
  • Docker Compose: Build the complete tech stack locally to ensure environment consistency

Vercel Deployment

  • Configure vercel.json and deploy directly from the Git repository
  • Need to set environment variables such as Supabase connection information and backend API address

Production Environment Checklist

The project provides docs/DEPLOYMENT_CHECKLIST.md, covering:

  • User authentication testing
  • Prediction function verification
  • Dashboard data visualization check
  • API health status monitoring
6

Section 06

Project Features and Application Scenarios

Project Features and Application Scenarios

Feature Innovations

  1. Microservice Architecture: Improves maintainability and scalability
  2. MLOps Integration: Supports model version management, hyperparameter optimization, and A/B testing
  3. Zero-Latency Inference: Pre-trained models are packaged offline, no real-time computation delay in inference
  4. Real-Time Data Analysis: Built-in EDA (Exploratory Data Analysis) features, supporting distribution analysis and outlier detection
  5. Multi-Layer Security: JWT authentication + row-level security policies

Application Scenarios

  • Freshwater farms: High-density breeding monitoring for shrimp, fish, etc.
  • Marine aquaculture areas: Breeding of sensitive species such as shellfish and algae
  • Aquaculture research: Study of water quality change patterns and model validation
  • Environmental monitoring: Ecological health assessment of water bodies around breeding areas

Value: Early warning of water quality deterioration helps adjust operations, reduce losses, and achieve a win-win situation for economy and environment.

7

Section 07

Project Summary

Project Summary

The SATRIA project applies modern software engineering best practices (microservices, MLOps, DevOps) to the traditional agricultural field. It is not only a technical demonstration but also a solution prototype with practical application value.

For developers who want to learn full-stack development, machine learning engineering, or focus on smart agriculture technology, this is a high-quality open-source project worth in-depth study.