Skip to content

Repository files navigation

Wrenchbase

Maintenance management (CMMS) for facilities and manufacturing teams, with a technician app built for the plant floor.

Live demo: https://www.freelancerportfoliohub.com/jameslee/projects/wrenchbase/index.html

Preview

Overview

Wrenchbase connects the whole maintenance loop on one data model: a request comes in, a supervisor turns it into a work order, a technician works the checklist and logs labor and parts, and the asset history, stock levels and reports update at the same time.

This repository contains the product website and the CMMS service behind it. The service, cmms-api/, is a Kotlin (Ktor) application that owns the domain: assets, work orders, preventive schedules, parts, technicians and reliability reporting, seeded with a sandbox plant. The site's product visuals — the work-order board, PM calendar, asset record, inventory table, reporting dashboard, request portal and the technician app screens — are React components rendered on the server from that live sandbox data rather than screenshots, so they stay sharp at every size and always match the real data model.

Features

  • Marketing site — Home, Platform, Mobile app, Pricing and Book-a-demo pages
  • Product mockups in code — board, calendar, asset panel with a hand-rolled SVG sparkline, inventory with stock bars, stacked-bar dashboard, three technician-app screens; the data-driven panels fall back to a short notice if the service is unreachable
  • Pricing — yearly/monthly toggle ("2 months free"), plan comparison table and FAQ
  • Demo & trial form — submitted through a server action; the service validates it and the field errors are shown inline
  • Work orders
    • GET/POST /api/work-orders — board view with filters (status, assignee, priority, overdue, asset or location subtree), create from other systems
    • GET/PATCH /api/work-orders/:id — status state machine, assignment, checklist ticks
    • POST /api/work-orders/:id/complete — books labor, consumes parts all-or-nothing, records downtime and asset history, rolls the PM schedule forward, drafts reorders at min level
    • POST /api/work-orders/:id/assign and GET …/assignment-suggestions — technician ranking by trade, current workload and history on the asset
  • Assets — location tree and asset hierarchy (systems own their components), asset record with downtime, open work, year-to-date cost and condition trend, floor-reported downtime
  • PM scheduling — fixed and floating calendar intervals, meter triggers with lead-time estimates from the usage rate, condition triggers; a background sweep generates due work once, never twice, and GET /api/pm/calendar forecasts the working week
  • Meter & condition ingest — POST /api/meter-readings and POST /api/condition-readings (keyed); readings never go backwards unless flagged as a meter replacement
  • Parts inventory — stock status and reservations, reorder drafts, purchase orders, receipts, cycle counts and usage-based reorder-point suggestions
  • Request portal — POST /api/requests with duplicate detection per location, triage and conversion into prioritised work
  • Reporting — MTTR, MTBF, availability, PM compliance, planned vs. reactive work, downtime by asset and top causes (GET /api/reports/overview)

Tech stack

Layer Choice
Site Next.js 15 (App Router), React 19, TypeScript (strict)
Styling Plain CSS design system (styles/), self-hosted fonts
Service Kotlin on the JVM (21), Ktor with Netty, kotlinx.serialization
Build Gradle (Kotlin DSL, version catalog, wrapper)
Tests JUnit 5 with Kotest assertions, Ktor test host
Data In-memory store seeded from cmms-api/src/main/resources/seed

Getting started

You need Node 22 with pnpm, and JDK 21 for the service (the Gradle wrapper fetches Gradle).

# 1. the CMMS service on http://localhost:8080
cd cmms-api
METER_INGEST_KEY=dev-key ./gradlew run

# 2. the site on http://localhost:3000, in a second terminal
pnpm install
cp .env.example .env.local
pnpm dev

The sandbox plant is reloaded every time the service starts; its dates are anchored to the plant's local day, so the board, calendar and reports always show a current week.

Environment variables

Variable Used by Description
API_URL site Base URL of cmms-api (default http://localhost:8080)
NEXT_PUBLIC_SITE_URL site Canonical site URL for metadata and the sitemap
PORT service Port to listen on (default 8080)
METER_INGEST_KEY service Shared key meter gateways send in the x-wrenchbase-key header
SALES_INBOX service Inbox that receives demo and trial requests
PM_SWEEP_MINUTES service Minutes between preventive-maintenance sweeps (0 turns it off)

Example: closing a work order

curl -X PATCH http://localhost:8080/api/work-orders/wo-2481 \
  -H 'content-type: application/json' \
  -d '{ "checklist": [{ "id": "step_3", "done": true }, { "id": "step_4", "done": true }, { "id": "step_5", "done": true }] }'

curl -X POST http://localhost:8080/api/work-orders/wo-2481/complete \
  -H 'content-type: application/json' \
  -d '{ "laborSeconds": 2538, "partsUsed": [{ "partId": "part_0412", "quantity": 2 }], "signedOffBy": "Maria G." }'

Invalid bodies come back as 422 with { "error": { "code": "validation_failed", "details": { "formErrors": [], "fieldErrors": { … } } } }; domain conflicts such as an incomplete checklist or missing stock are 409 with their own code.

Tests

cd cmms-api && ./gradlew test     # domain, service and HTTP tests
pnpm typecheck && pnpm lint       # site

Deploying

cmms-api/Dockerfile builds and tests the service and runs it on a slim JRE, listening on $PORT. On Railway, create one service with its root directory set to cmms-api (the Dockerfile is picked up automatically) and point the site's API_URL at it.

Project structure

.
├── app/                  # Pages, layout, fonts; demo form server action
│   ├── demo/
│   ├── mobile/
│   ├── platform/
│   └── pricing/
├── cmms-api/             # Kotlin service (Gradle)
│   ├── Dockerfile
│   └── src/
│       ├── main/kotlin/com/wrenchbase/cmms/
│       │   ├── domain/       # work orders, inventory, PM scheduler, reliability, hierarchy
│       │   ├── service/      # use cases over the store
│       │   ├── api/          # Ktor routes, request parsing, views, error mapping
│       │   ├── validation/   # field-by-field request validation
│       │   ├── seed/         # sandbox loader
│       │   └── store/        # in-memory state behind one lock
│       ├── main/resources/seed/plant2.json
│       └── test/kotlin/      # domain, service and API tests
├── components/
│   ├── demo/             # intro + demo/trial form
│   ├── home/             # hero, problems, product tour, technician app, rollout
│   ├── layout/           # header, footer, logo
│   ├── marketing/        # feature rows, page hero, CTA, testimonials, customer logos
│   ├── mobile/
│   ├── mockups/          # product UI rendered in code (board, calendar, panels, phones)
│   ├── platform/
│   ├── pricing/
│   └── ui/               # icon set, buttons, section heads, cards, spec lists
├── lib/
│   ├── cmms-api.ts       # server-side client for the service
│   └── data/             # typed page content
├── styles/               # CSS split by concern, imported in cascade order
└── types/                # service response and content types

Scripts

Script Description
pnpm dev Start the site with Turbopack
pnpm build Build the site
pnpm start Serve the production build
pnpm lint Run ESLint
pnpm typecheck Type-check with tsc --noEmit
pnpm format Format with Prettier
pnpm api:dev Run the CMMS service (./gradlew run)
pnpm api:test Run the service's tests

In cmms-api/: ./gradlew run, ./gradlew test and ./gradlew buildFatJar (writes build/libs/cmms-api.jar).

Releases

Packages

Contributors

Languages