How ahmedinternist/rx-v2 works
Rx-v2 is a shareable prescription viewer. An API client submits prescription JSON; the API authorizes the request, stores it in Redis with a 60-day expiry, and returns a viewer link. The viewer retrieves the record by ID, formats prescription and medication details, and renders the result with localized text and interactive medication rows. The README gives little product detail, so the graph follows the sampled runtime code; the normalizer is included as a separate helper because its use is not shown.
Main entry points: [id]/page.tsx Prescription page · route.ts Prescription API · app/page.tsx Share instructions · rx-presentation.ts Medication formatting
Components 13
Prescription sharing
- Prescription API
app/api/rx/route.ts - Upstash Redis
- Share instructions
app/page.tsx
Prescription viewer
- Prescription page
app/p/[id]/page.tsx - Record normalizer
app/lib/rx-normalizer.ts
Display and recovery
- Medication formatting
app/lib/rx-presentation.ts - Medication row
app/p/[id]/medication-item.tsx - Script annotation
app/p/[id]/localized-text.tsx - Load error state
app/p/[id]/error.tsx - Unavailable state
app/p/[id]/not-found.tsx - Application layout
app/layout.tsx
Other components
- API client
- Viewer user
Connections 11
- API client → Prescription API: submits JSON
- Prescription API → Upstash Redis: stores and checks
app/api/rx/route.ts - Prescription API → API client: returns viewer link
app/api/rx/route.ts - Viewer user → Prescription page: opens link
app/p/[id]/page.tsx - Prescription page → Upstash Redis: loads record
app/p/[id]/page.tsx - Prescription page → Medication formatting: formats details
app/p/[id]/page.tsx - Prescription page → Medication row: renders rows
app/p/[id]/page.tsx - Prescription page → Script annotation: renders annotated text
app/p/[id]/page.tsx - Prescription page → Load error state: shows load failure
- Prescription page → Unavailable state: shows missing record
app/p/[id]/page.tsx - Share instructions → API client: describes submission
app/page.tsx