< BACK TO DIRECTORY

SYSTEM: LOCALHOST // PATH: ~/projects/autotaskx

AUTOTASKX

INDUSTRIAL TEXTILE OS & ENTERPRISE ERP INTEROPERABILITY GATEWAY

Architected an end-to-end industrial software ecosystem combining Textile OS—a high-density, multi-window web operating environment engineered in Next.js 16 and React 19—with a high-throughput enterprise integration gateway built in FastAPI (Python 3.12, AsyncIO). Backed by PostgreSQL 16, TimescaleDB hypertables, and Redis 7.2 Pub/Sub, the platform unifies mathematical dye formulation (Kubelka-Munk NNLS), 8K optical inspection (ASTM D5430), sub-second jet vessel telemetry, and real-time bi-directional synchronization across SAP S/4HANA, Datatex NOW MES, and Infor ION.

PRODUCTION DEPLOYEDTEXTILE OS (NEXT.JS 16 / REACT 19)FASTAPI (PYTHON 3.12, ASYNCIO)SAP & DATATEX ERP GATEWAYTIMESCALEDB HYPERTABLESCIEDE2000 & ASTM D5430BTMA / BGMEA / DIFE ENGINE

RESTRICTED ACCESS: If you wish to explore the full source code, review private production modules, or schedule a technical walkthrough, please contact me directly on WhatsApp: +8801771659336.

NEXT.JS 16FASTAPI (PYTHON 3.12)REACT 19POSTGRESQL 16TIMESCALEDB HYPERTABLESREDIS 7.2 PUB/SUBSAP S/4HANA (RFC/BAPI)DATATEX NOW MES (EDI XML)INFOR ION BUSMQTT V5 & OPC UAKUBELKA-MUNK NNLSASTM D5430 HUDBTMA / BGMEA / DIFE ENGINEWEBSOCKETSDOCKER✦NEXT.JS 16FASTAPI (PYTHON 3.12)REACT 19POSTGRESQL 16TIMESCALEDB HYPERTABLESREDIS 7.2 PUB/SUBSAP S/4HANA (RFC/BAPI)DATATEX NOW MES (EDI XML)INFOR ION BUSMQTT V5 & OPC UAKUBELKA-MUNK NNLSASTM D5430 HUDBTMA / BGMEA / DIFE ENGINEWEBSOCKETSDOCKER✦NEXT.JS 16FASTAPI (PYTHON 3.12)REACT 19POSTGRESQL 16TIMESCALEDB HYPERTABLESREDIS 7.2 PUB/SUBSAP S/4HANA (RFC/BAPI)DATATEX NOW MES (EDI XML)INFOR ION BUSMQTT V5 & OPC UAKUBELKA-MUNK NNLSASTM D5430 HUDBTMA / BGMEA / DIFE ENGINEWEBSOCKETSDOCKER✦NEXT.JS 16FASTAPI (PYTHON 3.12)REACT 19POSTGRESQL 16TIMESCALEDB HYPERTABLESREDIS 7.2 PUB/SUBSAP S/4HANA (RFC/BAPI)DATATEX NOW MES (EDI XML)INFOR ION BUSMQTT V5 & OPC UAKUBELKA-MUNK NNLSASTM D5430 HUDBTMA / BGMEA / DIFE ENGINEWEBSOCKETSDOCKER✦NEXT.JS 16FASTAPI (PYTHON 3.12)REACT 19POSTGRESQL 16TIMESCALEDB HYPERTABLESREDIS 7.2 PUB/SUBSAP S/4HANA (RFC/BAPI)DATATEX NOW MES (EDI XML)INFOR ION BUSMQTT V5 & OPC UAKUBELKA-MUNK NNLSASTM D5430 HUDBTMA / BGMEA / DIFE ENGINEWEBSOCKETSDOCKER✦NEXT.JS 16FASTAPI (PYTHON 3.12)REACT 19POSTGRESQL 16TIMESCALEDB HYPERTABLESREDIS 7.2 PUB/SUBSAP S/4HANA (RFC/BAPI)DATATEX NOW MES (EDI XML)INFOR ION BUSMQTT V5 & OPC UAKUBELKA-MUNK NNLSASTM D5430 HUDBTMA / BGMEA / DIFE ENGINEWEBSOCKETSDOCKER✦
// THE CONTEXT

Textile mills lose hundreds of thousands of dollars each month due to failed dye trials, shopfloor data fragmentation, and missed defects.

I designed and developed AutoTaskX to solve this by directly bridging the gap between advanced academic research and mission-critical vertical textile manufacturing operations. The platform replaces isolated terminals and physical clipboards with an industrial multi-window operating system, synchronized in real time with enterprise ERP backbones and high-speed dyeing vessels.

// THE ORIGIN: ACADEMIA MEETS INDUSTRY

Synthesizing Academic Research into Software Architecture

The genesis of AutoTaskX was highly unconventional. The client approached me not with traditional software wireframes or product specification documents, but with an exhaustive, in-depth academic thesis. This thesis was authored by a brilliant student and researcher at the Bangladesh University of Textile Engineering (BUTEX).

The core of the research focused on predicting exact dye formulations via complex non-linear optical equations, and automating fabric defect grading using high-speed optical physics. To accurately translate this vision into reality, I collaborated closely with a highly professional researcher from BUTEX.

My primary objective was to master these concepts—spending 20 intensive days studying textile chemistry, spectrophotometric reflectance, and ASTM grading standards—and architect a scalable software infrastructure that could execute this academic theory in real-time on a production factory floor.

// SYSTEMS ARCHITECTURE & SERVING TOPOLOGY

High-Throughput Distributed Industrial Architecture

AutoTaskX operates as a synchronized industrial pipeline. The browser-based Textile OS client interfaces over persistent WebSockets with an asynchronous FastAPI microservices tier, which orchestrates time-series telemetry persistence, computational colorimetry solvers, and bidirectional transactional gateways into corporate ERP ledgers.

TIER 01 // OPERATOR CONTROL ROOM & SHOPFLOOR CLIENTNext.js 16 (App Router) · React 19 · TypeScript · Tailwind CSS v4 · HTML5 WebSockets

Textile OS Multi-Window Desktop Engine · Spectro Formulation Studio · 8K Fabric HUD · Vessel Telemetry Monitor · Shift Logbook · Unix Virtual File System (VFS)

TIER 02 // HIGH-FREQUENCY SERVING & REAL-TIME BROKERFastAPI (Python 3.12, AsyncIO) · Uvicorn/Gunicorn · Redis 7.2 Pub/Sub Cluster · Pydantic v2

Sub-25ms WebSocket Connection Manager · Asynchronous Task Queues · Token Bucket Rate Limiters · AST-Constrained SQL Parser · Mutual TLS 1.3 / AES-256-GCM

TIER 03 // MILL STATE VAULT & TELEMETRY HYPERTABLESPostgreSQL 16 (Relational Mill Vault) · TimescaleDB (Time-Series Hypertables) · SQLAlchemy AsyncSession

ACID State Persistence · Row-Level Pessimistic Locking (`with_for_update`) · Automated Chunk Compression for 124ms PLC Sensor Streams & ASTM Defect Passports

TIER 04 // ENTERPRISE INTEROPERABILITY & STATUTORY ENGINESAP S/4HANA (RFC / BAPI / OData v4) · Datatex NOW MES (EDI XML) · Infor ION · MQTT v5 · OPC UA

Shopfloor-to-Ledger Bi-Directional Synchronizer (SAP MM, SAP QM, SAP PP) · Bangladesh Multi-Association Verification Engine (BTMA, BGMEA, BKMEA, DIFE)

TIER 05 // PHYSICAL DYEHOUSE SENSORS & MACHINE INTERFACESFong's & Thies Jet Vessels · Stenter Inspection Perches · Spectrophotometers (400–700nm) · Auto Dispensers

Industrial PLC Modbus/TCP relays · Automated Take-up Doffer Cut Solenoids · Chemical Valve Actuators · 8K GigE Optical Line-Scan Cameras

// SYSTEM 1 // INDUSTRIAL WEB-BASED TEXTILE OS

Textile OS: High-Density Control Room Desktop Environment

⚠THE OPERATIONAL CHALLENGE

Textile dyehouse control rooms suffer from extreme software and hardware fragmentation. Operators juggle physical clipboards, detached machine dial gauges, legacy spectrophotometer desktop software, and isolated inspection perches. This manual friction causes shift-handover delays, uncalibrated batch dosing, and delayed defect mitigation.

Engineering Solution & Multi-Window Architecture

Architected Textile OS—a purpose-built, high-density web operating system engineered with Next.js 16 and React 19 specifically for mill control room touchscreen consoles and desktop workstations.

Multi-Window Operating EnvironmentNEXT.JS 16 & REACT 19

Engineered a full desktop window management layer supporting concurrent industrial applications. Features dynamic Z-index stacking coordinates, smooth pointer-captured dragging, edge-boundary resizing with aspect-ratio locking, window minimization to the system taskbar, and persistent desktop layout state across operator browser sessions.

Hierarchical Virtual File System (VFS)UNIX PATH ARCHITECTURE

Structured on a Unix-standard path convention (`/home/operator/Desktop`, `/Documents`, `/Recipes`). Supports asynchronous file creation, batch recipe storage, ASTM quality passports, and operator-level permissions, interfacing directly with mill persistence backends without requiring external operating system privileges.

Role-Guarded Node Security & Polling HealthMILL-ISOLATED GUARDS

Enforces mill-isolated session guards (`mill_id`), persistent session restoration, and live hardware node status telemetry. Displays active node connectivity, buffer saturation rates, and sub-20ms PLC polling health directly in the system status tray.

Real-Time Hardware Stream ManagerCIPHER VALIDATION

Centralized configuration console for hardware link credentials, cryptographic cipher negotiation, and operator node privileges. Connects direct sensor streams to front-end visualization canvases with requestAnimationFrame rendering loops to avoid UI jank.

INDUSTRIAL SUITE

Unified Mission-Critical Control Applications

Spectro Formulation Studio
31-Point Reflectance (400–700nm)

Ingests raw spectrophotometer spectral curves, computes perceptual CIEDE2000 tolerances (ΔE00), and dispatches automated dosing formulations to chemical dispensers.

8K Optical Fabric Inspection HUD
ASTM D5430 Defect Stream

Real-time fabric inspection HUD capturing warp/weft defects at 60 m/min, linking penalty scores directly to sub-25ms automated take-up doffer cut relays.

Vessel PLC Telemetry Monitor
Fong's & Thies Jet Vessels

Real-time sensor stream curves tracking temperature, pressure, pH, and liquor ratios with sub-second alerting and historical hypertable trend comparison.

Daily Shift Logbook & Audit Trail
Direct VFS Persistence

Structured digital logbook capturing shift handovers, operator overrides, chemical batch numbers, and audit events saved directly to `/home/operator/Documents/ShiftLogs`.

System Config & Hardware Stream Manager
Cryptographic Node Gateway

Operator node credentials management, Mutual TLS cipher validation, and live PLC/SCADA connection health monitoring.

// SYSTEM 2 // ENTERPRISE INTEROPERABILITY & MILL ERP GATEWAY

High-Performance FastAPI Mill ERP Gateway & Serving Architecture

⚠THE INTEGRATION CHALLENGE

Physical dyehouse hardware (automated chemical dispensers, stenter perches, and high-pressure jet vessels) traditionally operates in complete isolation from enterprise management systems (SAP, Datatex, Infor). Plant accountants and supply chain managers rely on manual, end-of-day clipboard data entry, resulting in massive stock discrepancies, unaccounted chemical waste, and delayed shipment approvals.

Asynchronous FastAPI Serving Architecture

Designed and implemented a high-performance, asynchronous integration gateway powered by FastAPI (Python 3.12, AsyncIO) that serves as the bi-directional intelligence bridge between physical shopfloor machinery and corporate ERP ledgers.

Chemical Dispensing & Stock LedgerSAP MM / Datatex Dyes Integration

Employs asynchronous FastAPI background workers to automatically debit chemical stock (reactive dyestuffs, sodium hydrosulfite, soda ash) the millisecond automated dispensers release raw batches, eliminating inventory drift and eradicating manual transcription errors.

ASTM D5430 Fabric Roll PassportsSAP QM / Inspection Lots

Generates and streams cryptographic roll passports with Grade A/B/Reject status directly into enterprise Quality Management inspection lots upon perch completion. Eliminates quarantined warehouse bottlenecks by enabling real-time commercial dispatch.

Vessel PLC Run Cycles & Thermal ProfilingSAP PP / Mill MES Scheduling

Streams high-frequency, 124ms isothermal cycle curves, cooling ramp rates, and batch execution receipts into central enterprise production planning modules, ensuring exact utility accounting and line balance synchronization.

MULTI-PROTOCOL GATEWAY HUB

Datatex NOW MES: Native textile manufacturing integration via EDI XML and HTTPS REST endpoints.
SAP S/4HANA Enterprise: Bi-directional bridge supporting SAP RFC, BAPIs, and OData v4 web services.
Infor M3 Fashion & Apparel: Real-time lot traceability bus built atop Infor ION messaging infrastructure.
Industrial IoT Brokers: Lightweight telemetry ingestion using MQTT v5 and OPC UA protocols for plant SCADA networks.

STATUTORY INDUSTRIAL COMPLIANCE ENGINE

Implemented an intelligent compliance verification layer specifically tailored for Bangladesh’s export-oriented textile ecosystem:

BTMA (Bangladesh Textile Mills Association): Verifies spinning, weaving, and wet-processing factory membership credentials.
BGMEA & BKMEA Associations: Cross-checks woven and knitwear apparel licenses, recognizing that primary dyeing mills belong to BTMA without redundant BGMEA membership.
DIFE Inspection Licensing: Validates Department of Inspection for Factories and Establishments statutory safety compliance.
Automated Desk Audit Queues: Provides graceful fallback queues for human officer review when external government registries require verification.
// KEY ENGINEERING CHALLENGES

Handling Extreme Domain Ambiguity

The Challenge: Requirements were rooted in a dense 150+ page BUTEX academic thesis containing chemical kinetic equations, spectrophotometer physics, and international textile standards (ASTM, ISO, AATCC).

The Solution: Dedicated 20 full days solely to deep academic domain research. Mastered optical reflectance spectroscopy, Kubelka-Munk theory, and jet dyeing mechanics to break down complex theory into maintainable software microservices.

Translating Optical Physics into Matrix Math

The Challenge: Matching target shades requires combining multiple dyes such that their combined absorption curve matches 31 individual wavelengths (400nm to 700nm), ensuring concentrations aren't negative.

The Solution: Formulated the problem as a Non-Negative Least Squares (NNLS) matrix optimization using `scipy.optimize.nnls`. The system computes exact dye concentration vectors in under 15 milliseconds and includes CIEDE2000 evaluation.

Real-Time Edge Computer Vision & WebSockets

The Challenge: Defect events from 8K cameras arrive in bursts at 60 meters/minute line speeds. Naive WebSocket servers and concurrent database writes lead to corrupted scores and desynced UI HUDs.

The Solution: Implemented an async WebSocket manager backed by a Redis Pub/Sub backplane to sync all HUDs instantly. Used PostgreSQL pessimistic row locking (`with_for_update`) to guarantee ACID consistency when calculating ASTM cut-plans.

AST-Constrained Text-to-SQL

The Challenge: Managers wanted to ask natural language questions (e.g., "Show me yesterday's high temp batches"). Deploying raw LLMs for SQL generation risks accidental data deletion and SQL injections.

The Solution: Built a 4-stage safety pipeline: Intent extraction, AST parsing via `sqlglot`, strict read-only enforcement (blocking DDL/DML), and whitelist verification scoped only to safe production tables.

High-Frequency Multi-Window Control Room Rendering

The Challenge: Concurrently displaying 8K defect inspection canvases, live Fong's PLC thermal curves, and spectrophotometric formulations across multiple draggable windows caused UI micro-stutters and high CPU overhead on shopfloor workstations.

The Solution: Engineered a decoupled rendering architecture in Next.js 16 and React 19. Telemetry data is buffered via WebSockets and flushed to visual canvas components using `requestAnimationFrame`, preventing DOM re-render thrashing while preserving 60fps window dragging and stacking.

Distributed Bi-Directional ERP Transactional Consistency

The Challenge: Transient network partitions between mill-floor dispensing valves and corporate SAP/Datatex servers risked double-debiting raw dye inventory or dropping batch consumption receipts.

The Solution: Architected a Transactional Outbox pattern in PostgreSQL 16 managed by asynchronous FastAPI background workers. Every dispensing event writes an immutable dispatch record; background workers poll outbox tables using idempotent transaction keys and exponential backoff retry policies.

// TECHNICAL COMPLEXITY BREAKDOWN
DIMENSIONTRADITIONAL APPROACHAUTOTASKX IMPLEMENTATION
Color Formulation3–5 manual lab dips taking 24–72 hours; visual subjective matching.Kubelka-Munk NNLS matrix solver across 31 spectral wavelengths (400–700nm) in <15ms.
Color ToleranceSimple RGB/HEX distance or legacy CIE76 (inaccurate for human eye).Comprehensive CIEDE2000 (ΔE00) + Multi-illuminant metamerism indexing (D65, TL84).
Quality InspectionHuman inspector on manual perch; optical fatigue; 20-30% missed defects.8K GigE line-scan ingestion, sub-25ms ASTM D5430 grading, automated cut relay.
Machine TelemetryHandwritten operator logs; disconnected machine dial gauges.Sub-second PLC telemetry ingestion (Fong’s, Thies) into TimescaleDB hypertables.
Control Room UX4+ disconnected hardware terminals, legacy desktop software, paper clipboards.Next.js 16 / React 19 Textile OS multi-window desktop with Unix VFS and status telemetry.
ERP Inventory SyncEnd-of-day clipboard entry into SAP; unaccounted chemical drift & stockouts.FastAPI asynchronous background workers auto-debiting SAP MM & Datatex Dyes at batch release.
Inspection Lots (QM)Physical paper grading slips stapled to finished fabric rolls.Cryptographic ASTM roll passports auto-streamed directly into SAP QM inspection lots.
Multi-Worker SyncSingle-node in-memory WebSockets (fails when scaled across containers).Distributed WebSocket connection manager with Redis Pub/Sub cluster backplane.
Database ConcurrencyNaive read-then-write (causes race conditions and corrupted roll scores).Pessimistic row locking (`with_for_update`) ensuring atomic penalty accumulation.
Query SafetyRaw LLM Text-to-SQL (vulnerable to prompt injection & drops).4-stage AST parsing with sqlglot, whitelist enforcement, read-only sandboxing.
Statutory ComplianceManual paper binder audits across trade associations taking days.Automated verification engine cross-checking BTMA, BGMEA, BKMEA, and DIFE registries.
// MEASURABLE OUTCOMES
0%Manual clipboard transcription eliminated between shopfloor dispensers and SAP MM / Datatex ledgers.
< 25msFastAPI serving architecture delivers sub-25ms round-trip latency across WebSockets and ERP queues.
4-in-1Consolidated disconnected terminals and clipboards into a unified Next.js 16 / React 19 Textile OS desktop.
60%Reduction in lab-to-bulk lead time by computing exact dyestuff recipes mathematically.
25–35%Reduction in fabric rejection chargebacks through automated ASTM D5430 grading.
SecondsMill compliance verification time slashed from days to seconds across BTMA, BGMEA, BKMEA, and DIFE.
$$$Significant operational savings in water, steam, & dyestuff by predicting exact recipe affinity.
< 1sMachine telemetry updates and instant automated alerts for factory floor managers.
// TECHNICAL DEEP-DIVE Q&A

How did you design for concurrency and real-time performance?

In AutoTaskX, 8K line-scan inspection cameras stream fabric defect events at speeds up to 60 meters per minute. To solve concurrent writes (multiple defect events arriving simultaneously), I utilized PostgreSQL pessimistic row locking (`with_for_update`) within SQLAlchemy AsyncSession to ensure atomic score accumulation. For real-time HUD synchronization across multiple Docker container instances, I implemented a distributed WebSocket manager with a Redis Pub/Sub backplane. Any worker processing a defect publishes to Redis, instantly updating all connected operator HUDs with sub-25ms latency.

How did you ensure security when implementing Text-to-SQL for factory managers?

Executing LLM-generated SQL on production machinery databases is dangerous. I built a 4-stage validation pipeline: First, we provide strict schema context to the LLM. Second, before execution, the generated SQL passes through `sqlglot` to parse its Abstract Syntax Tree (AST). Third, we enforce a strict whitelist of allowed tables and explicitly verify that the root AST expression is a read-only `SELECT`. Any query attempting `DROP`, `ALTER`, or accessing system tables is instantly rejected. Finally, the query is executed with scoped read-only credentials, ensuring complete immunity to SQL injection.

How does the FastAPI ERP Gateway guarantee zero inventory drift between physical dispensing valves and enterprise ledgers (SAP/Datatex)?

Physical dyehouse environments experience transient network partitions between shopfloor dispensing valves and corporate ERP servers. To prevent double-debiting or dropped consumption records, I architected a Transactional Outbox pattern in PostgreSQL 16. When an automated dispenser actuates, the consumption event is committed atomically alongside the batch state in PostgreSQL. Asynchronous FastAPI background workers read this outbox queue and dispatch payloads to SAP MM (via RFC/BAPI) or Datatex NOW MES (via EDI XML) using idempotent transaction keys (`sha256(batch_id + valve_id + timestamp)`). If an ERP endpoint is unreachable, the gateway retries with exponential jitter while preserving ordering in a Dead Letter Queue (DLQ), ensuring complete financial and stock ledger reconciliation without human clipboard intervention.

How is Textile OS architected in Next.js 16 and React 19 to handle multi-window windowing and high-frequency industrial telemetry without UI degradation?

In industrial control rooms, operators require simultaneous visibility into spectrophotometer formulation curves, 8K fabric inspection perches, and vessel thermal streams. Building a multi-window manager in React 19 required solving DOM thrashing and telemetry update bottlenecks. I separated the window layout state (Z-indices, dragging boundaries, dimensions) from high-frequency telemetry streams. Sensor curves and defect feeds bypass React component tree reconciliation: incoming WebSocket payloads are buffered in memory and rendered directly into Canvas elements using `requestAnimationFrame`. Desktop state transitions (minimizing, maximizing, restoring) utilize React 19 concurrent transitions and persist to a Unix-standard Virtual File System (VFS), maintaining smooth 60fps interaction even during burst telemetry.