Hospital management software, built for India

Blog / Engineering

Why we chose Postgres and .NET 9 for a hospital platform

The reasons behind our database and our code: correctness for billing and stock, a choice of hosting, no lock-in, and the trade-offs we accept.

Developer writing code on two monitors in an office
Photo: Pexels

Hospital software is not a typical app. It runs around the clock, it handles money and medicines, and the records it keeps have to outlive the computers they were typed on. Those three facts drove the two biggest technical choices behind Carexa OS: PostgreSQL for the database and .NET 9 for the code.

Why PostgreSQL

Correctness first

A bill, a stock movement and a payment must all be saved together, or not at all. PostgreSQL's transactions give exactly that guarantee, and its constraints let the database itself refuse data that cannot be right, such as a payment pointing at a bill that does not exist. In a hospital, a quiet inconsistency in billing or stock is worse than an error message.

Healthcare data comes in more than one shape

Much of hospital data fits neatly in tables: patients, visits, bills, stock. Some of it, like documents exchanged in healthcare standards such as FHIR, is naturally a structured document. PostgreSQL handles both well, in one database, with one backup and one set of security rules.

It runs wherever a hospital needs it

Carexa runs in our Mumbai cloud region, in a sovereign Indian cloud for Enterprise customers, or on-premises. PostgreSQL is open source and runs the same way in all three, so a hospital's choice of hosting does not change the software underneath.

Your data stays yours

Because PostgreSQL is open and widely used, a hospital's data is never locked in a proprietary format. If a customer leaves, we export their data as FHIR Bundles plus a Postgres dump, both of which other systems can read.

Why .NET 9

Mistakes caught before they ship

C# and .NET are strongly typed: whole classes of mistakes, like passing a bed number where a patient ID belongs, are caught when the code is built, not when a nurse is using it. For software that touches medicines and money, that matters.

One language, server and desktop

Our server and our Windows desktop client, the one that keeps reception running when the internet drops, are both written in .NET. The same rules for a bill or a prescription can be shared by both, instead of being written twice and drifting apart.

Fast, modern and well supported

Modern .NET is fast, runs on Linux servers as well as Windows, and has a large ecosystem, including well-established libraries for healthcare standards like FHIR.

The trade-offs

No choice is free. .NET 9 is a standard-term support release, so its support window is shorter than a long-term release and we have to keep upgrading. That suits how we work, since we ship updates every two weeks anyway. PostgreSQL rewards careful design and operation: good indexes, routine maintenance and tested backups, which is why daily backups are part of every plan.

What it means for a hospital

  • Billing and stock you can trust, because the database will not save half a transaction.
  • A choice of hosting without a different product for each.
  • No lock-in: your data leaves in open formats if you ever leave.

Questions about the architecture? The developer portal covers our REST and FHIR R4 APIs, or talk to us.