Synovia Digital Ltd · Customs Declaration Management Portal
A Flask web application for managing TSS (Trader Support Service) customs declarations for Birkdale Sales Ltd. Deployed on Render with Docker, connecting to Azure SQL.
- Backend: Python Flask (factory pattern + blueprints)
- Frontend: Bootstrap 5 + HTMX (server-rendered, zero JS frameworks)
- Database: Azure SQL via pyodbc (ODBC Driver 18)
- Deployment: Docker on Render (web service + cron job)
- Dashboard: Auto-refresh every 2 mins via HTMX + manual refresh button
Fusion_Flow_V2_BKD/
├── Dockerfile # Production Docker image
├── docker-compose.yml # Local development
├── render.yaml # Render deployment blueprint
├── gunicorn_config.py # WSGI server config (Docker-tuned)
├── wsgi.py # Gunicorn entry point
├── process_queue.py # Cron job: process staged declarations
├── poll_statuses.py # Cron job: poll TSS API for status updates
├── requirements.txt # Python dependencies
├── .env.example # Environment variable template
├── .gitignore
├── .dockerignore
├── config/
│ └── settings.py # Config classes (Dev/Staging/Production)
├── app/
│ ├── __init__.py # create_app() factory
│ ├── db.py # pyodbc connection manager
│ ├── tss_api.py # TSS API client (auth, GET, POST)
│ ├── blueprints/
│ │ ├── dashboard/
│ │ │ ├── __init__.py
│ │ │ └── routes.py # Live dashboard with HTMX auto-refresh
│ │ ├── master_data/
│ │ │ ├── __init__.py
│ │ │ └── routes.py # Company + Partners CRUD
│ │ ├── declarations/
│ │ │ ├── __init__.py
│ │ │ ├── routes.py # ENS Create/Update/Delete/Submit
│ │ │ └── forms.py # WTForms with choice value dropdowns
│ │ └── jobs/
│ │ ├── __init__.py
│ │ └── routes.py # Job history & manual triggers
│ ├── templates/
│ │ ├── base.html # Master layout (nav, HTMX, Bootstrap 5)
│ │ ├── layouts/
│ │ │ └── _nav.html # Navigation bar
│ │ ├── partials/
│ │ │ ├── _alerts.html # Flash messages
│ │ │ ├── _dashboard_content.html
│ │ │ └── _status_badge.html
│ │ ├── dashboard/
│ │ │ └── index.html
│ │ ├── master_data/
│ │ │ ├── company.html
│ │ │ └── partners.html
│ │ ├── declarations/
│ │ │ ├── list.html
│ │ │ ├── create.html
│ │ │ ├── detail.html
│ │ │ └── _form_fields.html
│ │ └── jobs/
│ │ └── history.html
│ └── static/
│ ├── css/
│ │ └── custom.css # Synovia/Fusion branding
│ ├── js/
│ │ └── app.js # Minimal JS helpers
│ └── img/
│ └── fusion_logo.png
├── migrations/
│ ├── 001_create_staging.sql
│ ├── 002_create_master_data.sql
│ └── 003_create_polling.sql
├── scripts/
│ ├── setup_database.py # Run all migrations
│ └── seed_choice_values.py # Populate CV lookups from TSS API
├── tests/
│ └── test_app.py
└── docs/
└── architecture.md # Stack decision research
# 1. Clone
git clone https://github.com/Synovia-Digital/Fusion_Flow_V2_BKD.git
cd Fusion_Flow_V2_BKD
# 2. Create .env from template
cp .env.example .env
# Edit .env with your Azure SQL credentials
# 3. Run with Docker Compose
docker-compose up --build
# 4. Open http://localhost:5000- Push to GitHub
- Connect repo in Render Dashboard
- Set environment variables (see .env.example)
- Render auto-detects render.yaml and creates web + cron services
| Variable | Description | Example |
|---|---|---|
AZURE_SQL_SERVER |
Azure SQL hostname | your-server.database.windows.net |
AZURE_SQL_DATABASE |
Database name | Fusion_TSS |
AZURE_SQL_USERNAME |
DB username | fusion_user |
AZURE_SQL_PASSWORD |
DB password | *** |
SECRET_KEY |
Flask session key | generate-a-random-string |
TSS_API_BASE_URL |
TSS API endpoint | https://api.tsstestenv.co.uk/api |
TSS_API_USERNAME |
TSS API user | API.TSS0012045 |
TSS_API_PASSWORD |
TSS API password | *** |
FLASK_ENV |
Environment | production |
- Birkdale Sales Ltd (BKD)
- Client Code:
BKD - TSS Environment:
TST(test) /PRD(production) - API User:
API.TSS0012045
© 2026 Synovia Digital Ltd. All rights reserved. Proprietary and confidential.