IOLTA Manager Development Guide
A trust account management application for law firms to maintain IOLTA (Interest on Lawyer Trust Accounts) compliance—tracking client funds, generating reports, and maintaining proper records per state bar requirements.
Live site: https://iolta-manager.casedev.app/
Architecture
src/
├── app/
│ ├── api/ # API routes
│ │ ├── audit/ # Audit log endpoints
│ │ ├── clients/ # Client CRUD
│ │ ├── holds/ # Trust holds management
│ │ ├── matters/ # Matter management
│ │ ├── reports/ # Report generation
│ │ ├── settings/ # Firm settings
│ │ └── transactions/ # Transaction operations
│ ├── audit/ # Audit log page
│ ├── clients/ # Client pages
│ ├── holds/ # Holds management
│ ├── ledger/ # Transaction ledger
│ ├── matters/ # Matter pages
│ ├── reports/ # Reports page
│ └── settings/ # Settings page
├── components/
│ ├── holds/ # Hold-related components
│ ├── layout/ # Sidebar, navigation
│ ├── matters/ # Matter components
│ ├── reports/ # Report components
│ └── ui/ # Base UI components
├── db/
│ ├── index.ts # Database connection
│ └── schema.ts # Drizzle schema
└── lib/
├── audit.ts # Audit logging utilities
├── iolta-compliance.ts # State-specific rules
├── pdf-styles.ts # Report styling
└── utils.ts # General utilities
Core Workflow
Create Client → Create Matter → Record Transactions → Place Holds → Generate Reports
↓ ↓ ↓ ↓ ↓
Contact info Link to client Deposits/ Reserve funds Monthly,
stored assign number Disbursements prevent over- Reconciliation,
track balance disbursement Client Ledger
Tech Stack
| Layer |
Technology |
| Frontend |
Next.js 15 (App Router), React, Tailwind CSS |
| Backend |
Next.js API Routes |
| Database |
PostgreSQL + Drizzle ORM |
| Auth |
NextAuth.js (demo mode) |
| PDF |
React PDF |
| Icons |
Lucide React |
Key Features
| Feature |
Description |
| Dashboard |
Real-time trust balance, recent transactions, active matters |
| Client Management |
Profiles, contact info, matter associations |
| Matter Management |
Link to clients, matter numbers, status tracking |
| Transaction Tracking |
Deposits, disbursements, running balances |
| Trust Holds |
Reserve funds, track reasons, available balance |
| Compliance Reports |
Monthly, three-way reconciliation, client ledger |
| Audit Trail |
Log all actions for compliance documentation |
Database Operations
PostgreSQL with Drizzle ORM. See references/database-schema.md for complete schema.
Commands
npm run db:push # Push schema (dev)
npm run db:generate # Generate migrations
npm run db:studio # Open Drizzle Studio
Core Tables
- clients: name, email, phone, address
- matters: clientId, name, matterNumber, status
- transactions: matterId, type, amount, date, payor/payee
- holds: matterId, amount, reason, status
- trustAccountSettings: firmName, state, bankInfo
- auditLog: action, entityType, entityId, details, timestamp
Development
Setup
npm install
cp .env.example .env.local
# Add DATABASE_URL to .env.local
npm run db:push
npm run dev
Environment
DATABASE_URL=postgresql://... # PostgreSQL connection
NEXTAUTH_SECRET=... # Auth secret (required for prod)
NEXTAUTH_URL=http://localhost:3000
IOLTA Compliance
See references/iolta-compliance.md for state-specific rules.
Supported Jurisdictions
All 50 states + DC with specific rules for record retention (5-7 years) and reconciliation requirements (monthly).
Key Compliance Concepts
- Three-way reconciliation: Bank statement + client ledgers + trust register
- Trust holds: Prevent disbursement of reserved funds
- Audit trail: Document all actions for bar compliance
Report Types
See references/reporting.md for generation patterns.
| Report |
Purpose |
| Monthly Trust Account |
Period transactions, opening/closing balances |
| Three-Way Reconciliation |
Bank vs ledger vs register comparison |
| Client Ledger |
Per-client fund tracking, all matters |
Common Tasks
Adding a New Report Type
- Create report component in
components/reports/
- Add API endpoint in
app/api/reports/
- Add to report selector in
app/reports/page.tsx
- Style with
lib/pdf-styles.ts
Adding a New Transaction Type
- Update transaction type enum in
db/schema.ts
- Modify transaction form component
- Update balance calculations in API routes
- Add to audit logging
State Compliance Rules
// lib/iolta-compliance.ts
export function getStateRules(state: string): IOLTARules {
// Returns retention period, reconciliation frequency, bar association
}
Security Considerations
- Bank account numbers masked (last 4 digits only)
- Show/hide toggle for sensitive data
- Audit trail for all actions
- Role-based access (when auth enabled)
Demo vs Production
Currently ships in demo mode. For production:
- Implement proper NextAuth.js authentication
- Add user roles (admin, attorney, paralegal, readonly)
- Enable RBAC for transactions/reports
- Configure proper NEXTAUTH_SECRET
Troubleshooting
| Issue |
Solution |
| Balance mismatch |
Check transaction types, verify holds |
| Report generation fails |
Verify date range, check matter exists |
| Hold amount exceeds balance |
Cannot hold more than available funds |
| Audit log missing entries |
Check audit.ts is called in API routes |
1---2name: iolta-manager3description: Development skill for CaseMark's IOLTA Manager application - a trust account management system for law firms to maintain IOLTA compliance. Features client/matter management, transaction tracking, trust holds, compliance reports, and audit trails. Built with Next.js 15, PostgreSQL, Drizzle ORM, and Tailwind CSS. Use this skill when: (1) Working on or extending the iolta-manager codebase, (2) Adding transaction or accounting features, (3) Modifying the database schema, (4) Building compliance reports, (5) Working with state-specific IOLTA rules, or (6) Implementing audit/security features.4---56# IOLTA Manager Development Guide78A trust account management application for law firms to maintain IOLTA (Interest on Lawyer Trust Accounts) compliance—tracking client funds, generating reports, and maintaining proper records per state bar requirements.910**Live site**: https://iolta-manager.casedev.app/1112## Architecture1314```15src/16├── app/17│ ├── api/ # API routes18│ │ ├── audit/ # Audit log endpoints19│ │ ├── clients/ # Client CRUD20│ │ ├── holds/ # Trust holds management21│ │ ├── matters/ # Matter management22│ │ ├── reports/ # Report generation23│ │ ├── settings/ # Firm settings24│ │ └── transactions/ # Transaction operations25│ ├── audit/ # Audit log page26│ ├── clients/ # Client pages27│ ├── holds/ # Holds management28│ ├── ledger/ # Transaction ledger29│ ├── matters/ # Matter pages30│ ├── reports/ # Reports page31│ └── settings/ # Settings page32├── components/33│ ├── holds/ # Hold-related components34│ ├── layout/ # Sidebar, navigation35│ ├── matters/ # Matter components36│ ├── reports/ # Report components37│ └── ui/ # Base UI components38├── db/39│ ├── index.ts # Database connection40│ └── schema.ts # Drizzle schema41└── lib/42 ├── audit.ts # Audit logging utilities43 ├── iolta-compliance.ts # State-specific rules44 ├── pdf-styles.ts # Report styling45 └── utils.ts # General utilities46```4748## Core Workflow4950```51Create Client → Create Matter → Record Transactions → Place Holds → Generate Reports52 ↓ ↓ ↓ ↓ ↓53 Contact info Link to client Deposits/ Reserve funds Monthly,54 stored assign number Disbursements prevent over- Reconciliation,55 track balance disbursement Client Ledger56```5758## Tech Stack5960| Layer | Technology |61|-------|-----------|62| Frontend | Next.js 15 (App Router), React, Tailwind CSS |63| Backend | Next.js API Routes |64| Database | PostgreSQL + Drizzle ORM |65| Auth | NextAuth.js (demo mode) |66| PDF | React PDF |67| Icons | Lucide React |6869## Key Features7071| Feature | Description |72|---------|-------------|73| Dashboard | Real-time trust balance, recent transactions, active matters |74| Client Management | Profiles, contact info, matter associations |75| Matter Management | Link to clients, matter numbers, status tracking |76| Transaction Tracking | Deposits, disbursements, running balances |77| Trust Holds | Reserve funds, track reasons, available balance |78| Compliance Reports | Monthly, three-way reconciliation, client ledger |79| Audit Trail | Log all actions for compliance documentation |8081## Database Operations8283PostgreSQL with Drizzle ORM. See [references/database-schema.md](references/database-schema.md) for complete schema.8485### Commands86```bash87npm run db:push # Push schema (dev)88npm run db:generate # Generate migrations89npm run db:studio # Open Drizzle Studio90```9192### Core Tables93- **clients**: name, email, phone, address94- **matters**: clientId, name, matterNumber, status95- **transactions**: matterId, type, amount, date, payor/payee96- **holds**: matterId, amount, reason, status97- **trustAccountSettings**: firmName, state, bankInfo98- **auditLog**: action, entityType, entityId, details, timestamp99100## Development101102### Setup103```bash104npm install105cp .env.example .env.local106# Add DATABASE_URL to .env.local107npm run db:push108npm run dev109```110111### Environment112```113DATABASE_URL=postgresql://... # PostgreSQL connection114NEXTAUTH_SECRET=... # Auth secret (required for prod)115NEXTAUTH_URL=http://localhost:3000116```117118## IOLTA Compliance119120See [references/iolta-compliance.md](references/iolta-compliance.md) for state-specific rules.121122### Supported Jurisdictions123All 50 states + DC with specific rules for record retention (5-7 years) and reconciliation requirements (monthly).124125### Key Compliance Concepts126- **Three-way reconciliation**: Bank statement + client ledgers + trust register127- **Trust holds**: Prevent disbursement of reserved funds128- **Audit trail**: Document all actions for bar compliance129130## Report Types131132See [references/reporting.md](references/reporting.md) for generation patterns.133134| Report | Purpose |135|--------|---------|136| Monthly Trust Account | Period transactions, opening/closing balances |137| Three-Way Reconciliation | Bank vs ledger vs register comparison |138| Client Ledger | Per-client fund tracking, all matters |139140## Common Tasks141142### Adding a New Report Type1431. Create report component in `components/reports/`1442. Add API endpoint in `app/api/reports/`1453. Add to report selector in `app/reports/page.tsx`1464. Style with `lib/pdf-styles.ts`147148### Adding a New Transaction Type1491. Update transaction type enum in `db/schema.ts`1502. Modify transaction form component1513. Update balance calculations in API routes1524. Add to audit logging153154### State Compliance Rules155```typescript156// lib/iolta-compliance.ts157export function getStateRules(state: string): IOLTARules {158 // Returns retention period, reconciliation frequency, bar association159}160```161162## Security Considerations163164- Bank account numbers masked (last 4 digits only)165- Show/hide toggle for sensitive data166- Audit trail for all actions167- Role-based access (when auth enabled)168169## Demo vs Production170171Currently ships in demo mode. For production:172- Implement proper NextAuth.js authentication173- Add user roles (admin, attorney, paralegal, readonly)174- Enable RBAC for transactions/reports175- Configure proper NEXTAUTH_SECRET176177## Troubleshooting178179| Issue | Solution |180|-------|----------|181| Balance mismatch | Check transaction types, verify holds |182| Report generation fails | Verify date range, check matter exists |183| Hold amount exceeds balance | Cannot hold more than available funds |184| Audit log missing entries | Check audit.ts is called in API routes |