Development of a logistics company portal
A logistics portal is not just a business card website with a request form. It's a working tool through which customer managers track cargo, dispatchers assign vehicles, drivers receive routes, and accounting exports invoices. Each of these roles works with their own data, scenarios, and access levels.
Functional blocks of the portal
A typical transport and logistics company portal consists of several independent modules connected through a shared database and API.
Client personal account — registration, order history, current delivery status, documents (CMR, TTH, invoices), request for new shipment. Client sees only their own data without other shipments.
Dispatcher panel — incoming requests, driver and vehicle assignment, real-time location tracking on map, status changes, chat with driver.
Driver mobile app (or PWA) — current order, route, status changes (picked up/in transit/delivered), photo proof at delivery, recipient signature on screen.
Admin panel — reference data management (cities, rates, transport types), reports, user management.
Cargo tracking: technical stack
Real-time location of vehicles is a key element. There are several approaches:
GPS trackers with own server. Devices like Teltonika FMB920 send coordinates via MQTT protocol or custom TCP server. Data arrives every 30–60 seconds:
# Example of processing incoming GPS tracker data via MQTT
import paho.mqtt.client as mqtt
import json
from datetime import datetime
def on_message(client, userdata, message):
data = json.loads(message.payload.decode())
vehicle_id = data['device_id']
lat = data['lat']
lng = data['lng']
speed = data['speed']
ts = datetime.fromtimestamp(data['timestamp'])
# Save to TimescaleDB (PostgreSQL with extension for time series)
db.execute("""
INSERT INTO vehicle_positions (vehicle_id, lat, lng, speed, recorded_at)
VALUES (%s, %s, %s, %s, %s)
""", (vehicle_id, lat, lng, speed, ts))
# Publish to Redis for real-time map updates
redis.publish(f'vehicle:{vehicle_id}', json.dumps({
'lat': lat, 'lng': lng, 'speed': speed
}))
Mobile app with geolocation. Driver enables tracking via browser or app. Cheaper in infrastructure, but depends on phone battery and internet availability.
Integration with external systems. Yandex.Transport, Wialon, Omnicomm — ready monitoring platforms with API. Connecting to their API allows getting location data without own telemetry server.
Real-time map
For displaying positions, WebSocket is used — server pushes updates to client without polling:
// Frontend: WebSocket connection and marker updates on map
const socket = new WebSocket('wss://api.example.com/ws/dispatch');
socket.addEventListener('message', (event) => {
const { vehicleId, lat, lng, speed, status } = JSON.parse(event.data);
if (markers[vehicleId]) {
markers[vehicleId].setLatLng([lat, lng]);
markers[vehicleId].setPopupContent(
`<b>${vehicleId}</b><br>Speed: ${speed} km/h<br>Status: ${status}`
);
} else {
markers[vehicleId] = L.marker([lat, lng])
.addTo(map)
.bindPopup(`<b>${vehicleId}</b>`);
}
});
For the map — Leaflet with tiles from OpenStreetMap (free) or Yandex.Maps / Google Maps (paid, but better geocoding for CIS).
Freight rate calculation
Tarification at logistics companies is complex: depends on weight, volume, distance, cargo type, urgency, insurance. It's recommended to extract the logic to a separate service:
class FreightCalculator
{
public function calculate(FreightRequest $request): FreightQuote
{
$distance = $this->distanceMatrix->calculate(
$request->originCity,
$request->destinationCity
);
$baseRate = $this->rateRepository->findRate(
$request->cargoType,
$request->vehicleType,
$distance->zone
);
$weightCharge = max($request->weight, $request->volumetricWeight()) * $baseRate->perKg;
$distanceCharge = $distance->km * $baseRate->perKm;
$insurance = $request->declaredValue * 0.002; // 0.2%
$total = ($weightCharge + $distanceCharge + $insurance)
* $request->urgencyMultiplier()
* $this->seasonalCoefficient();
return new FreightQuote(
base: $weightCharge + $distanceCharge,
insurance: $insurance,
total: round($total, 2),
currency: 'RUB',
validUntil: now()->addHours(24),
);
}
}
Document management
Transport invoice, CMR, freight receipt — all must be generated automatically from order data. Libraries like TCPDF or Snappy (wkhtmltopdf) are used for PHP, or Puppeteer for Node.js.
Recipient signature is collected via Canvas API in browser and saved as image attached to invoice:
const canvas = document.getElementById('signature-pad');
const signaturePad = new SignaturePad(canvas, {
backgroundColor: 'rgb(255, 255, 255)',
penColor: 'rgb(0, 0, 0)',
});
document.getElementById('save-signature').addEventListener('click', () => {
if (!signaturePad.isEmpty()) {
const dataUrl = signaturePad.toDataURL('image/png');
// Send to server with delivery confirmation
fetch('/api/deliveries/' + deliveryId + '/confirm', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ signature: dataUrl, confirmed_at: new Date().toISOString() }),
});
}
});
Integrations with external systems
Logistics portal rarely lives in isolation. Typical integrations:
- 1C — invoice export, counterparty synchronization, payment upload
- Diadoc / SBIS — electronic document management, document signing with digital signature
- Transport exchanges (ATI.SU, Deliver) — automatic shipment request publication
- Insurance companies — cargo insurance arrangement via API
Performance at scale
When the system has thousands of active shipments, naive database queries start to lag. Several concrete solutions:
Geospatial indexes in PostgreSQL with PostGIS extension:
CREATE INDEX idx_vehicle_positions_location
ON vehicle_positions USING GIST (ST_SetSRID(ST_MakePoint(lng, lat), 4326));
-- Select all vehicles within 50 km radius from point
SELECT vehicle_id, lat, lng
FROM vehicle_positions vp
JOIN (
SELECT vehicle_id, MAX(recorded_at) as last_seen
FROM vehicle_positions GROUP BY vehicle_id
) latest ON vp.vehicle_id = latest.vehicle_id AND vp.recorded_at = latest.last_seen
WHERE ST_DWithin(
ST_SetSRID(ST_MakePoint(lng, lat), 4326)::geography,
ST_SetSRID(ST_MakePoint(37.6173, 55.7558), 4326)::geography,
50000
);
Table partitioning by date — after a month data is archived and doesn't interfere with main queries.
Development timeline
Minimum viable portal (client account + statuses + documents) — 6–8 weeks. Full system with dispatcher map, driver mobile app, rate calculation, and integrations — 4–6 months. These are real figures for a team of three developers.







