Open, modular software for Maa Gayatri Path Lab, a pathology laboratory in Arang, Raipur, Chhattisgarh.
Covers patients, samples, reports, billing, books and catalog, as small typed packages that each do one job well.
db-kit |
auth-kit |
catalog-kit |
report-kit · invoice-kit |
ledger-kit |
finance-kit |
security-kit |
|
mail-kit |
|
worker-kit |
|
|
Each new kit does one job well and plugs into the same GraphQL API. Watch this organisation for what ships next. |
|
api backend |
The backend: one GraphQL endpoint on Fastify that combines every kit |
client frontend |
Headless, typed, zero-dependency SDK with a method for every GraphQL operation. Bring your own UI |
website site |
The lab's public website: a living 3D lab, the full test catalogue with prices, home collection and booking |
report-studio app |
Reference Next.js app: report and invoice designer, result entry |
lab-panel coming soon |
Registrations, samples, results, billing and books for every branch |
auth client coming soon |
Sign-in for frontends, with adapters for TanStack Query and others |
flowchart LR
subgraph Apps
P[lab panel]
S[report-studio]
W[website]
end
Apps -->|"GraphQL"| API["api<br/>Fastify · GraphQL Yoga"]
API --> AUTH[auth-kit]
API --> DB[db-kit]
API --> CAT[catalog-kit]
API --> RND["report-kit · invoice-kit"]
API --> FIN[finance-kit]
FIN --> BOOKS[ledger-kit]
BOOKS --> DB
FIN --> DB
DB --> M[(MongoDB)]
DB --> PG[(PostgreSQL)]
DB --> R[(Redis)]
AUTH --> R
RND --> PDF["A4 PDF / HTML<br/>inside the GraphQL response"]
One endpoint. Everything goes through POST /graphql, PDFs included (as base64). The only other route
is a health check.
import { createMgplGraphQLClient, documentBlob, openBlob } from "@mgpl-diagnostics/client";
const mgpl = createMgplGraphQLClient({ url: "https://api.your-lab.in/graphql" });
await mgpl.auth.login({ email: "desk@your-lab.in", password });
const patient = await mgpl.patients.register({ branchId, name: "Kavita Sharma", sex: "female", ageYears: 32 });
const invoice = await mgpl.invoices.issue({
branchId, patientId: patient.id,
items: [{ code: "CBC" }], // name and MRP from the catalog
payments: [{ amountPaise: 30000, mode: "upi" }],
});
// → numbered per branch and financial year, Sales + Receipt vouchers posted, books still balance
openBlob(documentBlob(await mgpl.documents.invoice(invoice.id))); // the A4 PDF, as base64 over GraphQL- Money is exact. Integer paise, double-entry vouchers that must balance, and ACID transactions on MongoDB and PostgreSQL. Tests show two concurrent overpayments can't both succeed.
- Both databases, one contract. The same test suite runs on real MongoDB and real PostgreSQL.
- Secure by default. Tokens are stored only as hashes. Data is isolated per organisation, and permissions are checked per branch.
- HTML and PDF match. One geometry, one row model, the same page breaks; every value is checked inside the PDF.
- No patient data in any repo. Real signatures load at runtime from the server and are never committed.
- Docs for people and AI. Every repo has a README,
AGENTS.mdandllms.txt. - Reviewed, always. Nobody pushes to
main. Every change is a pull request from a fork, with green CI and a code-owner review. How to contribute →
© MGPL Diagnostics (Maa Gayatri Path Lab), Arang, Raipur. Code is published for reference; all rights reserved.