Conta

Role: Backend Developer & Tooling Engineer
Project: Independent CLI accounting tool for freelancers (Spain)

Built Conta, a Python-based command-line tool that helps self-employed professionals keep track of invoices, deductible expenses, social security payments, and quarterly tax obligations in Spain. The application combines a typed domain model, SQLite-backed persistence, and task-focused commands to provide a fast workflow for everyday bookkeeping.

View the project: Source code on GitHub

Core Responsibilities & Contributions

Product Architecture & System Design

  • Designed a modular accounting engine using Python 3.10, sqlmodel, pydantic, and SQLite for local, file-based storage
  • Modeled core bookkeeping entities (FacturaEmitida, GastoDeducible, PagoAutonomo, PagoFraccionado130) with explicit enums for activity types (programacion, musica)
  • Structured the application as a reusable package with a dedicated conta entry point and environment-based configuration

CLI UX & Workflow Automation

  • Implemented a multi-command CLI using Typer, with structured help text and argument parsing tailored to Spanish tax workflows
  • Added commands to register issued invoices (emite), deductible expenses (gasto), autonomous social security payments, and fractioned IRPF payments
  • Provided rich terminal output using the Rich library, including tabular listings for invoices and expenses
  • Included validation and helpful error messages for dates, numeric fields, and quarter formats to reduce user mistakes

Tax & Reporting Logic for Spanish Freelancers

  • Encapsulated quarterly VAT (IVA) calculations in a dedicated service, computing devengado (owed) and deducible (deductible) VAT per quarter
  • Implemented IRPF accumulated snapshot logic matching the structure of Modelo 130 (base, withholdings, previous payments) via the irpf_snapshot_acumulado service
  • Accounted for social security contributions, prior fractioned payments, and activity filters to give a realistic view of quarterly income tax obligations

Data Model & Persistence

  • Used SQLModel to define typed tables with indexes on dates and invoice numbers for efficient filtering and reporting
  • Ensured idempotent operations for critical entities (e.g. preventing duplicate invoice numbers on creation)
  • Managed a lightweight SQLite database file, initialized via a single conta init command

Exports, Backups & Extensibility

  • Built CSV export of official VAT books (libros de IVA) using pandas, generating separate files for issued and received invoices per quarter
  • Added a backup-db command to create timestamped copies of the SQLite database for safe archiving
  • Implemented PDF import hooks for invoices, laying the groundwork for automating data entry from scanned documents
  • Structured the project with FastAPI and Uvicorn dependencies to allow a future evolution from pure CLI to a small web dashboard without changing the core domain layer

Read the full case study →

Project Gallery

Conta list of command
List of commands
Conta command usage for issuing an invoice
Command usage for issuing an invoice
Conta command usage for recording an expense
Command usage for recording an expense
Conta list of issued invoices for a given quarter
List of issued invoices for a given quarter
Conta list of expenses for a given quarter
List of expenses for a given quarter
Conta Spanish tax report forms for a given quarter
Spanish tax report forms for a given quarter