Documentation
Everything you need to get started with LockMargin Early Access.
Quick Start
LockMargin is a portable desktop application. No installer, no cloud account, no subscription.
- Download the latest release (LockMargin Early Access) from the download page.
- Extract the
.ziparchive to any folder on your machine. - Run
LockMargin.exe. The app launches immediately — no setup wizard, no registration. - Press Ctrl+K (Windows) or Cmd+K (macOS) to open the Command Palette and start creating clients, projects, or invoices.
- Optionally enable AES-256-GCM encryption via Settings → Security → Initialize Encryption.
Tech Stack
LockMargin is built with modern, battle-tested technologies:
| Layer | Technology |
|---|---|
| Frontend | TypeScript 5.9, React 19, TailwindCSS 4, Zustand 5, TanStack React Query 5 |
| Backend | Rust (edition 2021), Tauri 2.0, SQLite via sqlx 0.8 |
| Encryption | AES-256-GCM, PBKDF2-HMAC-SHA256 (100k iterations), system keychain (Windows Credential Manager) |
| Icons | Lucide React 0.562 |
| Charts | Recharts 3.8 |
| Dates | date-fns 4.3 (frontend), chrono 0.4 (backend) |
| Serialization | serde 1.0 + serde_json, ts-rs 7 (TypeScript export) |
| Payments | async-stripe 0.37 |
| lettre 0.11 (SMTP, TLS) |
Clients
Manage your clients with full CRUD operations, encrypted sensitive fields, and soft delete.
Encrypted Fields
When encryption is enabled, the following client fields are encrypted with AES-256-GCM before storage:
bank_account_encrypted— Bank account detailstax_id_encrypted— Tax identification numbercontact_info_encrypted— Contact information
Commands
All client actions are available through the Command Palette (Ctrl+K):
create_client— Add a new clientget_clients/get_clients_with_stats— List clients with optional financial statsget_client_financial_dossier— View revenue, expense, and invoice totals per clientupdate_client/delete_client— Edit or soft-delete a clientimport_clients_csv— Bulk-import clients from CSVrestore_client/permanently_delete_client— Manage deleted records
Projects
Organize work into projects with stages, budget tracking, and health scoring.
Project Stages
Each project can have multiple stages with different billing types:
- Fixed — Fixed-price stage
- Retainer — Recurring monthly fee
- Hourly — Billed by time entry
Project Health
LockMargin calculates a project health score (health_score) based on budget vs. actual spend, timeline, and stage completion. Access via calculate_project_health or the dashboard.
Commands
create_project/delete_project/update_project_statusget_projects_with_stats— Projects with budget, health, and stage progresscreate_stage/update_stage/delete_stage
Time Tracking
Track time with categories, session timers, and automatic billing status.
Active Timer
Start and stop a timer from the dashboard. The active session persists even if the app is closed.
Commands
start_timer/stop_timer/get_active_timer— Timer session managementcreate_time_entry/get_time_entries/update_time_entry/delete_time_entryget_unbilled_time_entries— Find time not yet invoicedcreate_time_entry_category/get_time_entry_categories
Expenses
Track business expenses with categories and receipt file attachments.
create_expense/get_expenses/update_expense/delete_expense- Combined with the recurring engine for auto-recurring expenses
Invoices
Full invoicing with payment tracking, PDF generation, and email delivery.
Invoice Features
- Create invoices manually or from time entries (
create_invoice_from_time) - Partial payments via
create_invoice_payment(supports Stripe, credit, manual) - PDF generation with
generate_invoice_pdfandsave_pdf_file - Email invoices via SMTP with
send_invoice_emailand email log - Reusable invoice templates (
create_invoice_template) - Discount support on invoices and line items
Invoice Statuses
Invoices support a status workflow: draft, sent, paid, overdue, cancelled, refunded.
Quotes & Proposals
Quotes
Create estimates and quotes with tax and discount support. Quotes can be converted to invoices on acceptance.
create_quote/get_quotes/get_quote/delete_quoteupdate_quote_status— Track through draft, sent, accepted, rejectedconvert_quote_to_invoice— One-click conversion on acceptance
Proposals
Scope documents for larger engagements, with line items and status tracking.
create_proposal/get_proposals/get_proposalupdate_proposal_status
Recurring Engine
LockMargin's most distinctive feature: a reactive recurring engine that does not use cron jobs. Instead, recurring items are generated on demand when they become due — triggered by app launch or manual check.
How It Works
- Define recurring schedules for both invoices and expenses
- On app launch or explicit trigger,
find_due_recurring_itemschecks which items are past due mark_recurring_items_generatedrecords the generation to prevent duplicates- Works fully offline — no server connection needed
Commands
create_recurring_invoice/get_recurring_invoices/generate_recurring_invoicescreate_recurring_item_cmd/list_recurring_items_cmd— Unified engine for both invoices and expensesgenerate_due_recurring/toggle_recurring— Expense-side recurring management
Tax Rates
Define tax rates per country and apply them to invoices and quotes.
create_tax_rate/get_tax_rates/get_tax_rateupdate_tax_rate/delete_tax_rateget_default_tax_rate— Set and retrieve default tax rate for new invoices
Client Credits
A credit-based payment system for invoicing. Clients can prepay credits, which are applied to invoices as payments. Supports multiple credit types per client with balance tracking.
- Model:
ClientCredit— credit_type, amount_cents, balance_cents, source, reference_type - Used for retainer billing, prepaid blocks, and deposit management
Dashboard & Metrics
The dashboard (Dashboard v4) provides real-time financial and operational metrics computed locally from your data.
Core Metrics
| Metric | Description |
|---|---|
| Revenue | Total invoiced revenue (cents) |
| Expenses | Total tracked expenses (cents) |
| Profit | Revenue minus expenses (cents) |
| Margin % | Profit margin percentage |
| RHR | Revenue-to-Hour Ratio — revenue per hour worked |
| Runway | Months of operation based on current balance vs. monthly burn |
Dashboard Components
- Attention Items: Alerts for overdue invoices, low runway, project health warnings
- Active Projects: Budget progress and health score per project
- Cash Flow Chart: Date-wise inflow, outflow, and balance visualization
Runway & RHR
Runway Calculation
LockMargin's signature metric: get_runway_with_personal. Unlike SaaS tools that show only your bank balance, LockMargin calculates how many months you can operate based on:
- Current balance (business accounts)
- Average monthly burn rate (business + personal expenses)
- Pending invoices and projected revenue
Revenue-to-Hour Ratio (RHR)
RHR (rhr_cents) measures your revenue per hour worked. Track this over time to understand if your hourly rate is keeping pace with expenses.
Encryption Guide
LockMargin uses AES-256-GCM encryption with system keychain storage. Your encryption key is never stored in the database or in files.
How Encryption Works
- Key Derivation: A master key is derived using PBKDF2-HMAC-SHA256 with 100,000 iterations and a random salt.
- Key Storage: The master key is stored in your system keychain (Windows Credential Manager via the
keyringcrate). - Salt Storage: The salt is stored in the
encryption_metadatatable — separate from the key itself. - Field Encryption: Each encrypted field uses a unique nonce. Encrypted fields include bank accounts, tax IDs, contact info, payment method details, and OAuth tokens.
Setup
Go to Settings → Security and click Initialize Encryption. The app will generate and store your key. Use check_encryption_status to verify.
Tested
6 unit tests passing: roundtrip encryption/decryption, unique outputs per encryption, wrong key rejection, invalid base64 handling, deterministic key derivation, and different salt isolation.
Soft Delete & Audit Log
Soft Delete
All major entities support soft delete with a deleted_at timestamp:
- Clients (
clients.deleted_at) - Projects (
projects.deleted_at) - Time entries (
time_entries.deleted_at) - Expenses (
expenses.deleted_at)
Use get_deleted_clients and restore_client (and equivalents for other entities) to recover deleted records. permanently_delete_client removes data entirely.
Audit Log
LockMargin maintains an immutable audit trail (audit_log table) recording every action:
- Action types: CREATE, UPDATE, DELETE, EXPORT
- Tracked data: entity type, entity id,
changes_json(diff snapshot), idempotency key
Export & Backup
PDF Export
export_projects_pdf/export_invoices_pdf/export_clients_pdfgenerate_invoice_pdf/save_pdf_file— Generate and save invoice PDFs
CSV Export
export_projects_csv/export_clients_csv/export_invoices_csv
Backup & Restore
create_backup— Create a full backup of your SQLite databaselist_backups— List available backupsrestore_backup— Restore from a backup filedelete_backup— Delete old backup files
CSV Import
Bulk-import clients from a CSV file using import_clients_csv. The app validates and processes the data locally — nothing is sent to a server.
CSV exports include all fields (excluding encrypted data which exports as ciphertext). Use CSV export for reporting, accounting handoff, or migration planning.
Command Palette (Ctrl+K / Cmd+K)
The Command Palette is the primary navigation and action interface in LockMargin. Press Ctrl+K (Windows/Linux) or Cmd+K (macOS) to open it.
21 actions organized into 4 categories:
- Create — New client, project, invoice, expense, quote, proposal
- Navigation — Go to Dashboard, Clients, Projects, Invoices, Settings
- Settings — Encryption, export, backup, preferences
- Help — Documentation, about, shortcuts reference
Built with cmdk 1.1.1 for fast, keyboard-first interaction.
Commands Reference
Complete list of backend commands available through the Tauri IPC bridge. Access any command via Ctrl+K or the menu.
| Category | Command |
|---|---|
| Clients | get_clients, get_client_financial_dossier, get_clients_with_stats, create_client, update_client, delete_client, import_clients_csv, get_deleted_clients, restore_client, permanently_delete_client |
| Projects | get_projects_with_stats, create_project, delete_project, update_project_status, get_project_stages, create_stage, update_stage, delete_stage, calculate_project_health, get_all_project_healths, get_project_health |
| Time | create_time_entry, get_time_entries, update_time_entry, delete_time_entry, get_unbilled_time_entries, start_timer, stop_timer, get_active_timer, get_time_entry_categories, create_time_entry_category, update_time_entry_category, delete_time_entry_category |
| Expenses | create_expense, get_expenses, update_expense, delete_expense |
| Invoices | get_invoices, get_invoices_with_items, get_invoice, create_invoice, create_invoice_from_time, update_invoice_status, delete_invoice, create_invoice_payment, list_invoice_payments, delete_invoice_payment, get_invoice_templates, create_invoice_template, delete_invoice_template, send_invoice_email, get_email_log, generate_invoice_pdf, save_pdf_file |
| Quotes | create_quote, get_quotes, get_quote, update_quote_status, delete_quote, convert_quote_to_invoice |
| Recurring | find_due_recurring_items, mark_recurring_items_generated, create_recurring_item_cmd, update_recurring_item_cmd, delete_recurring_item_cmd, list_recurring_items_cmd, create_recurring_invoice, get_recurring_invoices, get_recurring_invoice, update_recurring_invoice_status, delete_recurring_invoice, generate_recurring_invoices, get_recurring_invoice_items, generate_due_recurring, list_recurring, create_recurring, toggle_recurring |
| Proposals | create_proposal, get_proposal, update_proposal_status, get_proposals |
| Tax | create_tax_rate, get_tax_rates, get_tax_rate, update_tax_rate, delete_tax_rate, get_default_tax_rate |
| Security | initialize_encryption, check_encryption_status |
| Export | export_projects_pdf, export_invoices_pdf, export_clients_pdf, export_projects_csv, export_clients_csv, export_invoices_csv, create_backup, list_backups, restore_backup, delete_backup |
| UX | open_assets_folder |
Database Overview
LockMargin uses a local SQLite database with 33 tables managed by 47 migration files. The database is stored entirely on your machine under the app data directory.
| Group | Tables |
|---|---|
| Core | clients, projects, project_stages, time_entries, expenses, invoices, invoice_items, invoice_payments |
| Financial | quotes, quote_items, tax_rates, recurring_items, client_credits |
| Security | encryption_metadata, audit_log, active_sessions, calendar_tokens, calendar_events |
| Auxiliary | app_settings, backups, email_log, assets, invoice_templates, proposals, proposal_items, time_entry_categories, time_entry_invoice_items |
Development Status
Current Release
Early Access — Release preparation phase. Latest commit: daf20b4 — Sprint 8: Stealth/Privacy Mode.
Completed Sprints
- Sprint 1: Core CRUD (clients, projects, invoices)
- Sprint 2: Time Tracking + Expenses
- Sprint 3: Invoicing + Recurring + Quotes
- Sprint 4: Dashboard + Export + Search
- Sprint 5: Polish + Smart Features
- Sprint 6: Credit-based payment system
- Sprint 7: Real AES-256-GCM encryption
- Sprint 8: Stealth/Privacy Mode
Upcoming Sprints
- Sprint 9: Data portability (JSON/YAML export/import)
- Sprint 10: Multi-currency support
- Sprint 11: Reporting engine (P&L, tax reports)