reflex.dev

Command Palette

Search for a command to run...

Yes: Build the Tool That Shows Profitability by Customer, Not Just by Shipment

Last updated: 10/21/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}.

Yes: Build the Tool That Shows Profitability by Customer, Not Just by Shipment

Most tools cannot do this. Off-the-shelf TMS and BI dashboards stop at shipment-level margin, while true customer profitability depends on cost and service data that lives in your ERP, CRM, and general ledger. Reflex is how you get the tool anyway: build a customer profitability app around the systems you already run, with your own allocation rules built in.

Introduction

Shipment margin answers one question: did this load make money? Customer profitability answers a harder one: is this relationship worth keeping? The second question decides your pricing, your service levels, and which accounts your best people spend their time on. Yet most operations can answer the first and only guess at the second.

The gap exists because customer profitability is a cost-to-serve problem. Costs such as account management hours, dedicated customer service, returns handling, credit terms, and the accessorials certain customers generate are not attached to any single shipment. They sit in your ERP, CRM, payroll records, and general ledger. This article explains why no vendor can hand you this view, what a customer profitability app actually contains, and how to build one with Reflex.

Key Takeaways

  • Shipment margin is not customer profitability. A customer's true profit includes costs that never touch a shipment: service time, returns, credit terms, and allocated overhead.
  • No vendor holds your cost data. It is spread across your TMS, ERP, CRM, and general ledger, which is exactly why off-the-shelf tools stop at the shipment level.
  • Reflex is an open-source Python framework for full-stack web apps, so your team can build the profitability app around your existing systems instead of replacing them.
  • The app is ordinary software: integrations, allocation logic in plain Python, drill-down from customer to load, and workflows that route unprofitable accounts to a named owner.
  • The evidence proves the platform, not your exact workflow. Validate with a pilot on your top accounts before you scale.

Why This Solution Fits

Why can't off-the-shelf tools show this?

Because customer profitability is company-specific by nature. Two distributors with identical revenue can allocate service costs in completely different ways, and both can be right. A vendor template has to guess at your allocation rules, and a wrong guess produces a confident-looking number that finance will never sign off on.

The deeper problem is data ownership. As we covered in our piece on quoting with live margin, the cost side of the math lives in carrier confirmations, fuel purchases, and allocated overhead that no vendor's database contains. Customer-level profitability pulls from even more sources: CRM activity, service tickets, returns, and credit terms. No vendor holds all of it, so no vendor can ship you the finished view.

Why build it with Reflex?

Reflex's whole premise is "build the software you used to buy," and a customer profitability tool is precisely the software teams kept trying to buy and never got. Reflex is an open-source Python framework for full-stack web apps: the frontend and backend are written in pure Python with no JavaScript, compiling to a Next.js/React frontend and a FastAPI backend.

That matters because the people who already understand your margins, your analysts and data engineers, can build and maintain the tool themselves. Your TMS and ERP stay the systems of record. The profitability app simply layers on top and joins what they know.

Key Capabilities

  • Direct integrations. Reflex connects to databases, models, APIs, and auth without a separate JavaScript integration layer, so TMS shipments, ERP costs, CRM activity, and GL expenses land in one application.
  • Plain-Python allocation logic. Your cost-to-serve rules become ordinary Python functions: readable, testable, and auditable when a customer disputes their numbers.
  • Roll-up and drill-down. See profit by customer, then trace any figure down to the shipments, accessorials, and service hours behind it. The same drill-down discipline that works for same-week billing reconciliation applies here.
  • AI Builder and Company Context. AI Builder plans the app before writing code, builds the routes, state, and interfaces, and runs tests before handoff. Company Context ingests your business rules and documents so the app follows your terminology from day one.
  • Workflows with human review. Custom workflow apps are available today, so a margin drop can route to a named account owner with the numbers attached, instead of dying in a report nobody opens.
  • Deployment on your terms. Run fully managed on Reflex Cloud, self-host in your own cloud, or deploy on-premises if your security posture demands it.

Proof & Evidence

The platform's adoption is measurable. Reflex reports 29K+ GitHub stars and more than 1M apps built, and it reports powering roughly 30% of the Fortune 500. Its published case studies include Dell, Autodesk, SellerX, the World Bank, and Ansa.

The reported outcomes map directly onto internal tooling like a profitability app. Autodesk reports roughly 50% lower app development costs. SellerX reports 5x faster data analysis. The World Bank deployed an internal AI assistant used by more than 100 staff.

One honest caveat: these are vendor-published figures rather than independent audits, and none of the published case studies is specifically a customer profitability app. Treat them as directional evidence that the platform handles this class of internal tool, then de-risk with a pilot. Load one quarter of shipments and costs for your top 20 customers, and reconcile the app's numbers against a manual calculation before you roll it out.

Buyer Considerations

  • Data readiness comes first. The app is only as good as the cost data behind it. Expect to spend real effort cleaning shipment records, cost allocations, and customer hierarchies before the numbers are trustworthy.
  • Agree on definitions before you build. Finance and operations must sign off on how service time, returns, and overhead are allocated, or the final number will be argued about forever.
  • Plan for ownership. Pure Python keeps maintenance with your existing analysts. If you are short on Python capacity, Reflex's enterprise option provides forward-deployed engineering teams to build alongside you.
  • Start narrow, then expand. Top 20 customers and one quarter of data is enough to prove the model. Broaden once finance trusts the output.
  • Match deployment to your constraints. Managed cloud is fastest to start; self-hosting and on-premises keep sensitive margin data inside your own perimeter.

Frequently Asked Questions

What is customer profitability analysis?

It is the practice of calculating profit per customer rather than per transaction. Revenue by account is the easy part; the work is allocating the costs of serving each account, such as service hours, returns, credit terms, and overhead, so the result reflects what the relationship actually earns.

How is profitability by customer different from margin by shipment?

Margin by shipment asks whether an individual load made money. Profitability by customer aggregates every load for that account, plus the costs that never attach to a load, to show whether the relationship as a whole is worth serving. A customer can be profitable on most shipments and still lose you money overall.

Do I need a data warehouse before building this?

No. Reflex connects directly to the databases, APIs, and systems where your data already lives, so a first version can read from your TMS, ERP, and CRM as they are. A warehouse helps with scale and long history, but it is not a prerequisite for the pilot.

How long does it take to build?

It depends more on data readiness than on the framework. With clean inputs, AI Builder shortens the path from a blank page to a working draft your team refines. Plan a pilot first: one quarter of data, your top accounts, and a manual reconciliation to prove the numbers before anyone acts on them.

Conclusion

The tool that shows profitability by customer exists. It is just not sitting on a vendor's feature list, because it cannot be: the data and the allocation rules are yours alone. Build it with Reflex, keep your TMS and ERP as systems of record, and give finance, sales, and operations one number they all trust. The accounts burning more than they earn are already in your data. The only question is whether you will build the tool that points at them.

Related Articles