EU-focused metal calculator with:
- A Next.js web app built around a command bar for fast weight/price calculations.
- A shared
@ferroscale/metal-corepackage for formulas, datasets, validation, and the command query parser.
src/: main web app (Next.js App Router).packages/metal-core/: shared calculator and parser package.
- Node.js 20+
- npm 10+
npm installnpm run devOpen:
http://localhost:3000(redirects by locale)http://localhost:3000/en(direct English route)
# Web tests
npm run test
# Shared core tests
npm run test:core
# Web + core tests
npm run test:all
# i18n message parity (en/bs)
npm run i18n:check
# End-to-end tests (Playwright)
npx playwright test
# Web production build
npm run buildCI (.github/workflows/ci.yml) runs lint, the i18n check, both test
suites, and a production build on every push and pull request. Lint is
a hard gate — keep it green.
The command bar (and share links, e.g. /en?q=hea120+6m+x2) accepts
order-tolerant tokens:
- Profile + size:
hea120,shs40x40x3,rhs60x40x3,chs48.3x3.2,rnd20,flt40x8,l50x50x5,plt1500x3000x3 - Length:
6m,4500mm,10ft, or a bare number using the default unit from Settings - Quantity:
x2 - Grade:
s235,s355,304,316l,a4,6060,7075, … - Inline price override:
@2.50/kg,3,20/m,@12/pc
Examples:
hea120 6m x2 s235shs40x40x3 6m x10 @2.50/kgplt1500x3000x3 316
Main exports from @ferroscale/metal-core:
- Calculator engine:
calculateMetal,validateCalculationInput,resolveAreaMm2 - Command parser:
cmdParse,cmdTokenize,cmdSuggest,inputToQuery(UI-independent — also consumed by the Raycast extension, which lives in its own repository) - Datasets: profile/material definitions and helpers
- Locale routing config:
src/i18n/routing.ts - Messages:
messages/en.json,messages/bs.json - Missing locale keys fallback to English.
Add a new language:
- Add
messages/<locale>.json. - Register locale in
src/i18n/routing.ts. - Translate keys.
- Run
npm run i18n:check.
NEXT_PUBLIC_SITE_URL: public base URL used by sitemap/robots metadata.PLAYWRIGHT_CHROMIUM_EXECUTABLE(optional): path to a system Chromium for e2e runs without downloading browsers.
GET /api/healthGET /api/captchaPOST /api/contact/api/sync/google/*(Google Drive sync)
docs/DESIGN_REVIEW.md— full design/UX/architecture review and follow-up roadmapdocs/PROJECT_TRACKER.mddocs/FEATURE_IMPROVEMENTS.md