5.1 KiB
5.1 KiB
Kifi Project Context
Overview
Kifi is a financial and inventory management application designed to handle strict accounting principles along with inventory, vendor, and business operations. It supports a specialized "Jewellery Business Mode".
Components
- kifi-app: Flutter mobile frontend.
- kifi-api: Spring Boot WebFlux backend (reactive stack).
- Infrastructure: PostgreSQL database (accessed via R2DBC), MinIO for object storage (images/attachments), Redis, Docker registry (
hub.technobeesolutions.in).
Core Features & Architecture
1. Accounting System
- Double-Entry Principle: Strict double-entry accounting is mandated. Every financial entry must balance.
- Entities: The core entities are
Wallet(which represents all forms of accounts/ledgers) andTransaction. - Account Types (Natures): Accounts are categorized by
nature(e.g., SAVINGS, INCOME, EXPENSE, PAYABLES, INVESTMENTS). - Payables: Specialized support for Credit Cards, OD, EMIs, and Policy Premiums. Features configurable cycle dates and limits.
- Automated Ledger Mapping (
LedgerService):- Purchases: Receiving a PO automatically debits
Inventory Assetand credits the specificVendor Payablewallet. - Sales: Finalizing an Invoice automatically debits
Customer ARand creditsSales Revenue. - Wallets act as formal Chart of Accounts (COA) ledgers generated automatically on demand.
- Purchases: Receiving a PO automatically debits
2. Jewellery & Inventory Management
- Jewellery Business Mode: When
BUSINESSandJEWELLERYare selected, Kifi transitions into a robust jewellery ERP. - Inventory Model:
Productrepresents the master catalog definition (e.g., 22K Gold Ladies Ring).InventoryItemrepresents physical tags in the store. Each item is unique, storing exact gross/net/stone/fine weights, individual purchase costs, vendor reference, and uniquely tracking items via HUID or Barcode. HUID uniqueness forces 1:1 material tracking for those categories.
- Commodity Rates: Commodity rates (e.g. Gold/Silver prices) are immutable and append-only.
- System syncs rates to
CommodityRateHistory. - Rate synchronization NEVER overwrites the historical purchase cost or pre-calculated selling prices of individual
InventoryItemrecords. Valuations are calculated dynamically at runtime when needed.
- System syncs rates to
- Dynamic Valuation:
InventoryValuationServicecalculates real-time inventory value by multiplying available fine weight by the latestCommodityRateHistoryrate, adding making charges, and rendering it instantly on the Business Dashboard via a riverpod provider.
3. Vendor & Purchase Orders
- Purchase Orders map to Vendors.
- Receiving a Purchase Order creates individual
InventoryItemtags representing real physical stock (e.g. individual chains, rings) rather than simply bumping aggregate product stock totals.
4. Customer & Sales/Invoice Module
- Invoice to Inventory Linking:
InvoiceItemrecords map directly to specific physicalInventoryItemtags (inventory_item_id) rather than just master products. - HUID Barcode Scanning: The
InvoiceBuilderScreenscans and prioritizes mapping directly to a unique HUID fromInventoryItem. This natively prevents duplicating unique items in the same invoice. - Stock Deduction: Finalizing an invoice or creating a non-draft invoice automatically marks the referenced
InventoryItemrecords asSOLD. - Financial breakdown fields (
making_charge,other_charges,hsn_code) are captured at the item level.
5. Reporting & Audit Module
- Reports Hub: Accessible from the Business Hub, features live tracking of Real-time Inventory Valuation.
5. Project Management (Tasks)
- Supports full Project creation, task assignment, and billing rates.
- Task Comments & Attachments: Task comments support both legacy Base64 attachments (stored in PostgreSQL) and newer MinIO-backed attachments.
6. UI Standardization
- Design System: The application strictly adheres to a uniform, enterprise-grade design system across all list screens (Projects, Invoices, Vendors, Task Board).
- Material 3 / UI-UX Rules: UI components avoid generic Material layouts, utilizing dynamic modern aesthetics, dynamic profile avatars, and proper padding/borders.
- Standard Themes:
Colors.grey[100]is the standard background color, and search fields use white containers with rounded corners and no borders.
Important Technical Rules & Conventions
- R2DBC Limitations: Because R2DBC is fully reactive, it does not automatically fetch relations (no lazy loading). Transient relational fields MUST be manually populated in the Service layers using
Mono.ziporflatMapbefore returning to the controller. - API Routing (kifi vs kifi-v2): The application is migrating to a new reactive backend. New endpoints are mapped under
/api/kifi-v2/. - Payload Limits:
spring.codec.max-in-memory-sizeis set to10MBinapplication.ymlto preventDataBufferLimitExceptionwhen handling large image uploads/downloads. - Image/Attachment Loading: The backend reads byte buffers from MinIO (Base64) and decodes them to byte arrays (
byte[]) to serve over HTTP.