Skip to main content

Pakashop Documentation

Version: Pakashop v2 | Last updated: June 2026 Platform: Production-grade Zambian B2B2C marketplace


Introduction

Pakashop is a multi-vendor B2B2C e-commerce platform built for the Zambian market. It connects merchants, distributors, and individual sellers with end consumers through a unified marketplace experience. The platform is engineered for scale, compliance, and reliability — handling everything from mobile-money-first payments to real-time delivery tracking and ZRA tax integration.

Key Differentiators

FeatureDescription
Mobile Money NativePrimary checkout via MTN, Airtel, and Zamtel mobile money (USSD push) with automatic card fallback
Escrow-Avoiding SettlementDelayed settlement model compliant with Bank of Zambia NPS Act — funds held by licensed providers, released only after PIN-verified delivery
Full Logistics StackAgent onboarding, hybrid assignment (manual/self-claim/automated), real-time GPS tracking, PIN confirmation, digital signature capture
ZRA Smart InvoiceDirect VSDC integration for automated tax invoice generation and transmission
AI Content ModerationAutomated NSFW/gore detection via Sightengine with admin review queue
Fraud DetectionReal-time rules engine with velocity checks, amount anomalies, and self-dealing detection

Tech Stack at a Glance

LayerTechnology
FrontendNext.js 15 (App Router), Tailwind CSS, Lucide/Heroicons, React Hot Toast, Leaflet, Recharts
Backend APINode.js / Express, Prisma ORM, PostgreSQL
LanguagesNode.js (16 services), Go (2 services — search, analytics), Python (2 services — moderation, recommendations)
Process Managementsystemd (every service is a unit)
Reverse ProxyNginx with TLS termination
CDN/DNS/WAFCloudflare
HostingAWS EC2 (Ubuntu 22.04 LTS)
SearchMeilisearch
Job QueueBullMQ on Redis
CachingRedis (sessions, product cache, pub/sub, rate limiting)
MonitoringMiddleware.io (OpenTelemetry), pino structured logging, journald
CI/CDGitHub Actions (CI, staging deploy, production deploy, health checks, DB backups)
PaymentsPawaPay (mobile money USSD), Flutterwave (cards + mobile money fallback)

Microservices (19 Total)

#ServiceLanguagePortPurpose
1pakashop-gatewayNode.js8000API gateway — routing, dual-key security, rate limiting, WebSocket upgrades
2pakashop-backendNode.js3080Core business logic — auth, orders, products, shops, payments
3pakashop-configNode.js3085Centralised feature flags & runtime configuration
4pakashop-notificationsNode.js3090Email, in-app notifications, SSE real-time stream
5pakashop-trackingNode.js3120Real-time delivery tracking — WebSocket server, Redis Pub/Sub
6pakashop-moderationPython3110Sightengine AI content moderation pipeline
7pakashop-recommendationsPython3100Collaborative filtering engine (Jaccard + k-NN)
8pakashop-schedulerNode.js3004Background job infrastructure (BullMQ)
9pakashop-searchGo3005Full-text product search via Meilisearch
10pakashop-fraudNode.js3006Rules-based fraud detection engine
11pakashop-analyticsGo3007Business intelligence — vendor/admin dashboards
12pakashop-couponNode.js3008Promotions & discount engine
13pakashop-loyaltyNode.js3010Points-based loyalty & rewards
14pakashop-whatsappNode.js3009WhatsApp Business Cloud API integration
15pakashop-reportsNode.js3011PDF/CSV/Excel report generation
16pakashop-reconciliationNode.js3012Automated financial reconciliation
17pakashop-invoicingNode.js3013ZRA Smart Invoice VSDC integration
18pakashop-pricingNode.js3014Dynamic pricing engine — commissions, discounts, markups
19pakashop-settlementNode.js3016Automated batch vendor & agent payouts

Table of Contents

Core SDLC Documents

#FileDescription
01SDLC/REQUIREMENTSFunctional & non-functional requirements; tech stack; regulatory constraints
02SDLC/DESIGNSystem architecture; key design decisions; data flow examples
03SDLC/DEVELOPMENTDevelopment standards, coding conventions, local setup
04SDLC/TESTINGTest strategy, types of tests, coverage requirements
05SDLC/DEPLOYMENTCI/CD pipelines, environment mapping, release procedures
06SDLC/MAINTENANCEMonitoring, incident response, system operations

Specialised Reference Documents

FileDescription
microservicesComprehensive reference for all 19 services
roles-permissionsFull role hierarchy and permissions matrix
api-designFull API endpoint reference; request/response contracts
data-modelsPrisma schema for all key models; enum reference; ER diagram
payment-architecturePawaPay + Flutterwave flows, webhook processing, settlement model
checkout-flowStep-by-step checkout UX, polling logic, error handling
order-lifecycleOrder & payment status machines, settlement states, refund scenarios
inventory-systemStock management, SKU generation, barcode, wholesale tiers
caching-strategyRedis key conventions, TTLs, cache invalidation rules
content-moderationSightengine integration, moderation flow, admin review
fraud-detectionRules engine, risk scoring, admin queue, API endpoints
loyalty-couponsCoupon types/validation/redemption, loyalty points
delivery-trackingWebSocket architecture, Redis Pub/Sub, GPS tracking
delivery-signingPIN confirmation, digital signature capture, ECT Act compliance
zra-invoicingVSDC integration, mock mode, TPIN, transmission logging
hosting-infrastructureEC2 topology, Nginx config, systemd units, networking
ci-cd-pipelineGitHub Actions workflows, branching strategy, migrations
security-compliancePCI-DSS, BoZ NPS Act, Zambia DPA 2021, fraud, MFA
observabilityMiddleware.io, pino, journald, tracing, alerts
testing-strategyTesting pyramid for backend, microservices, frontend, E2E
deployment-operationsStep-by-step deploy process, systemd management, rollback

Payment: architecture · checkout flow · order lifecycle · API Design · reconciliation

Infrastructure: hosting · caching · CI/CD · deployment · operations

Compliance: security · ZRA invoicing · requirements

Data: Data Models · API · Inventory · DESIGN

Delivery: tracking · signing · order lifecycle


  • Staging URL: staging.pakashop.store (Tracks main branch)
  • Production URL: pakashop.store (Tracks production branch)
  • Middleware.io Dashboard: app.middleware.io

For internal use only. Do not distribute outside Pakashop engineering.