AI Engineering Case Studies

Four systems,
one way of working

Deep dives into how I ship: an AI CRM copilot built end-to-end, a multi-provider LLM assistant platform running in production, and full-stack ownership of two live commercial systems.

Featured — AI CRM Copilot

A working CRM MVP built solo against a real "Lead AI Software Engineer" take-home brief: companies / contacts / leads / pipeline, a persistent Postgres backend, an AI sales copilot, a LINE Official Account integration, and a full audit trail — plus the BA → SA → PM → QA documentation trail behind it, not just the code.

Live demo 4 Playwright E2E suites Every mutation audit-logged

Stack & delivery

Next.js 14 (App Router), TypeScript strict, Zod on every API boundary, Prisma over PostgreSQL. Auth is a signed HS256 session cookie — deliberately not SSO, called out as an explicit scope cut rather than left unstated. Deployed on Vercel against a managed Postgres, auto-deploying from main.

AI Copilot — pluggable, with a real fallback path

The copilot sits behind one interface, AiCopilotEngine, with two implementations: a real LLM provider call (or a deterministic simulated response when AI_MOCK_MODE=true, so it's demoable without an API key) and a HeuristicFallbackEngine that takes over automatically on any provider timeout or 5xx/429. Same response shape either way — the service layer and UI never branch on which one answered. Guardrails are written into the skill spec itself: the copilot cannot write to the database or send a LINE message without human confirmation, and PII is redacted from the LLM context before the call goes out.

How it was built — AI-orchestrated, human-verified

Delivered as a structured 5-agent pipeline (BA → SA → PM → DEV → QA) with Claude Code executing under explicit guardrails — strict typing, Zod everywhere, an audit-log row on every mutation, zero unstated assumptions. I didn't stop at green checks. Three real issues were caught by manually inspecting behavior, not by a passing test suite:

  • A password-hash leak — a natural-looking Prisma include: { owner: true } was returning full User rows, hash included, in every lead API response. Caught by reading a raw response body instead of trusting the 200. Fixed with an enforced safe-select pattern everywhere a User relation loads.
  • An RBAC bypass — the leads list endpoint checked "is there a session," not "does this role scope to their own leads," so a Sales Rep could pass ?ownerId=<anyone> and read team-wide data. Fixed in the service layer before the RBAC spec was allowed to pass.
  • A test hook that would have silently gone dark in production — gated on NODE_ENV !== 'production', it could never fire once E2E ran against a prod build. Replaced with an explicit flag instead of overloading build mode as a proxy for "is this a test."

AI Engineering — Personal R&D

Hermes — a Discord-native AI assistant I designed and built solo, running continuously: ~17,000 lines across 122 source files. The interesting engineering isn't "call an LLM" — it's routing, cost control, and failure handling across four providers, plus an agentic tool layer exposed over MCP.

Provider routing, not a single API call

A router spans Gemini, Groq, DeepSeek, and OpenRouter, with a per-mode fallback chain and a free-tier-only enforcement mode. Each provider has its own multi-key pool with automatic cooldown — one hour on a rate-limit error, twenty-four on an invalid key — so one exhausted key degrades gracefully instead of taking a feature down.

Agentic, not just conversational

A two-phase intent-detection pass (fast regex/entity extraction, then one small LLM call to disambiguate) routes requests into a bounded tool-calling agent loop. The same tool set is exposed a second way — as a standalone MCP server over stdio — so the tools aren't locked to the Discord surface.

Job-hunt pipeline — the deepest subsystem

Scrapes multiple job boards in parallel, scores each posting against a CV for fit, and drip-delivers ranked matches instead of a single dump — built to be genuinely usable daily, not a one-off scraper script.

Memory that survives a restart

A lightweight RAG-style memory layer with keyword retrieval, populated automatically from conversation (not manually curated) and persisted across process restarts — so context isn't lost every time the process redeploys.

What it actually does

Job-hunt scraping + CV scoring Market watch + news correlation Daily tech digest (scheduled) Long-term memory (RAG-lite) Recurring ops support Persona build pipeline

Full-Stack Ownership — End to End

A production healthcare-sector web platform, sole ownership start to finish: architecture, backend, the internal admin platform, and the engineering standard the codebase is held to.

backend — public-facing API layer

Nuxt 4, TypeScript, Bun, Pinia, mysql2. Eighteen API routes, every one gated by a session check with no exceptions, Zod-validated input, a Sharp-based image pipeline, Sentry wired in.

office — internal admin platform

The larger of the two: 566 files, 58 pages across 14 domain modules — FDA compliance, production, QC/stability, supplier management, user administration, and more. A real permissions system enforced on both server and client, covered by 16 Playwright E2E specs.

The standard, not just the code

Authored the governance doc both repos are built against — service-layer SQL only, thin pages, auto-generated OpenAPI docs, and a strict lint → E2E → build gate that has to pass before anything ships. Actively migrating legacy CodeIgniter-3 admin modules onto this platform module by module.

Enterprise Systems — Scoped Contribution

A larger team-owned pawnshop & fintech platform where my contribution is scoped, not full-stack ownership: two systems built end-to-end, and defined modules inside two others.

Point-of-Sale System (full ownership)

PHP 7.2, a custom lightweight MVC. 20 controllers, 31 models, 17 views. Sentry-instrumented, with documented PDPA-aware logging and audit-readiness built in from the start.

Old language, current-generation discipline

PHP 7.2 is a constraint I engineer around, not an excuse. Every public and cron-triggered endpoint sits behind Cloudflare (WAF rules, rate limiting, access policies) rather than being exposed directly; staff/admin login runs through Azure SSO instead of a local password table; and data integrity under concurrent writes is enforced at the database layer — Stored Procedures, Computed Columns, and explicit locking to prevent lost updates, not just application-side checks. This is built to KPMG audit-readiness standards spanning both sales operations and the technology stack — designed in from the start, not a retrofit after the fact.

Outlet Storefront (full ownership)

Nuxt 2 / Vue 2 with Vuetify, shipped as a PWA and — via Capacitor wrapping the same codebase — as a hybrid mobile app for the same storefront.

Checkout & ERP Integration — scoped modules

Built the sale/checkout module (cart, pricing, coupons, delivery, purchase-order creation with inventory-state guards against double-selling one-of-a-kind items), and a scheduled OAuth2 REST sync that reconciles Oracle inventory data into the local schema with anomaly alerting and full audit logging.

Notification Gateway — one API, many senders

A centralized notification gateway that normalizes alerts from multiple internal systems into formatted Adaptive Cards posted to Microsoft Teams — severity levels, channel routing, and structured audit logging on every send. Callable directly over HTTP or as a child flow from a colleague's Power Automate workflow, so non-developers on the team can trigger the same standardized alert pipeline without touching code.