Skip to content

About

How I built InstalDesk, a Python web and desktop app for installation contractors. Quotes, job documents and invoicing, with direct KSeF integration and Stripe subscriptions. Source code is private.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

InstalDesk

I build and maintain InstalDesk, a quoting and invoicing tool for small installation and service companies in Poland. It runs as a Windows application and a web service. Both connect directly to KSeF, Poland's national e-invoicing system.

My work covers the desktop app, backend, document generation, integrations, billing and releases. I also handle support and user contact.

Website · Web app · Portfolio

The source code is private. This repository is a technical write-up of the product.

What it does

The starting point is a quote: labour, materials, quantities and markup. From there, a contractor can produce an offer, contract, handover report and invoice using the same customer and job data.

  • Customer records and reusable price lists, with CSV/XLSX import and export.
  • Branded PDF documents, including VAT invoices, advance invoices, final invoices and corrections.
  • KSeF submission, status checks, invoice history and UPO acceptance receipts.
  • Purchase invoices retrieved from KSeF, with exports for accounting.
  • Team accounts and a 14-day trial without a card. Paid access uses Stripe subscriptions.

Architecture

flowchart LR
    Browser["Browser / PWA"] --> Web["FastAPI · Jinja2 · HTMX"]
    Web --> WebDB[("SQLite · company records")]
    Web --> Stripe["Stripe"]
    Web --> KSeF["KSeF API v2"]
    Desktop["Windows · Tkinter"] --> LocalDB[("Local SQLite")]
    Desktop --> KSeF
    Desktop -. "login / subscription access" .-> Web
    Website["Website · Flask"]
Loading

The two apps share an account and subscription, but keep separate databases. A desktop backup can be imported into the web account to bring over customers, price-list entries, quotes and selected company details. This is a manual migration of those records. Automatic synchronization is still to do.

The desktop can prepare quotes and documents without a connection. It caches successful subscription checks, with a default 14-day offline grace period. The PWA caches static files and shows an offline screen when the network is unavailable. Its business operations need a connection.

Part Built with
Web FastAPI, SQLAlchemy, Alembic, Jinja2, HTMX
Desktop Tkinter, SQLite, PyInstaller
PDFs ReportLab and configurable templates
KSeF Python client, FA(3) XML, XSD validation, XAdES-BES authentication
Hosting and releases Docker Compose, Caddy, Cloudflare, GitHub Actions

The web app also uses SQLite, configured with WAL, foreign keys and a busy timeout. Companies share tables, so queries and routes enforce record ownership. Team members work on their company's data.

I reuse the PDF generators and KSeF client across both apps. Some of that code still lives in desktop modules and is imported by the web service. Moving it into a separate core is one of the remaining refactors.

KSeF submissions after a timeout

An awkward case is an invoice that reaches KSeF, followed by a failed response or a rate limit while fetching its receipt. Sending it again can return a duplicate error even though the original invoice was accepted.

The client keeps the session and invoice references so it can check the original submission. Validation errors, bad credentials, rejection and pending processing have different handling. For example, an HTTP 429 during UPO retrieval leaves the original submission available for a later status check. A database reservation prevents two web requests from submitting the same quote at once.

Both apps support tokens and certificates. XAdES-BES signs the authentication request. Desktop signing uses local certificate and key files; the web app stores uploaded private keys encrypted and signs on the server. Stored tokens and selected secrets use Windows DPAPI on desktop and AES-GCM on web.

Invoice PDFs from issued XML

A quote can change after its invoice has been sent. Printing the current quote as that invoice would give the customer a PDF with different content from the document in KSeF.

I keep the issued XML and submission history. The PDF for an issued invoice takes its contents from the corresponding XML. Corrections account for the original document and earlier corrections. Final invoices settle advances by VAT rate. In offline issuance, the XML is saved before submission and sent later with that same content.

Team permissions and subscriptions

Data access resolves a team member to the company owner, but permissions are checked against the person who logged in. Office staff can submit invoices and view purchase invoices. The owner manages company settings, KSeF credentials, billing and the team. Tests make direct requests to protected routes to check those restrictions.

After Stripe Checkout, the app retrieves the session, checks that it belongs to the logged-in account and activates access. This lets the user continue even if the webhook has yet to arrive. Webhooks update later subscription changes, and the desktop checks access through the same account.

Tests and releases

Regression tests cover KSeF timeouts and duplicate submissions, correction chains, PDF contents, company isolation, permissions, subscriptions and the updater. Live KSeF and browser suites are enabled separately.

GitHub Actions runs fast tests on Linux, with a Windows job for the suite including GUI tests. Scheduled smoke checks follow registration, quote creation and PDF generation. Another job installs only the production dependency manifests and runs the smoke path. It catches packages that are available in the development environment but missing from the Docker build.

Tagged releases build desktop files and container images. The release workflow checks that the app version matches the tag. The desktop updater checks downloaded files against SHA-256 checksums.

Still to do

Automatic synchronization between desktop and web, assigning individual documents to field technicians, and extracting the shared code from desktop modules are still on the roadmap.

Last updated: 2 October 2026.

Jakub Kierznowski · Portfolio

About

How I built InstalDesk, a Python web and desktop app for installation contractors. Quotes, job documents and invoicing, with direct KSeF integration and Stripe subscriptions. Source code is private.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors