The problem
A gaushala is a real working business. The gaushala in Coimbatore has 480+ cows. They produce milk every morning and evening. They breed cows and track every insemination. They vaccinate calves on a schedule. They treat sick cows. They sell milk. They occasionally sell or transfer cows. They keep careful track of lineage going back generations.
And they were running all of it on paper.
- Milking records were jotted into a logbook every morning and evening. The logbook sat on a hook in the shed. Nobody could really see whether a specific cow's production was going up or down over time without flipping through months of pages.
- Breeding records lived in a different notebook. Bull X mated with cow Y on date Z, and three months later somebody would try to remember to check if she was pregnant. Sometimes that check happened. Sometimes it didn't.
- Vaccinations were scheduled on a wall calendar. Crosses on dates. If a cow's mark got missed, the cow's mark got missed.
- Medical treatments were either remembered by the vet or written on a slip of paper that may or may not survive.
- Lineage tracking — who is this calf's mother? Who's the father? — was answered by "ask the worker who's been here longest."
- Reports for the family — milk per day, breed mix, breeding outcomes — were a once-a-year exercise in pulling numbers out of paper books and putting them into a spreadsheet manually.
The owner wanted a real system. But not a generic farm management tool built for an Australian cooperative dairy that doesn't understand desi breeds. Not a spreadsheet. Not "buy this SaaS subscription and try to fit your business into it." A system built around how the gaushala actually runs, with the breeds they actually have, the workflows they actually use, the alerts they actually need, in the language they actually speak.
There was also a second problem — one that didn't become obvious until the desktop system was already live:
The workers don't sit at a desk. They're walking through the shed. They're standing next to a cow. They're holding a milk pail. The desktop app, on a laptop in the office, is the wrong place to record a milking that just happened in the shed.
So the project ended up being two front-ends, not one — sharing the same brain.
The approach
Most agri-tech projects fail in one of two ways. Either they over-build (try to be the "operating system for any farm in the world" and end up too generic to be useful), or they under-build (a glorified spreadsheet with cow photos).
We took a third path: build it for one specific gaushala, in real depth, then keep it adaptable enough that the same code could serve another one tomorrow if needed.
Phase 1 was the desktop app. We built every module the owner asked for, in the order he needed them: cow inventory first (the foundation), then milking (the most-used daily operation), then medical and breeding (the second-most-used), then alerts (which closed the loop), then the dashboard (which made the whole thing visible), then the AI chatbot and Telegram integration (which made it usable without opening the app). Six weeks of work, shipped in increments the owner used immediately.
Phase 2 — the part nobody planned for at the start — was the mobile-responsive app. Once the desktop was live and the owner started using it, it was obvious within a week that the workers needed something on their phones. They were avoiding the desktop because they had to walk back to the office to record anything. So entries were getting batched at the end of the day, mistakes were creeping in, and the whole "real-time data" advantage of the system was getting lost.
Instead of trying to retrofit the desktop app to be mobile-friendly (which is always slower and uglier than building it the right way), we built a second front-end from scratch designed for thumbs, small screens, and one-handed use in a shed. Same backend, same data, same logic — different shape.
This is the same architectural decision we made on the road freight operator project: share the brain, customize the surface for the people actually using it.
What we built
Core data — every cow's full life
Every cow gets a complete profile: tag ID, breed, type, sex, weight, birth date, parents, status (active / sold / deceased / gifted / transferred), origin (born here / purchased / donated). And critically: a full history. Every weight change, every status change, every event in this cow's life is logged with a timestamp. You can scroll back through any cow's history and see the whole story.
Search and filter the herd by any combination — show me all GIR cows over 5 years old that haven't been inseminated in the last 90 days. Show me all calves under 6 months that need their next vaccination. Show me all heifers ready for first AI.
The milking module — the most-used part of the system
- Two sessions a day (morning + evening)
- Per-cow milk production in litres
- Daily total automatically calculated
- "Who's been milked already today?" view so workers don't double-record
- Calendar view showing month-by-month, day-by-day production
- Per-cow trends (is her production going up or down?)
- Top producing cows leaderboard
- Average milk per breed
- Year-over-year comparison
OCR import for handwritten sheets
Even with mobile app in hand, sometimes a worker still grabs a paper. Maybe the phone died, maybe the network was bad, maybe it was just faster. We built an OCR importer — snap a photo of the handwritten milking sheet, the system reads the cow IDs and the litre counts, validates them, and imports them straight into the milking records. The owner reviews and approves before the data goes live.
Medical records
- Diagnosis + treatment per cow
- Drug names, dosages, dates
- Per-cow medical timeline
- Top "healthiest cows" (lowest treatment count)
- Statistics by breed (which breeds are needing the most vet care)
Breeding workflow — the most complex piece
This is the part the desktop app earns its keep on. The breeding lifecycle has many states and many automatic transitions:
- Worker logs an insemination attempt — picks the cow, picks the bull (sire), records the date, records the technique (AI / natural)
- The system creates a "pregnancy confirmation due" alert that fires X days later
- Worker (or vet) confirms — pregnant / not pregnant / pending
- If pregnant, the system auto-calculates the expected calving date and creates a series of follow-up alerts (uterus checks, calving shed prep)
- Calving day arrives — worker logs the calving event with the outcome (live calf / stillborn / complications)
- The new calf is automatically created as a record with parent links to mother and father
- The lineage now extends one generation deeper — and you can scroll back from any cow to see her full family tree
This is the workflow that paper notebooks completely failed at. The system doesn't.
Alerts system — the part that runs by itself
This is the closing-the-loop module. Every day the system runs through every cow and surfaces who needs attention:
| Alert | Trigger |
|---|---|
| Missing milking | Cow has no milking record from yesterday |
| Upcoming calving | Pregnant cow's expected calving date is in the next 7 days |
| Medical follow-up | Cow started a treatment that needs a recheck |
| Calf deworming | Calf is due for next deworming dose based on age |
| FMD vaccination | Cow is due for Foot and Mouth Disease vaccine based on schedule |
| Adult deworming | Adult cow is due for deworming |
| Uterus check | Post-calving check at the right interval |
| AI timing | Cow showing signs ready for insemination |
| Pregnancy confirmation | Confirmation check is due for an inseminated cow |
| Calving shed prep | A shed needs to be prepped for an upcoming birth |
Each alert links straight to the cow's profile so the worker can take action immediately.
Telegram integration — alerts that find you
Owners and workers add their Telegram chat ID to the system. When critical alerts fire, the system pushes them straight to Telegram. The owner doesn't have to open the app to know that a calving is happening tomorrow or that a calf needs deworming today. The notification finds them.
The AI chatbot
We built a chat assistant on top of the system that lets anyone — owner, worker, vet — ask questions in plain English and get real answers from the live database:
- "How many GIR cows do we have right now?"
- "Which cow gave the most milk last month?"
- "Show me cows that haven't been inseminated in 90 days"
- "What's our average milk per day for HF cows?"
- "Which calves need deworming this week?"
Behind the scenes, the chatbot understands the question, translates it into a database query, runs the query, and returns the answer in natural language. Sessions are persisted so you can ask follow-up questions ("how about Jersey cows?" — and it remembers you were just talking about milk averages).
The dashboard — the morning-coffee view
Open it and see:
- Total cattle count, broken down by sex, type, breed
- Today's milk production vs yesterday vs last week
- Current month milk trend chart
- Breed distribution pie chart
- Top 10 producing cows
- Top fertile bulls
- Medical record counts by breed
- Milking calendar (color-coded by daily output)
- Active alerts that need attention
- Year-over-year production comparison
10 different widgets, each refreshable, each pulling live data.
Reports
- Printable daily milking sheets (PDF) — for offline backup
- Monthly milk reports per cow, per breed, or for the whole herd
- Breeding history reports
- Medical history reports
- All exported as clean PDFs the owner can file or send
User management
- Super Admin: full access
- Data Entry: can add/edit records, can't manage users or settings
- Viewer: read-only
- Each user has their own profile, login, password, and audit trail
Fodder management
The shed needs feed every day. The system tracks fodder inventory and consumption — what's available, what's been used, what needs to be reordered.
And then we built the mobile app on top of the same backend
Once the desktop was live and the gap was clear, we built a second front-end designed for the shed:
- Bottom-tab navigation: Dashboard, Cattle, Milking, Medical, Alerts, Fodder, More
- Tap targets sized for thumbs
- Animated splash screen with a cow Lottie animation while the app loads
- Cards instead of tables — a phone screen can't show a 12-column table, but it can show a clean card for one cow at a time
- Offline-friendly behavior with token refresh and auto-retry
- Same login as the desktop — same JWT token, same user roles
- Same data, same alerts, same chatbot — just a different shape
A worker can stand next to a cow, open the app, log this morning's milking in 5 seconds, walk to the next cow, and the owner sees it on the desktop dashboard immediately.
The hard part — and how we solved it
There were three "hard parts" on this project, and they all came from the same root cause: this is a real business with real complexity, not a tech demo.
Hard part #1 — Modeling the breeding lifecycle
A cow's reproductive cycle has many states, automatic transitions, and time-based triggers. Insemination → confirmation → mid-pregnancy → late-pregnancy → calving prep → calving event → new calf creation → lineage update → next cycle. Each of those steps creates follow-up alerts at specific intervals. Skip a step and the next alert never fires.
We solved this by modeling the cycle as a state machine with explicit transitions and time-based hooks. When an insemination is logged, the system schedules the pregnancy confirmation alert for the right day automatically. When confirmation is positive, it schedules the calving date alert. When the calving event is logged, it auto-creates the calf record with parent links and starts the next set of alerts (post-calving uterus check, calf deworming schedule).
The owner doesn't have to remember any of it. The system remembers.
Hard part #2 — OCR for handwritten milking sheets
Workers don't always use the app. Sometimes they jot milking on paper. We didn't want to lose that data, so we built an OCR importer that reads handwritten cow IDs and litre counts off a photo of the sheet. The hard part wasn't the OCR — that's a service call. The hard part was validation and error handling: what if the OCR misreads a cow ID? What if a cow ID exists but doesn't match an actual cow in the database? What if the litre count is unreasonably high (e.g. 200 litres — clearly an OCR error)? What if the date is missing or wrong?
We built a review-and-approve flow: OCR runs, the system flags every entry that looks suspicious, the owner reviews them on screen, makes corrections, and only then does the data go live. This means OCR can be wrong sometimes and the data stays clean.
Hard part #3 — Two front-ends, one brain, no drift
Building two separate front-ends (desktop + mobile) is dangerous. The two can drift apart if you're not careful — the desktop adds a new feature, the mobile doesn't have it, the team has to remember to update both. This is how most "we have a web app and a mobile app" projects rot over time.
We avoided this by being strict about one rule: all logic lives in the backend. The front-ends only render and submit. New features get added to the backend once. Both front-ends pick them up immediately. Alerts get computed in the backend, not in the apps. The chatbot lives in the backend. The OCR lives in the backend. Reports get generated in the backend.
The desktop app and the mobile app are essentially two different "skins" over the same brain. Worker logs a milking on mobile → backend stores it → desktop dashboard updates → alerts recalculate → owner gets a Telegram push if anything urgent. All of it happens through the same one backend, so there's no chance of the two apps disagreeing.
The outcome
- Live in production at the gaushala in Coimbatore. 480+ cows being tracked daily.
- Two coordinated apps — desktop for the office, mobile for the shed — both running off the same backend with no drift.
- Replaced paper notebooks for milking, breeding, medical records, vaccinations, and reports.
- Automatic alerts for 10+ different cattle care events — calving, vaccinations, deworming, AI timing, follow-ups — that the owner doesn't have to remember or schedule.
- Telegram integration so the owner gets pushed the most critical alerts straight to his phone.
- AI chatbot that answers natural-language questions about the live data — "how many GIR cows do we have?" or "which calves need deworming this week?"
- OCR import for the days when somebody still jots milking on paper.
- Three user roles with proper access control.
- A real morning-coffee dashboard with 10+ widgets pulling live data.
- PDF reports the owner can print or email — daily milking sheets, monthly milk reports, breeding histories, medical histories.
- Full lineage tracking going back generations, automatic when a calf is born from a logged calving event.
The bigger outcome: a real working livestock business stopped running on memory and paper and started running on a system. The owner can step away for a week and the operation keeps going — alerts keep firing, workers keep logging, the dashboard keeps updating, and nothing falls through the cracks.
This is the kind of project most software agencies won't take on because "it's just a small farm." We took it on because we believed real Indian businesses deserve real software, not generic SaaS subscriptions designed for someone else.
Finish reading — and take the PDF.
Drop your details to unlock the rest of Cattle Management System (Coimbatore Gaushala) on this page and download the full write-up as a PDF.