@coffee-machine/core
v1.1.7
Published
Core abstractions and implementations for building realistic coffee machine simulations in TypeScript
Downloads
11
Maintainers
Readme
@coffee-machine/core ☕️⚙️
Core abstractions and implementations for simulating realistic coffee machines in TypeScript.
Installation
npm install @coffee-machine/coreBasic Usage
import { Coffee, Water, Heat, CoffeeType, GrindSize, HeatSource CoffeeType, GrindSize, HeatSource } from "@coffee-machine/core";
import { EspressoMachine } from "@coffee-machine/core/machines";
// Configure your coffee setup
const coffee = new Coffee({
type: CoffeeType.ARABICA,
nominalWeightG: 20,
grindSize: GrindSize.FINE,
});
const water = new Water({
nominalVolumeMl: 36,
nominalTempC: 25,
});
const heat = new Heat({
heatSource: HeatSource.ELECTRIC,
heatPowerW: 1500,
});
// Create and run the machine
const machine = new EspressoMachine();
await machine.assembleMachine(coffee, water, heat);
// Brew with real-time updates
for await (const step of machine.brew()) {
console.log(`${step.step}: ${step.temperatureC}°C`);
}What's Inside
Core Entities
- Coffee - Bean configuration and properties
- Water - Temperature and volume management
- Heat - Heating system simulation
Machine Abstractions
- CoffeeMachine - Abstract base class for all machines
- EspressoMachine - Ready-to-use espresso implementation
For implementing your own machines, reference the existing EspressoMachine implementation in the machines/ directory and for usage check the examples/ directory.
Brewing Process
The simulation follows realistic coffee extraction:
- Assembly - Validate and configure components
- Heating - Reach optimal water temperature
- Pre-brew - Prepare machine for extraction
- Pre-infusion - Initial wetting phase
- Extraction - Main brewing with pressure buildup
- Completion - Final output and cleanup
A passion project I tinker with for fun. New features and machines will be added as I explore interesting applications.
For terminal brewing: @coffee-machine/cli
