Skip to content

jedlsf/PriceGenie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Price Genie 🧞

Price Genie is a simple yet powerful pricing calculator that helps entrepreneurs, freelancers, and small businesses determine fair, profitable rates for their products or services. Designed with cost-based pricing principles, Price Genie empowers you to make informed decisions based on your actual costs, expenses, and target profit margins.

πŸ’‘ β€œTake control of your pricing with logic, not guesswork.”


🌐 Live Demo

Price Genie Thumbnail

Click the image to try the interactive pricing calculator.


✨ Features

  • Calculate ideal prices based on costing breakdown
  • Transparent computation logic with per-item control
  • Built for freelancers, creatives, startups, and service providers
  • Written in TypeScript β€” fully typed, no runtime dependencies
  • Supports fixed markup, profit targets, or manual override
  • Modular and extensible class structure
  • Lightweight β€” zero dependencies

πŸ“¦ Installation

npm install @thezelijah/price-genie

πŸ›  Usage

Step 1: Initialize and Setup Price Genie

Basic Setup

import { PriceGenie, type CostingItem } from '@thezelijah/price-genie';


const genie = PriceGenie.initialize();


const sampleCostingItems: CostingItem[] = [
  {
    label: "Labor",
    description: "Skilled worker wages for assembly and packaging",
    quantity: 20,
    unit: "hrs",
    unitPrice: 250,
    amount: 5000,
    costMargin: 0.25,
    multipliers: {
      quantity: 1,
      unitPrice: 1,
    },
  },
  {
    label: "Raw Materials",
    description: "High-quality wood used for furniture production",
    quantity: 10,
    unit: "pcs",
    unitPrice: 750,
    amount: 7500,
    costMargin: 0.2,
    multipliers: {
      quantity: 1,
      unitPrice: 1,
    },
  },
  {
    label: "Logistics",
    description: "Delivery and transportation of finished goods",
    quantity: 2,
    unit: "trips",
    unitPrice: 1200,
    amount: 2400,
    costMargin: 0.15,
    multipliers: {
      quantity: 1,
      unitPrice: 1,
    },
  },
  {
    label: "Packaging",
    description: "Custom printed boxes and wrapping materials",
    quantity: 100,
    unit: "sets",
    unitPrice: 35,
    amount: 3500,
    costMargin: 0.1,
    multipliers: {
      quantity: 1,
      unitPrice: 1,
    },
  },
];


// Set Name
let updatedInstance = genie.setItemName("My Product")
.setItemDescription("A new product to add")
.setBasePrice(parseFloat("12345.50"))
.setTotalSupply(parseInt("100"))
.setListCostingBreakdown(sampleCostingItems);

Helper: Clear all costing items breakdown

// Clear and empty List of Items included in the costing breakdown
let updatedInstance = genie.clearListCostingBreakdown();

Helper: Get the most expensive item from the costing breakdown

// Returns the most expensive item from the costing breakdown
const mostExpensiveItem = genie.getMostExpensiveCostItem();

πŸŽ›οΈ Step 2: Simulation Mode & Slider Implementation

PriceGenie allows you to simulate pricing strategies without affecting your original data. You can plug these into a visual UI using sliders for dynamic experimentation.

πŸ”„ 2.1 Toggle Simulation Mode

Enable or disable simulation mode for visual controls like sliders:

const handleToggleSimulationMode = (bool: boolean) => {
const updatedInstance = genie.toggleSimulation(bool);
 setGenieInstance(updatedInstance);
};

When enabled, simulated values (e.g., quantity, unit price) override base values only in calculations and UI, not in stored data.


🎚️ 2.2 Update Simulation Multipliers via Sliders

Each of these methods updates simulated multipliers that affect pricing computation in real time:

πŸ”’ Cost Item Quantity

const handleSimDataQuantity = (multiplier: number, index?: number) => {
  if (!!genie && index !== undefined) {
    const updatedInstance = genie.updateCostItemQuantityMultiplier(index, multiplier);
    setGenieInstance(updatedInstance);
 
  }
};

πŸ’° Cost Item Unit Price

const handleSimDataUnitPrice = (multiplier: number, index?: number) => {
  if (!!genie && index !== undefined) {
    const updatedInstance = genie.updateCostItemUnitPriceMultiplier(index, multiplier);
    setGenieInstance(updatedInstance);
  }
};

πŸ“¦ Global Total Supply

const handleSimDataTotalSupply = (multiplier: number) => {
  if (!!genie) {
    const updatedInstance = genie.updateTotalSupplyMultiplier(multiplier);
    setGenieInstance(updatedInstance);
  }
};

🏷️ Global SRP (Suggested Retail Price)

const handleSimDataSRP = (multiplier: number) => {
  if (!!genie) {
    const updatedInstance = genie.updateSRPMultiplier(multiplier);
    setGenieInstance(updatedInstance);
  }
};

🧠 Use Cases

  • Freelancers quoting custom projects
  • Product makers computing ideal selling price
  • Startups experimenting with cost inputs
  • Visual apps needing real-time pricing logic

🚧 Coming Soon

  • CAPEX / OPEX breakdown support
  • Tax-aware calculations (e.g., VAT, withholding)

These features are not yet available in the current release but are in active development.


πŸ“ Project Structure

.
β”œβ”€β”€ src/               # Source TypeScript file
β”œβ”€β”€ dist/              # Build output (generated)
β”œβ”€β”€ demo/              # Optional usage demo (ignored in build)
β”œβ”€β”€ README.md
β”œβ”€β”€ package.json
└── tsconfig.json

πŸ“Œ The /demo folder contains illustrative .tsx usage examples. It is excluded from the npm package and TypeScript build.


🀝 Contributing

Contributions, bug reports, and suggestions are welcome! Feel free to fork and open a pull request.


🧾 License

ISC β€” free for personal and commercial use.


πŸ”— Author

Made with πŸ’™ by @thezelijah

About the Developer


Contact