Medyzen Backend — 7-Day Course
Version: 1.0 | Status: Written against medyzen-backend code on 2026-09-16 | Owner: Engineering
A day-by-day walk through the whole medyzen-backend codebase. Each day explains what the code does, why it is built that way, where it lives, and the traps that have bitten this team before. Read architecture.md first — it is the map; this course is the territory.
The code is the source of truth. Every file path in these lessons was opened when the lesson was written. If a path no longer exists, the code moved — search for the symbol name, then fix the lesson.
Size of what we cover
About 120k lines of non-test Go. Largest areas, so the time split makes sense:
| Area | Lines | Day |
|---|---|---|
internal/hiring | 16.9k | 6 |
internal/hr | 12.3k | 6 |
internal/testlab | 11.3k | 7 |
internal/human | 11.2k | 2 (auth) + 6 (people) |
internal/order | 11.1k | 3 |
internal/inventory | 8.4k | 4 |
internal/assets | 6.6k | 5 |
internal/finance | 5.9k | 5 |
internal/prescription | 5.7k | 4 |
internal/procurement | 5.2k | 5 |
internal/careers | 4.8k | 6 |
internal/pkg | 4.7k | 1–3 |
| everything else | ~15k | spread |
Migrations: 639 files in internal/database/migrations.
Schedule
| Day | Theme | Covers | Lesson |
|---|---|---|---|
| 1 | Foundations | Repo tour, boot sequence in cmd/server/main.go, config, database + migrations, the module pattern, errors/response, running locally | day-1-foundations.md |
| 2 | Request path & security | Middleware chain, OTP login, JWT + refresh + blacklist, roles/permissions/RBAC, rate limits, audit, PII encryption | day-2-request-path-and-auth.md |
| 3 | Patient commerce | Cart, order lifecycle, Razorpay payments + reconciler, realtime events, notifications (SMS, email, push) | day-3-cart-orders-payments.md |
| 4 | Prescriptions & stock | Prescription upload, Gemini extraction, review, sweepers; inventory; hospital catalog; dashboard | day-4-prescriptions-inventory.md |
| 5 | Supply & money | Procurement, assets (hospitals, warehouses, service areas), finance (revenue share, payouts), leads | day-5-procurement-assets-finance.md |
| 6 | People | Employees and roles in human, HR, delivery KYC, careers, hiring ATS + Google Calendar | day-6-people-hr-hiring.md |
| 7 | Shipping it | Terraform on AWS, CI/CD, migration safety, testlab + preflight, observability, testing patterns, capstone: add an endpoint end to end | day-7-operations-and-capstone.md |
Issues found in the code while writing these lessons: findings.md.
How each lesson is laid out
- Goals — what you can do by end of day
- Reading order — files to open, in order, with what to look for
- Explanation — how the code works, with Mermaid diagrams for flows
- Traps — real bugs and gotchas from this codebase
- Exercises — hands-on tasks against a local stack (never prod)
- Self-check — questions with answers at the bottom
Suggested daily rhythm (about 3 hours)
| Block | Time |
|---|---|
| Read the lesson's explanation | 45 min |
| Follow the reading order in the code | 75 min |
| Exercises | 45 min |
| Self-check, write down open questions | 15 min |
Ground rules for exercises
- Run against a local Postgres/Redis (
docker-compose.yml), never the production database. - Local runs read
.envthroughconfig.Load()— blank every real secret first. - Pushing to
maindeploys production. Exercises stay on a local branch.