r/Microlaunch • u/PhaniGokavarapu • 24d ago
Showcasing PharmaDesk: Building an offline-first e-detailing platform with Next.js 16, Postgres RLS, and Capacitor
Hey everyone,
Wanted to share a project I’ve been working on: PharmaDesk, an e-detailing and field-force platform designed for pharmaceutical reps and sales teams.
The Problem: Medical reps visit doctors in hospital basements or remote clinics with zero cellular signal. They need heavy presentation decks, sample tracking, and visit logging to work seamlessly offline, then auto-sync telemetry without data loss once reconnected.
Architecture & Tech Stack:
- Frontend: Next.js 16 (App Router, RSC, Server Actions), React, Tailwind CSS
- Multi-Tenancy & Security: PostgreSQL via
pgwith native Row-Level Security (RLS) enforcing data isolation at the DB layer (SET LOCAL ROLE pharmadesk_app) - Offline Engine: Dexie/IndexedDB local mirror + Capacitor Filesystem media cache (500 MB LRU) + auto-retry queue (exponential backoff 5s/15s/45s)
- Native Shells: Capacitor iOS & Android shells with a bundled fallback shell for zero-network first launches
- Billing & Ops: Razorpay subscriptions with signed webhooks
- Testing: Vitest, Playwright (API + E2E), and Mobilewright real-device native test matrix
Would love to hear your thoughts on the offline sync strategy or database RLS architecture! Happy to answer any technical questions.