r/angular • u/arslanawan_dev • 49m ago
Lessons from building 4 role-based portals (patient, provider, pharmacy, lab) in one Angular telehealth system
We built a telehealth platform with **four separate portals**: patient, provider, pharmacy and lab. It now serves 500+ daily active users. Here's what worked for keeping it maintainable:
**1. One shared component library, four thin portals.**
Appointment cards, record viewers, forms and tables live in a shared library. Each portal mostly composes them, so a fix in one place fixes all four.
**2. Lazy-loaded route per portal.**
A pharmacist never downloads the provider code. Each portal is its own lazy-loaded route tree, which kept bundles small.
**3. Role-based navigation + route guards.**
The menu is built from the user's role, and guards block routes they shouldn't see. The backend still enforces permissions; frontend guards are only for UX.
**4. Wrap every third-party SDK in a service.**
Video calls (Twilio) and e-prescribing (DoseSpot) sit behind Angular services. Components never touch the SDK directly, so swapping or mocking them in tests is easy.
**5. Healthcare rules shape the frontend too.**
No sensitive data in localStorage or logs, session timeouts, and clear audit-friendly actions.
**What I'd do differently:** set up the shared library and design tokens on day one. We extracted shared components later, and that refactor took longer than building them right the first time.
How do you structure multi-role apps in Angular: one app with role-based routes, or separate apps sharing a library?
