A flexible rate calculation utility for software projects, supporting a wide range of modifiers (language, activity, customer type, urgency, and more) to help you determine fair and transparent pricing.
This is mostly fun project, so enjoy playing with the prices :)
- TypeScript-based, type-safe modifier system
- Using Typescript
const enumand generics to ensure type safety and performance - Easily extendable with custom modifiers
- Simple API for adding/removing modifiers and calculating rates
- Define your base hourly rate and initial modifiers.
- Use the
RateCalculatorclass to manage and update modifiers. - Retrieve the current rate after all modifiers are applied.
import { ClientModifier, LanguageModifier, ActivityModifier, ClientBehaviorModifier, DocumentationModifier, ComplexityModifier, UrgencyModifier, WorkingHoursModifier, CommunicationModifier, TechDebtModifier, LocationModifier, FormModifier, TeamModifier, MiddlemanModifier, PaymentModifier } from "./data/modifiers";
import { RateCalculator } from "./data/RateCalculator";
// Basic hour rate you want to use for your calculations
const RC = new RateCalculator(20);
// Add all defined modifiers to the rate calculator
// you can add multiple modifiers of the same type
RC.addModifier('client', ClientModifier.Startup); // Client is a startup
RC.addModifier('client', ClientModifier.Government); // Passive client
RC.addModifier('language', LanguageModifier.TypeScript);
RC.addModifier('language', LanguageModifier.Go);
RC.addModifier('activity', ActivityModifier.Development);
RC.addModifier('activity', ActivityModifier.Documentation);
RC.addModifier('clientBehavior', ClientBehaviorModifier.TellsMeHowToDoMyJob);
RC.addModifier('documentation', DocumentationModifier.None);
RC.addModifier('complexity', ComplexityModifier.Medium);
RC.addModifier('urgency', UrgencyModifier.Relaxed);
RC.addModifier('hours', WorkingHoursModifier.Workday);
RC.addModifier('communication', CommunicationModifier.WeeklyCalls);
RC.addModifier('techdebt', TechDebtModifier.Greenfield);
RC.addModifier('location', LocationModifier.Europe);
RC.addModifier('form', FormModifier.Hybrid);
RC.addModifier('team', TeamModifier.Small);
RC.addModifier('middleman', MiddlemanModifier.Agency);
RC.addModifier('payment', PaymentModifier.Hourly);
// Get price and print it
const rate = Math.ceil(RC.currentRate); // Calculate the current rate based on the base rate and applied modifiersBun is used as the default runner, but TS compiler can be used as well.
bun run src/index.tsPlease feel free to discuss on modifier values as it applies to your job performance, health or other factors that may affect your rate. The values are subjective and can vary widely based on personal experience and market conditions. Also account for real-world costs like time wasted, demotivation and anger with the company or client.
If you find this project useful, please consider supporting its development:
- PayPal: paypal.com/donate
- Buy Me a Coffee: buymeacoffee.com/sjiamnocna
Your support helps keep this project maintained and free for everyone!