Fish Marketplace Connecting Fishermen and Buyers
A digital marketplace for perishable catch with offline-first apps for fishermen, harbor auctions, cold-chain IoT, quality grading, digital payments and logistics in low-connectivity coastal regions.
[!ASSUMPTION] Scope "SeaLink", a hypothetical platform for a coastal state with 40 harbors, 25,000 registered fishermen/boat owners, and buyers ranging from hotels and retailers to exporters. Numbers, prices and regulations are assumptions to be validated with local fisheries departments.
1. Business problem and objectives
Fishermen sell to middlemen at the harbor with little price visibility; catch spoils when buyers are scarce; buyers face inconsistent quality and traceability. Objectives:
- Increase fishermen's realized price by 15–25% through transparent price discovery.
- Cut post-harvest loss (spoilage) by 30% via pre-sale listing while at sea and cold-chain logistics.
- Give buyers graded, traceable supply (species, catch area, time, temperature history).
- Pay fishermen within hours, digitally.
- Work with intermittent connectivity at sea and in harbors, and on low-end phones.
2. Business model and revenue generation
| Stream | Description |
|---|---|
| Transaction commission | 2–5% from buyer and/or seller per sale |
| Logistics fees | Cold-chain transport and storage charges |
| Subscriptions for institutional buyers | Priority access, standing orders, analytics |
| Embedded finance | Working-capital loans and insurance via partners using transaction history |
| Data and traceability services | Certification support for exporters |
3. Functional requirements
- Fisherman onboarding (KYC light, boat registration, bank/UPI details), local-language UI and voice.
- Catch pre-listing from sea (when connectivity allows) and at landing: species, estimated weight, photos, landing harbor, ETA.
- Sales modes: live harbor auction (digital bidding at the dock and remotely), fixed-price listings, pre-booked standing orders.
- Quality grading at landing (manual grader app + optional image-based assistance), weighing integration.
- Buyer app/web: browse by harbor/species, bid, buy, logistics booking, invoices.
- Cold-chain: insulated/reefer vehicles and cold storage with temperature sensors.
- Payments: buyer prepaid wallet/escrow, settlement to fishermen after weighing confirmation.
- Traceability: lot ID from boat to buyer with temperature history.
- Price information: daily harbor prices by species, broadcast via SMS/WhatsApp.
- Harbor operations dashboard for co-operatives and authorities.
4. Non-functional requirements
| Attribute | Target |
|---|---|
| Offline tolerance | Listing and grading apps fully usable offline; sync when connectivity returns |
| Latency | Live auction bid round-trip < 500 ms for online bidders |
| Availability | 99.9% for auctions during landing windows (typically early morning) |
| Correctness | No double sale of a lot; payments exactly once |
| Device constraints | Android 8+, 2 GB RAM, small APK; works on 2G/3G |
| Language | Local languages + voice prompts; icon-heavy UI for low literacy |
| Data | Temperature telemetry retained for traceability (e.g. 2 years) |
5. Expected user base and traffic assumptions
- 25K sellers, 6K buyers; 40 harbors; ~8K lots/day; peaks of ~1,500 lots/hour in the morning landing window.
- Auctions: ~200 concurrent live auctions; ~50 bidders each; bid bursts of a few hundred per second platform-wide.
- IoT: 600 reefer vehicles and 80 cold rooms, a reading every 60 s → ~11 readings/s (small, but intermittent and batched).
- Data volume is modest; the hard problems are connectivity, trust, perishability and operations, not raw scale.
6. High-level architecture
- Edge at harbors: a small harbor hub (rugged mini-server or cloud-connected gateway) with local Wi-Fi so auctions at the dock continue during internet outages, syncing to the cloud.
- Mobile apps: offline-first fisherman app, grader app, buyer app; plus SMS/WhatsApp/IVR channels.
- Cloud core: listings, auction service, orders, payments/escrow, logistics, traceability, pricing analytics, notifications.
- IoT: temperature sensors on vehicles and cold rooms via cellular gateways → IoT broker → time-series store → alerts.
7. Detailed component architecture
| Component | Responsibility | Design choice and reason |
|---|---|---|
| Sync service | Bidirectional sync of listings, grades, weights between devices/harbor hub and cloud | Event log with client-generated IDs (ULIDs); conflict rules per entity |
| Listing service | Lots with species, grade, weight, photos, status | Relational; lot state machine |
| Auction service | English (ascending) auctions with timed close and anti-sniping extension | Single-writer actor per lot; WebSocket broadcast |
| Harbor hub | Runs a local auction instance when cloud is unreachable | Lot ownership leased to hub or cloud to prevent double sale |
| Grading | Grader app with checklist and photos; optional ML species/quality hints | Trust through independent grading |
| Weighing | Bluetooth/serial scale integration in grader app | Removes manual weight disputes |
| Payments | Buyer wallet top-up via UPI/net banking; escrow; settlement to fishermen | Pay-out after weighing confirmation; ledger |
| Logistics | Vehicle booking, routes, pickup slots, cold room bookings | Integrates partner fleets |
| Traceability | Lot genealogy and temperature history; QR on crate | Export/compliance value |
| Price intelligence | Daily prices per species/harbor; forecasts | Broadcast via SMS/WhatsApp |
8. Architecture diagram
flowchart TB
subgraph Sea & harbor
FA[Fisherman app<br/>offline-first] -.sync when online.-> HUB
GA[Grader app + scale] --> HUB[Harbor hub<br/>local auction + sync]
DOCK[Dock bidders on Wi-Fi] --> HUB
end
subgraph Cloud
SYNC[Sync service]
LIST[Listings]
AUC[Auction service]
ORD[Orders]
PAY[Payments, escrow, ledger]
LOG[Logistics & cold storage]
TR[Traceability]
PRICE[Price intelligence]
NOTI[Notifications<br/>SMS, WhatsApp, push, IVR]
TS[(Time-series DB)]
DB[(PostgreSQL)]
end
HUB <--> SYNC
FA -.direct when online.-> SYNC
BA[Buyer app / web] --> AUC
BA --> ORD
SYNC --> LIST --> DB
AUC --> ORD --> PAY
ORD --> LOG
SENS[Reefer & cold room sensors] --> IOT[IoT broker MQTT] --> TS
TS --> TR
LIST --> TR
ORD --> NOTI
PRICE --> NOTI
PAY --> UPI[(UPI / bank rails)]9. Frontend architecture
- Fisherman app: Android (Kotlin) for size and offline control; local SQLite with an outbox; voice input for species and quantity; large icons; works with intermittent 2G; photos compressed on device and uploaded opportunistically.
- Grader app: checklist-driven grading, scale integration over Bluetooth, label/QR printing, offline-capable.
- Buyer app and web: PWA/React for institutional buyers; live auction view over WebSocket with fallback to polling; price alerts.
- Channel fallbacks: SMS commands ("SELL PRAWN 40KG HARBOR2"), WhatsApp Business flows, and IVR in local languages for those without smartphones.
10. Backend architecture
- Modular monolith first (Java/Kotlin Spring Boot or Node) with clear modules (listings, auctions, orders, payments, logistics, traceability). The user and transaction volumes do not justify many microservices; a small team needs simplicity.
- Auction module isolated as a separate deployable later if bidding load grows.
- Ownership leases for lots: each lot is owned either by the cloud auction service or by a harbor hub at a time; ownership transfers via the sync protocol. Only the owner can accept bids or sell, preventing double sales during network splits.
- Sync protocol: devices push events (
LotCreated,LotGraded,WeightRecorded) with client IDs; server returns acknowledgements and new server events since the last checkpoint.
11. API design with sample endpoints
POST /v1/sync { deviceId, lastServerSeq, events: [ { id, type: "LotCreated", at, data } ] }
-> { accepted: [ids], rejected: [{ id, reason }], serverEvents: [...], serverSeq }
GET /v1/lots?harbor=H2&species=prawn&status=OPEN
POST /v1/lots/{lotId}/bids Idempotency-Key: ... { amountPerKg: 410.00 }
GET /v1/auctions/{lotId}/stream (WebSocket: bids, time remaining, winner)
POST /v1/orders/{orderId}/logistics { vehicleType: "REEFER", pickupWindow: "06:30-07:00" }
POST /v1/wallets/topups { amount, method: "UPI" } -> { paymentLink }
GET /v1/lots/{lotId}/trace -> { boat, catchArea, landedAt, grade, weights, temperatureSeries[] }12. Database schema and data model
CREATE TABLE lot (
lot_id text PRIMARY KEY, -- client-generated ULID
seller_id text NOT NULL, boat_id text, harbor_id text NOT NULL,
species text NOT NULL, grade text, est_weight_kg numeric(8,2), final_weight_kg numeric(8,2),
sale_mode text CHECK (sale_mode IN ('AUCTION','FIXED','STANDING_ORDER')),
reserve_price_per_kg numeric(8,2),
status text NOT NULL, -- DRAFT, LISTED, GRADED, IN_AUCTION, SOLD, DELIVERED, UNSOLD
owner_node text NOT NULL, -- 'cloud' or harbor hub id (lease)
lease_expires_at timestamptz,
landed_at timestamptz, created_at timestamptz, version int NOT NULL
);
CREATE TABLE bid (
bid_id text PRIMARY KEY, lot_id text REFERENCES lot, buyer_id text, amount_per_kg numeric(8,2),
placed_at timestamptz, accepted boolean
);
CREATE TABLE settlement (
lot_id text PRIMARY KEY REFERENCES lot, buyer_id text, seller_id text,
gross numeric(12,2), commission numeric(12,2), logistics_fee numeric(12,2), net_to_seller numeric(12,2),
status text, paid_at timestamptz, payout_ref text
);Temperature readings in a time-series table: (device_id, ts, temp_c, door_open, battery) with lot-to-vehicle assignment intervals for traceability joins.
13. Database technology selection and reasoning
| Data | Store | Reason |
|---|---|---|
| Core transactional data | PostgreSQL (managed) | Small-to-medium scale, relational, strong consistency; team-friendly |
| Sync event log | PostgreSQL table or Kafka-compatible managed stream | Ordered server sequence for device sync |
| Harbor hub | SQLite/PostgreSQL on hub | Local operation during outages |
| Telemetry | TimescaleDB (PostgreSQL extension) or cloud time-series | Fits volume; one database technology to operate |
| Photos | Object storage + CDN | Cheap, scalable |
Choosing PostgreSQL + TimescaleDB keeps the platform to one database technology, which matters for a small team.
14. Authentication and authorization
- Fishermen: phone OTP + app PIN; assisted onboarding by co-operative staff; device binding.
- Buyers: business verification (GST/registration), credit limits, wallet.
- Graders and harbor staff: role-based accounts tied to a harbor; actions signed with user and device IDs for audit.
- Authorization rules: only the seller (or co-operative on their behalf) can list; only graders at that harbor can grade; only the lot owner node can accept bids.
15. Security architecture
- Payments via regulated payment aggregator/UPI; escrow held by a licensed partner; ledger for every movement.
- Tamper-evident audit of grades and weights (signed events with timestamps; scale readings captured digitally).
- Fraud controls: collusive bidding detection, buyer default limits, duplicate lot detection by photo hashing.
- Data privacy: minimal personal data; consent for sharing transaction history with lenders.
16. Caching strategy
- Price boards and lot lists per harbor cached briefly; buyer apps subscribe to deltas.
- Species and harbor reference data cached on devices for offline use.
17. Messaging and event-driven architecture
- Domain events:
LotListed,LotGraded,AuctionStarted,BidPlaced,LotSold,WeightConfirmed,PaymentSettled,TemperatureExcursion. - Notifications fan out by preferred channel (push/SMS/WhatsApp/IVR).
- Temperature excursions (> 4 °C for chilled fish beyond tolerance) trigger alerts to driver, logistics ops and buyer, and are attached to the lot trace.
sequenceDiagram participant F as Fisherman app (at sea) participant H as Harbor hub participant C as Cloud participant B as Buyer F->>F: create lot offline (ULID, species, est. weight, photo) F-->>C: sync when signal returns (LotCreated) C->>B: notify buyers: incoming prawn ~40 kg at H2, ETA 06:10 F->>H: at landing, lot synced locally H->>H: grade + weigh (grader app, scale) C->>H: transfer lot lease to hub (auction at dock) B->>H: bids (dock Wi-Fi) / remote bids via cloud relay H->>H: auction closes, winner selected H-->>C: LotSold, lease returned C->>B: debit escrow wallet C->>F: payout after WeightConfirmed (UPI)
18. Cloud deployment architecture
- Single cloud region in-country (data residency, cost), multi-AZ managed PostgreSQL.
- Harbor hubs: rugged mini PCs with UPS, local Wi-Fi, 4G modem + secondary link; containerized hub software managed remotely (fleet updates).
- IoT: managed MQTT broker (AWS IoT Core / Azure IoT Hub / EMQX) with device certificates.
19. CI/CD and DevOps
- Monorepo; automated tests for sync conflict rules and auction logic (property tests for "no double sale").
- Staged rollout of hub software: one harbor first, then all; ability to roll back remotely.
- Android app releases with staged rollout; backward-compatible sync protocol versions.
20. Monitoring and observability
- Harbor hub health (online/offline, last sync, disk, battery/UPS).
- Business: lots listed vs sold, unsold rate by species/harbor, average price vs reference market prices, time from landing to sale, payout time.
- Cold-chain compliance rate; excursion count per vehicle.
21. Scalability and performance optimization
- Scale is modest; prioritize reliability. Auction service keeps hot lots in memory per owner with persistence of each accepted bid.
- Photo compression on device; upload over Wi-Fi when available.
- Expansion to more states adds harbors and hubs horizontally; the cloud core scales vertically for a long time.
22. High availability and disaster recovery
- Harbor hub continues local auctions during internet outages; reconciles after.
- Cloud multi-AZ; daily backups with PITR; DR via cross-region backups (RPO 15 min, RTO 4 h acceptable because hubs operate offline).
- Hub hardware spares at each district office.
23. Cost optimization
- Modular monolith on a small managed container platform; one database technology.
- SMS costs controlled by preferring push/WhatsApp where possible.
- Shared logistics routes (milk-run) to reduce cold-chain cost per kg.
24. Architecture trade-offs and alternatives
| Decision | Chosen | Alternative | When the alternative fits |
|---|---|---|---|
| Architecture style | Modular monolith + harbor edge | Microservices | Multi-state scale with several teams |
| Auction location | Hub-owned during dock auctions | Cloud-only auctions | Harbors with reliable fibre connectivity |
| Native vs cross-platform | Native Android | Flutter/React Native | If iOS needed and team prefers one codebase |
| Payments | Escrow via partner | Direct buyer-to-seller | High-trust long-term buyer relationships |
25. Technology stack recommendations
Kotlin Android; React/Next.js web for buyers; Spring Boot or NestJS modular monolith; PostgreSQL + TimescaleDB; Redis for auction pub/sub; MQTT broker; object storage + CDN; WhatsApp Business API, SMS gateway, IVR provider; payment aggregator with UPI; Grafana for ops dashboards.
26. Common architecture mistakes
- Assuming constant connectivity at harbors and sea.
- Designing a complex microservice platform for a small team and modest load.
- Manual weight entry causing disputes and fraud.
- Paying fishermen days later, losing trust versus cash middlemen.
- Ignoring co-operatives and local institutions in onboarding and dispute resolution.
- Treating cold-chain data as optional rather than core to quality and price.
27. Senior architect interview questions and answers
How do you prevent a lot being sold twice when the harbor is offline?
Ownership leases: a lot is owned by exactly one node (cloud or a specific hub) at a time, and only the owner can run its auction. The lease is transferred through the sync protocol with versioning. While the hub is offline, cloud buyers cannot bid on hub-owned lots, so no conflicting sale can occur.
How do you design sync for offline-first apps?
Client-generated IDs, an append-only local event outbox, server sequence numbers for incremental downloads, idempotent server processing, and per-entity conflict rules (e.g. grader's grade wins over seller's estimate; final weight from scale overrides estimates).
What would you build first?
Fixed-price listings and dock auctions at two harbors with fast payouts and price broadcasts, because trust and payout speed drive adoption; add logistics, IoT and finance later.
28. Enterprise architect interview questions and answers
How would you integrate with government fisheries systems?
Through APIs or file exchanges for boat registration, catch reporting and welfare schemes, with consent management; treat government systems as external bounded contexts behind an anti-corruption layer.
What principles guide this architecture?
Offline-first, inclusion (voice, local language, feature phones), trust through transparency (prices, grades, weights), simplicity for a small team, and traceability by default.
29. CTO-level business and technology questions
How do you make the business viable?
Reach liquidity per harbor (enough buyers per lot) before expanding, monetize logistics and embedded finance, keep tech costs low with a modular monolith, and partner with co-operatives for distribution.
Biggest risks?
Middlemen resistance, buyer payment defaults, connectivity, and cold-chain operational costs. Mitigate with escrow, partnerships, edge hubs and route optimization.
30. Real-world implementation roadmap
| Phase | Duration | Outcomes |
|---|---|---|
| 1. Pilot | 0–4 months | 2 harbors, fisherman and buyer apps, fixed-price + dock auctions, UPI payouts, SMS price board |
| 2. Grading and trust | 3–7 months | Grader app with scales, traceability QR, dispute process |
| 3. Cold chain | 6–10 months | Reefer and cold room IoT, logistics booking |
| 4. Expansion | 9–18 months | 40 harbors, harbor hubs, co-operative dashboards |
| 5. Finance and export | 15+ months | Working-capital loans, insurance, export traceability certifications |