Building an MES with AI-assisted development — what actually worked


I want to share a practical breakdown of building Basirah MES, a Manufacturing Execution System, using an iterative AI-assisted workflow inside VS Code. Posting this because MES is a genuinely hard domain and I think the friction points are more useful than the highlight reel.

Modules built:

  • Production management (production orders, work orders, scheduling)
  • Quality control (inspections, certifications, compliance tracking)
  • Inventory (real-time tracking + material transactions)
  • Equipment monitoring (status, maintenance schedules, OEE)
  • Shop floor control (barcode scanning, real-time tracking, operator UI)
  • Analytics and reporting (KPIs, performance metrics)

Stack:

Backend    Node.js / Express, PostgreSQL, JWT, WebSocket, Docker
Frontend   React + TypeScript, Material-UI, WebSocket client
Data       Knex migrations + seeds
Docs       Swagger at /api-docs
Tests      Jest (backend + frontend), Cypress for E2E

Workflow:

  1. Requirements first — modules, features, stack, database. Written down, not in my head.
  2. Generate a high-level project plan (architecture, module boundaries, data flow).
  3. Convert the plan into a focused initial prompt. This is the highest-leverage step.
  4. First run gives you project structure + DB scripts. Run the scripts on a cloud Postgres, drop the connection string into .env, and get to a green build.
  5. Iterate: npm run dev for both tiers, fix, refine, extend.

Things worth knowing if you try this:

  • The plan carries more weight than the prompt. For an MES, module boundaries (production vs. quality vs. inventory) have to be decided by you. Get that wrong and no amount of re-prompting saves you.
  • Real-time is where scaffolding gets thin. The WebSocket layer generates fine, but deciding what events to broadcast and how the UI reconciles them is design work.
  • Domain rules don't come from the model. OEE formulas, which quality checkpoints gate a work order, what "in progress" means on your floor — you supply all of that.
  • Migrations early. npm run migrate + npm run seed from the start means every iteration is reproducible instead of a manual DB fix.
  • Security is a manual pass. Default passwords, JWT secrets, CORS config, HTTPS in production. The generated code will happily ship insecure defaults. Docker compose has a separate SSL config for exactly this reason.

Biggest takeaway: treat the AI like a fast, tireless junior engineer. You architect, it builds, you review. Nothing goes into the system that you can't explain.

Happy to go deeper on the real-time layer or the OEE calculations if anyone's interested.

Comments

Popular posts from this blog

Beyond Random: The Hidden Symmetry of the World’s Most-Read Book

Three apps, three stacks, one AI-assisted workflow — a practical writeup

The Shadow Plumbing of the State: 5 Hidden Mechanics Re-Engineering Global Power