ProdCost is a tool to help entrepreneurs and small businesses calculate production costs.
The core domain is Cost Calculation. Everything revolves around providing an efficient, accurate and user-friendly way to calculate product costs.
CostCraft can be divided into these bounded contexts:
- User management context
- Handles user registration, authentication and profile management.
- Distinction between guests and registered users.
- Cost calculation context
- Core logic for creating, managing and persisting cost calculations.
- Export context
- Handles exporting the calculation to PDF of spreadsheet formats.
-
User (Aggregate Root)
Attributes:
-
id (unique)
-
userName (unique)
-
password
-
preferredCurrency
-
products (list of Product entities)
Behaviors:
-
Register user.
-
Authenticate user.
-
Update user profile.
-
-
Product (Aggregate Root)
Attributes:
-
id (unique)
-
name
-
unitsProduced
-
createdAt
-
updatedAt
-
profitMarginPercentage
-
userId
-
materials (list of Material entities)
-
labors (list of Labor entities)
Behaviors:
-
Add material.
-
Add labor.
-
Calculate unit cost.
-
Calculate total cost.
-
Calculate sale price.
-
-
Material (Entity)
Attributes:
-
id (unique)
-
name
-
purchasedAmount
-
purchasedUnit
-
purchasedPrice
-
usedAmount
-
usedUnit
-
productId
Behaviors:
-
Calculate usedPrice based on usedAmount and purchasedPrice.
-
-
Labor (Entity)
Attributes:
-
timeUnit (e.g., hour, minute)
-
timePayRate
-
timeWorked
-
productId
Behaviors:
-
Calculate calculatedCost based on timeWorked and timeRate.
-
-
UserService
- Manages user registration, login and profile updates.
-
CostCalculationService
- Orchestrates product cost calculation.
- Handles persistence for registered users.
-
ExportService
- Converts calculations to PDF or spreadsheet formats.
- UserRepository Handles persistence of user information.
- ProductRepository Handles persistence of product and cost calculation data.
- Currency A value object encapsulating currency logic.
- ProfitPercentage Encapsulates the profit margin logic for calculating sale prices.
Guest Workflow:
- Guest opens the app and starts a new cost calculation.
- Adds product, materials, labor and profit details.
- Views calculated costs and sale price.
- Prints or download the calculation as PDF or spreadsheet.
Registered User Workflow:
- Logs in or registers.
- Starts a new cost calculation or selects an existing one.
- Adds product, materials, labor and profit details.
- Views calculated costs and sale price.
- Prints or download the calculation as PDF or spreadsheet.
- Saves product cost calculation.
-
Dashboard
- Start a new cost calculation.
- View saved products (registered users).
-
Cost Calculation Screen
- Input fields for product, materials, labor and profit margin.
- Automatic calculations for costs and sale price.
-
Profile Screen (for registered users)
- View or edit userName, password, and currency preference.