diff --git a/apps/web/src/pages/DashboardPage.tsx b/apps/web/src/pages/DashboardPage.tsx
index 36bc523..9de5539 100644
--- a/apps/web/src/pages/DashboardPage.tsx
+++ b/apps/web/src/pages/DashboardPage.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useMemo } from 'react';
export default function DashboardPage() {
return (
diff --git a/apps/web/src/pages/TransactionsPage.tsx b/apps/web/src/pages/TransactionsPage.tsx
index bcc1fd7..6c8245c 100644
--- a/apps/web/src/pages/TransactionsPage.tsx
+++ b/apps/web/src/pages/TransactionsPage.tsx
@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import React, { useState, useMemo, useCallback } from 'react';
import { useTransactionStore } from '../stores/transactionStore';
import type { Transaction } from '@brazil-swift-ops/types';
import { calculateTransactionEOUplift, getDefaultConverter } from '@brazil-swift-ops/utils';
@@ -172,7 +172,7 @@ export default function TransactionsPage() {
} finally {
setIsProcessing(false);
}
- };
+ }, [formData, addTransaction, converter]);
return (
diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts
new file mode 100644
index 0000000..a9ffe24
--- /dev/null
+++ b/apps/web/vite.config.ts
@@ -0,0 +1,26 @@
+import { defineConfig } from 'vite';
+import react from '@vitejs/plugin-react';
+import path from 'path';
+
+export default defineConfig({
+ plugins: [react()],
+ resolve: {
+ alias: {
+ '@': path.resolve(__dirname, './src'),
+ },
+ },
+ build: {
+ rollupOptions: {
+ output: {
+ manualChunks: {
+ 'react-vendor': ['react', 'react-dom', 'react-router-dom'],
+ 'utils-vendor': ['zustand'],
+ },
+ },
+ },
+ chunkSizeWarningLimit: 1000,
+ },
+ optimizeDeps: {
+ include: ['react', 'react-dom', 'react-router-dom'],
+ },
+});
diff --git a/docs/COMPLIANCE.md b/docs/COMPLIANCE.md
new file mode 100644
index 0000000..a34cfd5
--- /dev/null
+++ b/docs/COMPLIANCE.md
@@ -0,0 +1,200 @@
+# Compliance Documentation
+
+## Regulatory Framework
+
+The Brazil SWIFT Operations Platform complies with Brazilian banking and foreign exchange regulations, including:
+
+- **Lei nº 14.286** (New Foreign Exchange Law, effective Dec 2022)
+- **Banco Central do Brasil (BCB)** regulations
+- **Conselho Monetário Nacional (CMN)** policies
+- **FATF** AML standards
+
+## Key Compliance Requirements
+
+### 1. USD 10,000 Reporting Threshold
+
+**Requirement:** All international transfers ≥ USD 10,000 (or equivalent) must be reported to Banco Central do Brasil.
+
+**Implementation:**
+- Automatic detection of transactions meeting threshold
+- BCB report generation
+- Immutable audit logging
+- 7-year retention period
+
+**Per-Transaction Basis:**
+- Threshold applies to **each individual transaction**
+- Multiple smaller transactions are monitored for structuring patterns
+
+### 2. Tax ID Validation (CPF/CNPJ)
+
+**Requirement:** All parties must have valid Brazilian tax identification.
+
+**CPF (Individuals):**
+- 11 digits
+- Valid checksum validation
+- Required for individuals
+
+**CNPJ (Companies):**
+- 14 digits
+- Valid checksum validation
+- Required for legal entities
+
+**Implementation:**
+- Automatic validation on transaction submission
+- Rejection of invalid Tax IDs
+- Audit logging of validation results
+
+### 3. Purpose of Payment
+
+**Requirement:** All transactions must include a clear purpose of payment.
+
+**Implementation:**
+- Mandatory field validation
+- Minimum length requirements
+- Maximum length enforcement (140 characters for SWIFT)
+- Audit trail
+
+### 4. IOF Tax Calculation
+
+**Requirement:** IOF (Imposto sobre Operações Financeiras) must be calculated and collected.
+
+**Rates:**
+- **Inbound**: 0.38% (0.0038)
+- **Outbound**: 3.5% (0.035)
+
+**Implementation:**
+- Automatic calculation based on transaction direction
+- Display in transaction details
+- Inclusion in BCB reports
+
+### 5. FX Contract Linkage
+
+**Requirement:** Foreign exchange transactions must be linked to registered FX contracts.
+
+**Implementation:**
+- FX contract validation
+- Contract amount reconciliation
+- Contract lifecycle tracking
+- Audit trail
+
+### 6. AML Structuring Detection
+
+**Requirement:** Detect and report potential structuring (breaking large transactions into smaller ones to avoid reporting).
+
+**Implementation:**
+- 30-day rolling window analysis
+- Pattern detection across same parties
+- Automatic flagging for review
+- Escalation workflow
+
+## BCB Reporting
+
+### Report Types
+
+1. **Periodic Reports**: Regular reporting for transactions meeting threshold
+2. **Ad-hoc Reports**: On-demand reporting for specific periods
+3. **Compliance Reports**: Regulatory compliance summaries
+
+### Report Contents
+
+- Transaction details
+- Party information (with Tax IDs)
+- Amounts and currencies
+- Purpose of payment
+- FX contract references
+- IOF calculations
+- Compliance flags
+
+### Report Retention
+
+- **Retention Period**: 7 years (2555 days)
+- **Format**: JSON and CSV export
+- **Audit Trail**: Immutable logging of all reports
+
+## Audit Trail
+
+### Audit Logging
+
+All transactions generate immutable audit logs containing:
+
+- Transaction ID
+- Timestamp
+- Rule set version
+- Input data
+- Evaluation results
+- Decision and rationale
+- User ID (if authenticated)
+- IP address (if available)
+
+### Audit Retention
+
+- **Default**: 7 years
+- **Configurable**: Via environment variable `AUDIT_RETENTION_DAYS`
+- **Auto-deletion**: Configurable via `AUDIT_AUTO_DELETE`
+
+### Audit Access
+
+- Read-only access to audit logs
+- Search by transaction ID
+- Date range filtering
+- Export capabilities
+
+## Rule Version Governance
+
+### Version Management
+
+- Rule set versions tracked in audit logs
+- Version changes require approval
+- Migration scripts for version upgrades
+- Compatibility checking
+
+### Version Format
+
+- Semantic versioning (MAJOR.MINOR.PATCH)
+- Example: `1.0.0`
+- Stored in `package.json` as source of truth
+
+## Data Retention
+
+### Transaction Data
+
+- **Retention**: 7 years (configurable)
+- **Archival**: After retention period
+- **Deletion**: Per retention policy
+
+### Audit Logs
+
+- **Retention**: 7 years (configurable)
+- **Immutable**: Cannot be modified
+- **Deletion**: Only per retention policy
+
+### Reports
+
+- **Retention**: 7 years
+- **Export**: Available for download
+- **Archival**: Automatic after retention
+
+## Compliance Checklist
+
+Before processing transactions, ensure:
+
+- [ ] USD 10,000 threshold monitoring enabled
+- [ ] CPF/CNPJ validation active
+- [ ] Purpose of payment required
+- [ ] IOF rates configured correctly
+- [ ] FX contract validation enabled
+- [ ] AML structuring detection active
+- [ ] Audit logging enabled
+- [ ] BCB reporting configured
+- [ ] Retention policies set
+
+## Regulatory Contacts
+
+- **Banco Central do Brasil**: https://www.bcb.gov.br
+- **CMN**: https://www.bcb.gov.br/estabilidadefinanceira/cmn
+
+## Compliance Updates
+
+This documentation is updated as regulations change. Always refer to the latest version and consult with compliance officers for specific questions.
+
+**Last Updated:** 2026-01-23
diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md
new file mode 100644
index 0000000..c91d334
--- /dev/null
+++ b/docs/USER_GUIDE.md
@@ -0,0 +1,170 @@
+# User Guide
+
+## Overview
+
+The Brazil SWIFT Operations Platform is a comprehensive system for processing SWIFT international payments and foreign exchange transactions in compliance with Brazilian regulations.
+
+## Getting Started
+
+### Accessing the Application
+
+1. Open your web browser
+2. Navigate to the application URL (provided by your administrator)
+3. Log in with your credentials
+
+### Navigation
+
+The application has four main sections:
+
+- **Dashboard**: Overview of transactions, statistics, and compliance status
+- **Transactions**: Create and manage transactions
+- **Treasury**: Manage treasury accounts and subledgers
+- **Reports**: Generate BCB reports and export data
+
+## Transactions
+
+### Creating a Transaction
+
+1. Navigate to the **Transactions** page
+2. Fill in the transaction form:
+ - **Direction**: Select Inbound or Outbound
+ - **Amount**: Enter the transaction amount
+ - **Currency**: Select the currency (USD, BRL, EUR, GBP)
+ - **Ordering Customer**: Enter customer name and Tax ID (CPF/CNPJ)
+ - **Beneficiary**: Enter beneficiary name, Tax ID, and account details
+ - **Purpose of Payment**: Enter a clear description
+ - **FX Contract ID**: (Optional) Link to FX contract
+3. Click **Submit Transaction**
+
+### Transaction Validation
+
+The system automatically validates:
+- Transaction amount and currency
+- CPF/CNPJ format
+- Required fields
+- Purpose of payment
+
+### Transaction Status
+
+After submission, each transaction is evaluated against regulatory rules:
+
+- **Allow**: Transaction approved, can proceed
+- **Hold**: Transaction requires review
+- **Escalate**: Transaction requires senior approval
+
+### E&O Uplift
+
+All transactions include a 10% Errors & Omissions (E&O) uplift, displayed in the transaction table. This is an off-balance-sheet exposure buffer.
+
+## Treasury Management
+
+### Treasury Accounts
+
+Treasury accounts are parent accounts that hold funds.
+
+**Creating a Treasury Account:**
+1. Navigate to **Treasury** page
+2. Click **Create Treasury Account**
+3. Enter:
+ - Account Number
+ - Account Name
+ - Currency
+4. Click **Create**
+
+### Subledger Accounts
+
+Subledger accounts are child accounts linked to a treasury account.
+
+**Creating a Subledger:**
+1. Navigate to **Treasury** page
+2. Click **Create Subledger**
+3. Select parent treasury account
+4. Enter account details
+5. Click **Create**
+
+### Viewing Account Details
+
+Click on any account to view:
+- Account balance
+- Available balance
+- Account status
+- Transaction history
+
+## Reports
+
+### Generating BCB Reports
+
+1. Navigate to **Reports** page
+2. Select date range:
+ - Start Date
+ - End Date
+3. Click **Generate Report**
+
+### Report Summary
+
+The report shows:
+- Total transactions
+- Total amount (USD)
+- Inbound/Outbound breakdown
+- Reporting required count
+- Total IOF
+
+### Exporting Reports
+
+- **Export JSON**: Download report as JSON file
+- **Export CSV**: Download report as CSV file
+
+## Compliance
+
+### USD 10,000 Threshold
+
+Transactions ≥ USD 10,000 (or equivalent) automatically require:
+- BCB reporting
+- Enhanced documentation
+- Compliance review
+
+### Required Documentation
+
+All transactions must include:
+- Ordering customer Tax ID (CPF for individuals, CNPJ for companies)
+- Beneficiary Tax ID
+- Purpose of payment
+- Account details
+
+### AML Checks
+
+The system automatically checks for:
+- Structuring patterns (multiple transactions just under threshold)
+- Suspicious activity patterns
+- Compliance with Brazilian AML regulations
+
+## Troubleshooting
+
+### Transaction Rejected
+
+If a transaction is rejected:
+1. Check validation errors in the form
+2. Verify all required fields are filled
+3. Ensure Tax IDs are valid CPF/CNPJ format
+4. Check that purpose of payment is provided
+
+### Report Generation Failed
+
+If report generation fails:
+1. Verify date range is valid
+2. Ensure transactions exist in the date range
+3. Contact support if issue persists
+
+### Account Balance Issues
+
+If account balances appear incorrect:
+1. Check transaction history
+2. Verify postings are correct
+3. Contact treasury administrator
+
+## Support
+
+For assistance:
+- Contact your system administrator
+- Refer to the Developer Guide for technical details
+- Check the Compliance Documentation for regulatory questions