@buildvisionai/construction-calculators
v1.0.2
Published
Pure TypeScript calculation functions for construction estimating — concrete, gravel, roofing, lumber, paint, flooring, and more.
Maintainers
Readme
@buildvisionai/construction-calculators
Pure TypeScript functions for construction estimating — zero dependencies, no React, no DOM. Works in Node, browser, Deno, and edge runtimes.
Built and maintained by BuildVision — AI-powered construction estimating software. Try the live calculators →
Install
npm install @buildvisionai/construction-calculators
# or
yarn add @buildvisionai/construction-calculators
# or
pnpm add @buildvisionai/construction-calculatorsQuick Start
import {
calculateConcrete,
calculateMarkup,
calculateRoofingCost,
} from '@buildvisionai/construction-calculators';
// Concrete volume for a 20×30 ft slab, 4 inches thick
const slab = calculateConcrete({
shape: 'rectangular',
length: 20,
width: 30,
depth: 4 / 12,
units: 'imperial',
});
console.log(slab.volumeCuYd); // 2.22 cubic yards
console.log(slab.bagsNeeded); // 134 × 60lb bags
// Price it up with markup
const quote = calculateMarkup({ costs: 850, markupPercent: 25 });
console.log(quote.totalWithMarkup); // $1,062.50
console.log(quote.profitMarginPercent); // 20%
// Roofing cost range
const roof = calculateRoofingCost({
roofArea: 2400,
materialType: 'asphalt',
regionMultiplier: 1.0,
pitchMultiplier: 1.1,
storiesMultiplier: 1.0,
includeTearOff: true,
units: 'imperial',
});
console.log(`$${roof.totalLow.toFixed(0)}–$${roof.totalHigh.toFixed(0)}`);Calculators
Concrete & Masonry
| Function | Description | Live Demo |
|----------|-------------|-----------|
| calculateConcrete | Rectangular/circular volume, bags, sand, gravel, water | Concrete Calculator |
| calculateConcreteSlab | Slab volume, 60/80lb bags, ready-mix trucks, rebar | Concrete Slab Calculator |
| calculateConcreteBlock | CMU block count, mortar bags, cost estimate | Concrete Block Calculator |
| calculateRetainingWall | Block courses, backfill volume, drainage, geogrid layers | Retaining Wall Calculator |
Materials & Aggregates
| Function | Description | Live Demo |
|----------|-------------|-----------|
| calculateGravel | Volume, tonnage, 50lb bags, cost | Gravel Calculator |
| calculateBoardFoot | Lumber board feet, cubic meters, weight | Board Foot Calculator |
| calculateInsulation | R-value thickness, rolls/bags by insulation type, cost | Insulation Calculator |
| calculatePavers | Paver count + waste, sand bed, gravel base | Paver Calculator |
Interior Finishes
| Function | Description | Live Demo |
|----------|-------------|-----------|
| calculateDrywall | Sheets, tape rolls, compound buckets, screws | Drywall Calculator |
| calculateFlooring | Planks/boxes, underlayment, transition strips, cost | Flooring Calculator |
| calculatePaint | Gallons, primer, cost range, time estimate | Paint Calculator |
Roofing
| Function | Description | Live Demo |
|----------|-------------|-----------|
| calculateRoofMaterials | Shingle bundles, accessories, bid price, gross margin | Roof Calculator |
| calculateRoofingCost | Installed cost by material, region, pitch, stories | Roofing Cost Calculator |
| calculateMetalRoofCost | Metal roof cost + 50-year vs asphalt comparison | Metal Roof Cost Calculator |
| pitchFromRiseRun | Angle and percent from rise/run | Roof Pitch Calculator |
| pitchFromAngle | Rise/run from pitch angle | Roof Pitch Calculator |
| pitchFromPercent | Rise/run from slope percent | Roof Pitch Calculator |
| calculateRafterLength | Rafter length from pitch and half-span | Roof Pitch Calculator |
Structures & Exterior
| Function | Description | Live Demo |
|----------|-------------|-----------|
| calculateSquareFootage | Multi-room area for rectangle, square, circle shapes | Square Footage Calculator |
| calculateFence | Posts, rails, pickets, panels, concrete bags, cost | Fence Calculator |
| calculateStairs | Step count, rise/run, stringer length, angle | Stair Calculator |
| calculateDeckCost | Boards, joists, posts, footings, railing, installed cost | Deck Cost Calculator |
Business & Finance
| Function | Description | Live Demo |
|----------|-------------|-----------|
| calculateMarkup | Selling price and profit margin from cost + markup % | Markup Calculator |
| calculateMarkupFromMargin | Required markup % to hit a target profit margin | Markup Calculator |
| calculateLaborCost | Total labor cost with payroll burden multiplier | Labor Cost Calculator |
| calculateHourlyRate | Billable rate from annual expenses + profit margin | Hourly Rate Calculator |
| calculateNetProfit | Projects/month needed to hit annual profit goal | Net Profit Calculator |
| calculateConstructionCost | Line-item cost roll-up by category (materials/labor/equipment) | Construction Cost Calculator |
| calculateEquipmentDepreciation | 4-method schedule: straight-line, declining balance, SYD, DDB | Equipment Depreciation Calculator |
| calculateTimeline | Critical path method (CPM) — earliest/latest start, float | Timeline Calculator |
Units
All functions accept a units parameter — 'imperial' or 'metric'. Outputs include both unit variants where relevant.
// Imperial: feet, inches, lbs, gallons
calculateConcrete({ ..., units: 'imperial' })
// Metric: meters, cm/mm, kg, liters
calculateConcrete({ ..., units: 'metric' })Design Principles
- Pure functions — input object in, result object out, no side effects
- Zero dependencies — nothing to audit, nothing to break
- TypeScript first — full types on all inputs and outputs
- Dual ESM + CJS — works in any JS environment
Contributing
PRs welcome. Good areas to expand: HVAC load, electrical, plumbing, sitework, earthworks.
Built by BuildVision — construction estimating software for the modern contractor.
