System Design
Architecture Overview
The platform follows a modular, API-first architecture built on Python and Flask. All components are containerized with Docker for consistent deployment across environments.
System Architecture Diagram

Core Components
API Server
Flask-based REST API handling all shipping operations. Stateless, horizontally scalable.
PostgreSQL
Primary data store for organizations, users, shipments, rates, and billing records.
Redis + Celery
Async task processing for label generation, tracking updates, and invoice generation.
Carrier Gateway
Abstraction layer for carrier APIs. Normalizes requests/responses across all carriers.
Rate Engine
3-tier pricing calculator. Resolves base cost, applies markups, returns customer rate.
E-commerce Bridge
Shopify and WooCommerce integration layer for real-time rates and order sync.
Technology Stack
Backend
Python 3.11Core runtime
FlaskWeb framework
SQLAlchemyORM
Flask-JWT-ExtendedAuthentication
CeleryBackground tasks
Database & Cache
PostgreSQL 15Primary database
RedisCache & task queue
Infrastructure
DockerContainerization
Nginx / CaddyReverse proxy
Let's EncryptSSL certificates
Documentation
Swagger / OpenAPIAPI documentation
FlasggerSwagger UI
Request Flow
1
Client RequestAPI key or JWT token in Authorization header
↓
2
Auth MiddlewareValidates credentials, resolves organization & role
↓
3
Rate EngineFetches base cost (carrier API or manual rate table)
↓
4
Markup CalculatorApplies Master Admin markup, then Sub-Admin markup
↓
5
Carrier GatewaySends normalized request to carrier API
↓
6
ResponseReturns result with appropriate cost visibility per role