Dev.to AI ðŸĪ– Ai 👁 0 📖 8 min read

BunonBrain: Building an AI operations OS for Bangladesh's garment factories

Most ready-made garment (RMG) factories in Bangladesh already generate the data they need to run well. The problem is timing. A sewing machine vibrates out of spec at 9:30 AM, defects pile up on Line 3, or an overtime ca

Most ready-made garment (RMG) factories in Bangladesh already generate the data they need to run well. The problem is timing. A sewing machine vibrates out of spec at 9:30 AM, defects pile up on Line 3, or an overtime cap gets crossed, and the factory manager finds out at the end of the shift from a clipboard tally or a WhatsApp photo. By the time spreadsheets catch up with the floor, the hour is gone and the shipment deadline is at risk.

For the International AI Builders Congress 2026 (hosted by CloudCamp Bangladesh and Daffodil International University), our 5-member team across product, engineering, operations, research, and QA built BunonBrain under the IndustrySphere AI domain for the Idea to Unicorn track.

Live app: https://bunonbrain-web.onrender.com/

Why we built BunonBrain

Walk onto a mid-tier RMG floor in Gazipur or Ashulia and you will see four separate worlds running in parallel. HR tracks attendance and overtime in one sheet. Production supervisors track hourly output on paper boards. Quality inspectors tally defects by hand and summarize DHU (Defects per Hundred Units) once a week. Merchandisers juggle PDF purchase orders, BOMs, and revised tech packs over email.

Existing enterprise ERPs assume every factory is ready to buy expensive hardware, wire every machine on day one, and train floor staff on English-only desktop software. Mid-tier plants rarely work that way.

We designed BunonBrain around three constraints:

  1. Start from existing factory records (CSVs, PDFs, photos, and forms) with zero mandatory hardware, then plug in RFID readers, MQTT machine counters, and CCTV cameras when the plant is ready.
  2. Run in both English and āĶŽāĶūāĶ‚āĶēāĶū so office staff and floor supervisors use the same screens.
  3. Keep humans in charge of every high-impact decision. AI proposes; managers approve, and every decision lands in an append-only audit log.

About the competition

The International AI Builders Congress 2026 is a six-month builder program culminating in Congress Day on December 26, 2026 at Daffodil International University in Dhaka, bringing together more than 5,000 builders across 11 domains and 55 challenges. Submissions in the Idea to Unicorn competition are scored across six weighted areas: Innovation (20%), Technical Execution (20%), Business Model and Global Readiness (20%), Real-World Impact and Ethical AI Compliance (20%), Scalability and NRB Collaboration (10%), and Presentation (10%).

That rubric pushed us away from a thin LLM wrapper. We built a production-style system with strict access boundaries, deterministic fallbacks, real database migrations, and automated integration tests.

System architecture

BunonBrain splits into four services, roughly 193,000 lines of application code across C#, TypeScript, and Python:

Service Stack Scope
Backend API .NET 10 (ASP.NET Core), EF Core 10, PostgreSQL + pgvector, SignalR, MQTTnet, SkiaSharp + HarfBuzzSharp 32 controllers (438 endpoints), 33 domain entity files, 31 migrations, 60 test files
Web frontend Next.js 15 (App Router), React 18, TypeScript, Tailwind CSS, Zustand, Recharts, ReactFlow 168 pages (115 authenticated /app routes, 40 public site/docs routes, 13 auth and onboarding routes)
PDF RAG service Python, FastAPI, LangChain, PyMuPDF, Gemini embeddings, OpenAI LLM, Qdrant Cloud Dedicated ingestion up to 50 MB, broken subset-font repair, cached retrieval
Edge computer vision Python 3.11+, FastAPI, PyTorch 2.6, Ultralytics YOLO, ByteTrack, OpenCV Optional on-premise service running next to factory CCTV cameras

The browser only talks to Next.js, which proxies /api/* and /hubs/* to the .NET API. The API owns authentication, permissions, relational state in Supabase PostgreSQL, real-time SignalR broadcasts (/hubs/factory and /hubs/monitoring), and encrypted credential storage for LLM keys and camera streams.

Core modules

1. Access control built around real factory roles

A factory cannot give every employee the same dashboard. BunonBrain defines 14 system roles and 88 permissions across four scopes: Platform, Factory, Line, and Self.

A Factory Manager oversees all lines in their assigned factory and approves plans and overtime. A Production Supervisor only sees their assigned sewing lines, workstations, and line alerts. An HR / Attendance Officer manages worker profiles, shifts, leave, and corrections without touching machine telemetry. A Monitoring Operator watches cameras and escalates alerts without editing salaries or attendance. A Worker sees only their own profile, shift, workstation, and break history. Every endpoint checks permissions server-side, backed by an automated EndpointAccessMatrixTests suite.

2. Worker management (the People suite)

Worker records are permanent in BunonBrain. Each worker gets a sequential ID (W-001, W-002, ...) from a PostgreSQL sequence and is never deleted. Leaving the plant is a status transition (Active, Inactive, Suspended, Resigned, Terminated) with mandatory reasons for suspensions and separations so historical attendance and payroll links never break.

Inside the People suite:

  • Workforce overview: Live headcount by department and line, flagged attendance exceptions, leave and overtime queues, and line performance coverage.
  • Worker directory and CSV import: Bulk upload up to 2,000 rows per file with a dry-run validation preview before anything writes to Postgres. The parser checks 17 columns, normalizes Bangladeshi phone numbers, prevents duplicate employee codes, enforces a minimum working age of 14 on the joining date, and matches departments, floors, and lines against the target factory.
  • Attendance, shifts, and RFID: Shift schedules, holiday calendars, check-ins, breaks, excusal corrections, and manager-approved overtime.
  • Workstation assignments: An interactive station grid per sewing line to spot open seats, filter down to one line, and log worker transfers.

3. Production planning, merchandising, documents, and inventory

Buyer orders enter through Merchandising, where teams upload versioned POs, tech packs, and spec sheets (PDF, DOCX, CSV, or text). Extraction runs rule-based parsers first and calls an LLM only for missing fields, storing the quoted source next to every extracted value and flagging conflicts between document versions.

From there, Planning tracks style operation sequences, SMV-based line efficiency, WIP, delivery delay risk, time-study bottlenecks, and line-balancing proposals. Daily production plans require approval before publication and compare planned targets against verified output counts.

For paperwork, BunonBrain ships a structured document engine covering production, HR, store, quality, compliance, and shipping workflows with three approval levels (NONE, SINGLE, REVIEW_AND_APPROVE). Because Linux containers lack Bengali system fonts by default, we embedded Noto Sans and Noto Sans Bengali directly into the .NET assembly and render PDFs with SkiaSharp and HarfBuzzSharp so Bangla text shapes properly on any host. Store stock and goods received notes feed a live inventory ledger with low-stock reorder alerts.

4. AI quality inspection with human control

Quality inspection starts with a photo upload. The inspector selects the garment type, inspection stage (inline, end-line, or final), and target defect categories. Our vision pipeline tiles and analyzes the image, returning bounding boxes, confidence scores, severity tags, and root-cause notes.

The AI never closes an inspection on its own. Inspectors accept, correct, or reject each bounding box, draw new boxes directly on the garment photo for any missed defect, and record the final Pass, Rework, or Reject verdict. All plant DHU metrics calculate strictly from human-reviewed records.

5. Grounded AI Assistant, Factory Brain graph, and Agents

Factory SOPs are useless if a supervisor has to dig through a 40-page binder to check a needle-policy threshold. Ask BunonBrain runs hybrid retrieval (pgvector + BM25 plus the Qdrant PDF service) over indexed factory manuals, AQL guides, machine error tables, and safety SOPs.

Three practical choices make it usable on a real floor:

  • Exact citations: Ask about the fabric defect point system and it pulls the breakdown straight from the exact page of your quality manual.
  • Banglish and Bangla support: Ask "Metal detection standard ki?" and it answers in Bangla with the 1.0 mm tolerance and the verbatim source quote.
  • Zero-cost repeat caching: Repeat questions hit the answer cache instead of burning another LLM call.

Alongside chat, Factory Brain draws the live plant as an interactive ReactFlow graph linking floors, lines, machines, buyer orders, and open risks with dark mode, zoom, and node filters. Agents (Line Efficiency, Maintenance and Uptime, and Manager Orchestrator) inspect live records and manuals, admit plainly when a manual does not cover a specific vibration fix instead of hallucinating a repair, and send proposed actions to the manager approval queue.

6. Privacy-first monitoring and zero-GPU Camera AI

We took a firm line on worker privacy: BunonBrain never uses facial recognition and never scores individual productivity from video.

Camera tracking works in two modes. Factories with local hardware can run our Python computer-vision/ service (YOLO + ByteTrack + polygon zones) on a PC next to their NVR. Plants without a GPU can start a Camera AI session from a browser webcam, where the .NET server samples frames at configurable intervals, enforces daily API call caps, runs temporal confirmation to filter flicker, and emits structured events (PERSON_DETECTED, ACTIVITY_CHANGED, PPE_VIOLATION) to the SignalR monitoring room.

When a plant wants verified worker-to-zone identity, our association engine links an anonymous camera track to a worker only when an active RFID card is scanned at a reader mapped to that worker's assigned workstation and exactly one track occupies that zone. Ambiguous cases go to a manual review queue, and raw card UIDs are never exposed in API responses.

Engineering trade-offs and honest limits

Deploying a multi-service ERP on a free cloud budget forced real engineering trade-offs:

  1. Cold starts and ephemeral storage on Render Free: Our live preview runs across three Render free-tier web services (Next.js, .NET API, and Python RAG) paired with Supabase and Qdrant Cloud. Services sleep after 15 minutes of inactivity, and Render Free has no persistent disk, meaning uploaded QC photos and binary attachments disappear on container restart while PostgreSQL records persist. Moving file storage (WorkerPhotoStore, DocumentFiles, CameraFileStore, LocalFileMerchDocumentStore) to Supabase Storage or Cloudflare R2 is our top priority before piloting with a live plant.
  2. Simulated vs. real telemetry separation: Every simulator in BunonBrain (sensors, RFID, IoT counters, monitoring room) tags its records as simulated. Simulated events never overwrite live factory status.
  3. Testing without burning API credits: Our 60 backend test files spin up disposable pgvector/pgvector:pg16 containers via Docker, intercept all outbound HTTP traffic, and test auth, RBAC, RAG retrieval, and approval flows against local fakes. Our Playwright E2E suite runs the full stack locally with the same isolation.
  4. Custom garment-activity model: The computer-vision/ service includes dataset tooling, training, and inference scaffolding for a CNN+GRU garment activity classifier (sewing, cutting, packing), but we have not trained it on real factory floor footage yet. Rather than faking accuracy numbers, its status is labeled clearly in the codebase and UI.

Try it out

You can explore the live deployment here: https://bunonbrain-web.onrender.com/

If you are working on industrial ERP software, applied RAG in Bangla/Banglish, or manufacturing computer vision, I would love to hear your thoughts or critiques in the comments, especially around offline-first floor sync and low-cost edge deployment for garment factories.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.