Finance Module¶
Purpose¶
The Finance module handles all accounting and financial operations for a workspace, including chart of accounts, invoicing, journal entries, and financial reporting.
Responsibilities¶
- Managing the Chart of Accounts
- Creating and tracking Invoices and Payments
- Double-entry accounting via Journal Entries
- Generating financial reports (Balance Sheet, Profit & Loss)
- Managing Fiscal Periods
File Structure¶
Key Files¶
| File | Purpose |
|---|---|
finance.module.ts | Orchestrates all sub-modules (accounts, invoices, etc.) |
journals.service.ts | Enforces double-entry accounting rules (debits = credits) |
reports.service.ts | Aggregates journal lines to calculate P&L and Balance Sheets |
Database Models¶
FinancialAccountJournalEntryJournalEntryLineInvoiceInvoiceItemPaymentFiscalPeriod
API Endpoints¶
GET /api/v1/finance/accountsPOST /api/v1/finance/accountsGET /api/v1/finance/invoicesPOST /api/v1/finance/invoicesGET /api/v1/finance/journalsPOST /api/v1/finance/journalsGET /api/v1/finance/reports/balance-sheetGET /api/v1/finance/reports/profit-loss
Key Flows¶
sequenceDiagram
participant User
participant API
participant DB
User->>API: POST /invoices
API->>DB: Create Invoice & InvoiceItems
API-->>User: 200 OK
User->>API: POST /payments (For Invoice)
API->>DB: Create Payment Record
API->>DB: Update Invoice Status
API->>DB: Auto-generate JournalEntry (Debit Cash, Credit AR)
API-->>User: 200 OK