← Back to portfolio
Completed2025 – Present

Stock-Titan – Automated Supplier Stock Synchronization Platform for E-Commerce

An enterprise-grade Python automation system that synchronizes automotive spare parts inventory from multiple suppliers to e-commerce platforms via FTP, with intelligent data normalization and real-time stock aggregation.

Role: Backend Developer / Automation Engineer

Client: Droxauto (Internal Project)

Stock-Titan – Automated Supplier Stock Synchronization Platform for E-Commerce

Problem

Automotive spare parts e-commerce businesses manage inventory from multiple suppliers, each providing stock data in different file formats, encodings, separators, and column structures. Manually downloading these files, normalizing the data, aggregating stock levels, updating platform inventories, and uploading synchronized files is time-consuming, error-prone, and doesn't scale as supplier count grows.

Solution

Stock-Titan automates the entire supplier-to-platform stock synchronization pipeline. It connects to multiple supplier FTP servers, downloads stock files in any format (CSV, Excel, TXT), auto-detects encoding and separators, normalizes product IDs and quantities across different conventions, aggregates stock from all suppliers into a unified view, updates e-commerce platform inventories with the latest stock levels, and uploads the synchronized files back to platform FTP servers — all through a single CLI command or scheduled Docker container.

Tech Stack

Python 3.11pandas 2.0numpy 1.24Pydantic 2.0PyYAML 6.0paramiko 3.0chardet 5.0openpyxl 3.1xlrd 1.2click 8.1yagmail 0.15Jinja2 3.1python-dotenv 1.0pytest 7.0pytest-cov 4.0pytest-mock 3.10mypy 1.0black 23.0flake8 6.0isort 5.12DockerDocker Compose

Architecture

  • Clean Architecture with DDD-Inspired Layering
  • Domain Layer (Entities, Value Objects, Business Rules)
  • Service Layer (Normalization, Aggregation, Update Logic)
  • Infrastructure Layer (FTP Client, File Storage, Detection)
  • Orchestration Layer (Pipeline, Steps, Execution Context)
  • CLI Layer (Command-Line Interface with Arguments)
  • Configuration Layer (Pydantic Models, YAML Loader)
  • Type-Safe Configuration with Pydantic Validation
  • Multi-Supplier Stock Aggregation Engine
  • Auto-Encoding and Separator Detection System
  • FTP/FTPS Upload and Download Service
  • File Format Preservation Engine
  • Default Stock List Management
  • Retry Logic with Exponential Backoff
  • Docker Containerization with Volume Mounts
  • Enterprise Testing Framework (81 Tests)

Features

Multi-supplier stock aggregation

Multi-file supplier support

FTP and FTPS protocol support

Auto-encoding detection with chardet

Auto-separator detection (comma, semicolon, tab, pipe)

CSV, Excel, and TXT file support

Legacy Excel (.xls) support via xlrd

Column mapping by name or index

No-header file support

Fuzzy column matching for encoding issues

Stock value normalization (>10, AVAILABLE, N/A)

Product ID canonicalization with hyphen/parenthesis preservation

European decimal format handling (10,5 → 10.5)

Special quantity formats (10+, >50, LOW, <5)

OCR correction for common misreads (O → 0)

Default stock list for non-FTP suppliers

Main FTP server support for platform files

Configurable cleanup of temporary files

Dry-run mode for testing without uploads

Verbose logging with debug output

Type-safe configuration with Pydantic models

YAML-based configuration files

Original format preservation when writing files

Retry logic for FTP operations

Exponential backoff for network errors

CLI with argument parsing (suppliers, platforms, dry-run, verbose)

Pipeline orchestration with step tracking

Execution context with timing and statistics

Comprehensive error handling per error type

Detailed logging to files and console

Docker containerization with volume mounts

Docker Compose for production deployment

81 enterprise-level tests (43 unit, 38 integration)

100% critical path test coverage

Regression tests for known bugs (Airstal format)

Test fixtures with reusable test data

CI/CD ready with JUnit XML output

HTML coverage reports

Clean Architecture with DDD-inspired layering

Domain-driven design with entities and value objects

Service layer for pure business logic

Infrastructure layer for external systems

Separation of concerns across all modules

~2,500 lines of clean, maintainable code

About this project

Stock-Titan is an enterprise-grade automation platform built with Python that solves the complex challenge of synchronizing automotive spare parts inventory from multiple suppliers to e-commerce platforms. The system handles the entire pipeline from FTP file download to data normalization, stock aggregation, platform inventory updates, and file upload.

The architecture follows Clean Architecture principles with DDD-inspired layering. The domain layer defines entities and value objects for products, quantities, and stock levels. The service layer implements pure business logic for normalization, aggregation, and update operations. The infrastructure layer handles external systems including FTP clients, file storage, and encoding detection. The orchestration layer coordinates the complete pipeline through tracked steps.

Configuration is managed through YAML files defining supplier FTP credentials, platform FTP connections, header mappings, and system settings. All configuration is validated through Pydantic models ensuring type safety and catching errors at startup. The system supports unlimited suppliers and platforms, each with their own file format conventions.

The data processing engine handles remarkable diversity in supplier file formats. It auto-detects file encoding using chardet with fallback options, identifies separators automatically (comma, semicolon, tab, pipe), normalizes European decimal formats, preserves product IDs with special characters, and handles non-standard quantity representations like '>10', 'LOW', and '<5'. Column mapping supports both name-based and index-based matching with fuzzy logic for encoding-related mismatches.

The pipeline orchestrates nine sequential steps: download supplier files, download platform files, read and normalize supplier data, aggregate stock across all suppliers, read platform files, update platform inventories, write updated files preserving original format, upload to platform FTP servers, and cleanup temporary files. Each step is tracked with timing and statistics in an execution context.

The system was refactored from a 5,000+ line monolithic codebase into a clean 2,500-line architecture with zero code duplication, 100% type safety, and comprehensive test coverage. An enterprise testing framework with 81 tests ensures reliability across all file formats, encodings, and edge cases — including regression tests for known bugs. Docker support enables scheduled automated runs in production environments.

Challenges

  • Handling diverse supplier file formats (CSV, Excel, TXT with different encodings)
  • Auto-detecting separators across comma, semicolon, tab, and pipe formats
  • Normalizing European decimal formats (10,5 → 10.5)
  • Preserving product IDs with hyphens, parentheses, and special characters
  • Handling special quantity formats (>10, LOW, <5, N/A)
  • Aggregating stock from multiple suppliers with deduplication
  • Writing updated files while preserving original format and structure
  • Implementing retry logic with exponential backoff for FTP failures
  • Building type-safe configuration with Pydantic validation
  • Refactoring 5,000+ lines of spaghetti code into 2,500 lines of clean architecture
  • Achieving 100% critical path test coverage with 81 tests
  • Creating Docker deployment with volume-mounted configuration

Results

  • Reduced codebase from 5,000+ lines to 2,500 lines (-50%)
  • Achieved 100% type safety with Pydantic and type hints
  • Built 81 enterprise-level tests (43 unit, 38 integration)
  • 100% critical path test coverage
  • Eliminated code duplication across all modules
  • Achieved professional Clean Architecture structure
  • Multi-supplier aggregation handles unlimited suppliers
  • Multi-platform sync handles unlimited e-commerce platforms
  • Auto-detection handles all common file formats and encodings
  • Docker deployment ready for production
  • CLI interface with flexible filtering options
  • Dry-run mode for safe testing

Gallery

Stock-Titan – Automated Supplier Stock Synchronization Platform for E-Commerce screenshot 1
1 / 2

What people say

Swipe or use arrows. Switch EN / FR / AR when available.

Placeholder: Stock-Titan automated our entire supplier stock synchronization process, replacing hours of manual work with a single command. Replace this with a real client comment.

PC

Private Client

Client feedback · Placeholder

Community

GitHub

Social Media

Linkedin
© Taoufik Boucetta 2026 Inc. All rights reserved.