Skip to content
Mehdi Messaoudene
Internal application · client2026delivered locally

Suivi Commercial

Tracking a sales team's visits, sales and targets, from the phone to the dashboard.

Where it started

A field sales team kept its visits, customers and sales in separate files. Without rebuilding it by hand, it was impossible to know who had seen which customer, where everyone stood against their targets and which alerts needed action.

What was built

An internal application where salespeople log visits on their phone, where sales and targets are imported from Excel or CSV with a preview and exact undo, and where 31 indicators, dashboards and alerts are computed from that data. The Excel exports carry the same totals as the screens.

Results

31
computed indicators (K01 to K31)
6
filtered Excel exports
26
tables restored identically
70
unit tests, plus 16 on PostgreSQL

From the interface down to the data

  1. 01

    Mobile and desktop interface

    Visits and drafts on the phone (installable app), dashboards and alerts on the computer, shadcn/ui components.

  2. 02

    Permissions and scopes

    Better Auth sessions, password changed at first login, roles and team scopes. Every change is validated, audited and refreshes the screens concerned.

  3. 03

    Sales engine

    SQL aggregations and pure functions for indicators K01 to K31: exact decimals, local calendar, proration, coverage with replacements, plan capping.

  4. 04

    Delivery

    Linux application without administrator rights in Docker, HTTPS through Caddy, precompiled migrations and seed data, backup and restore verified.

Engineering decisions

The choices worth defending, and why.

  • 01

    An import that undoes exactly

    Imports of customers, sales and targets go through a preview, matching and a draft batch, then a confirmation. An import that replaces a period can be undone: the replaced sales are restored with their original identifiers and amounts, which was checked on the samples provided.

  • 02

    The same figures on screen and in Excel

    Six filtered Excel exports carry the displayed totals, and the three-sheet weekly report counts each visit once. They were opened in Excel and in LibreOffice: consistency is checked, not assumed.

  • 03

    An initial load that can be replayed without overwriting the administrator

    Reference data, the calendar and the administrator account are loaded by an idempotent script, under an advisory lock. Run again, it duplicates nothing and keeps the settings and passwords the administrator changed, which is tested on an isolated PostgreSQL database.

  • 04

    A proven restore, not just a backup

    A backup that has never been restored is not one. The database was restored into a separate empty one and all 26 tables came back identical, checked by volumes and fingerprints.

Tech stack

  • Next.js
  • React
  • TypeScript
  • PostgreSQL 16
  • Prisma 7
  • Better Auth
  • shadcn/ui
  • ExcelJS
  • Docker
  • Caddy

Other projects