PinDelivery follows a classic SPA + REST API architecture. The Go backend serves as the single API layer, MongoDB stores all data, and three separate frontends (client portal, admin panel, mobile app) consume the API.
Client Portal (Angular) ---\
Admin Panel (Angular) ----+--> Go API (Gorilla Mux) --> MongoDB
Mobile App (Flutter) ---/ |
+--> External Services
- Geocoding (address lookup)
- Client Webhooks
- Vendor Webhooks (B2B delegation)
PinDelivery-BE/
main.go # Entry point, loads env, starts server
Controllers/ # HTTP handlers + routing
AuthenticationController.go # Auth, login, JWT, profile
AdminController.go # Admin CRUD operations
PackageController.go # Package lifecycle
CourierController.go # Courier management
WebhookController.go # Partner/vendor webhook receivers
ChatbotController.go # Instagram chatbot integration
Services/ # Business logic
IntentV2Service.go # Package state machine (intents)
PackageService.go # Package CRUD + geocoding
ClientService.go # Client management
CourierService.go # Courier management
AuthenticationService.go # Auth + JWT generation
CronService.go # Scheduled tasks
AWSSNSService.go # Email sending (SMTP, despite name)
B2BDelegationService.go # Inter-company package delegation
Models/ # Data structures
Package/ # PackageModel, DTOs
Client/ # Client, WebhookConfig
Courier/ # Courier model
Administration/ # Admin model
Warehouse/ # Warehouseman model
Repository/ # Database connection
Owner, Admin, Client, Courier, Warehouseman, Pepsiman (package shop staff)The core of package management. Each status transition is an "intent" executed via IntentV2Service.executeForPackage().
Key intents: PrimiPaket (receive), Magaciniraj (warehouse), ZaduziKurira (assign courier), Dostavi (deliver), VratiPaket (return), Korekcija (correction).
Each intent:
Middleware checks JWT claims against allowed roles per endpoint:
[]string{"Any"} - any authenticated user[]string{"Owner", "Admin"} - admin operations[]string{"Client"} - client portal operations[]string{"Courier"} - mobile app operationsSPA for clients to create packages, track shipments, manage settings, and view delivery history. Uses standalone components, Tailwind CSS for styling.
Key features:
Full management interface for PinDelivery administrators. Uses NgRx for state management.
Key features:
Android app for couriers and warehousemen. Barcode scanning for package processing.
Key features:
PinDelivery is the primary vendor. The system supports B2B delegation to partner vendors for packages outside the delivery zone.
Supported vendors: PinDelivery, TopOMS, Transfera, DExpress, Shoptimax, PostExpress
Note: Database stores vendor values without spaces (e.g., PinDelivery not Pin Delivery).