A modest, privacy-aware medical messenger that allows patients to discover and subscribe to doctors (by role/specialty) and view a basic doctor directory. This MVP implements the frontend UI, a typed backend API serving mock data, strict repo quality gates, and CI scaffolding—providing a disciplined runway for the next 70% (auth, subscriptions persistence, real-time chat, privacy workflows, and Azure deployment).
Status:
v0.1.0-mvp30— UI ↔ API integrated with mock data, no real database writes yet.
- Goals
- Feature Scope
- Architecture Overview
- Directory Layout
- Tech Stack
- Getting Started
- Environment Variables
- Develop & Run
- Testing & Quality
- CI/CD Overview
- Observability
- Infrastructure (Preview)
- Security & Privacy
- Roadmap
- Contributing
- Deliver a clean MVP foundation with strict quality gates and consistent monorepo practices.
- Keep the app simple while preserving essential doctor discovery and typed API contracts.
- Prepare a seamless path to Azure App Service deployment with Key Vault and Application Insights (not enabled in MVP).
- Doctor Directory UI (search box + specialty filter, client-side filtering).
- Backend API (Fastify) serving mock doctors from
/database. - Strict types & schemas (zod) shared across packages.
- Repo discipline: ESLint, Prettier, TypeScript strict, vitest, Husky, Commitlint.
- CI scaffolding: build/test/lint/typecheck; infra syntax check (Bicep build).
- Authentication & authorization.
- Subscription request/approval persistence.
- Real-time 1:1 chat (Socket.IO).
- Production database (MongoDB Atlas).
- Azure App Service deployment, Key Vault, Application Insights.
In MVP, data is served from mock JSON; the types/schemas are shared between frontend and backend to guarantee contracts.
.
├── frontend/ # Next.js (TypeScript, App Router), Tailwind, shadcn/ui
├── backend/ # Fastify (TypeScript), REST APIs, zod validation, pino
├── database/ # Shared zod types + mocks (doctors/users), seeds later
├── infra/ # Bicep skeletons (App Service, Insights modules - preview)
├── docs/ # ADRs, env policy, PR checklist, smoke tests, roadmap
├── .github/ # CI workflows, templates
├── pnpm-workspace.yaml
├── package.json # Workspace scripts & tooling
└── README.md # This file
- Frontend: Next.js (App Router), React, TypeScript, TailwindCSS, shadcn/ui, Testing Library + Vitest
- Backend: Fastify (TypeScript), zod (schemas), pino (logging), vitest
- Tooling: PNPM workspaces, ESLint, Prettier, Husky, Commitlint (Conventional Commits)
- Infra (preview): Bicep skeletons; Azure App Service & App Insights planned
- CI: GitHub Actions (build, lint, test, typecheck, infra syntax)
- Node.js 20.x (
.nvmrcincluded) - PNPM ≥ 8 (
corepack enablerecommended) - Git + a terminal (macOS/Linux/WSL or Windows)
# at project root
pnpm install
pnpm prepare # sets up Husky hooksIf PNPM is missing:
corepack enable && corepack prepare pnpm@latest --activate
Create .env files from the provided samples.
/frontend/.env.local
NEXT_PUBLIC_API_BASE_URL=https://medmsg-blue.azurewebsites.net
/backend/.env
PORT=4000
LOG_LEVEL=info
# MONGODB_URI= # (not required in MVP; planned for next phase)
MVP uses mock JSON instead of a real database. Env validation (zod) will fail fast if required vars are missing.
In two terminals:
# Terminal 1: backend
cd backend
pnpm dev
# Fastify on https://medmsg-blue.azurewebsites.net
# Try: curl https://medmsg-blue.azurewebsites.net/health# Terminal 2: frontend
cd frontend
pnpm dev
# Next.js on https://medmsg-frontend-static.azurewebsites.net
# Visit /doctors to see directoryRun at project root:
pnpm lint
pnpm format
pnpm typecheck
pnpm -r test- Husky enforces lint-staged on commit and Commitlint on commit messages.
- Vitest runs per package; shared zod types ensure DTO parity.
GitHub Actions (at minimum):
- Build & Test:
frontendandbackend(cache PNPM). - Typecheck: strict TS across workspaces.
- Infra syntax:
az bicep build(syntax only). - Smoke: run backend build artifact and
curl /health(expected200).
Branch protection (recommended): require CI green + code review + Conventional Commit.
MVP includes:
- pino structured logging in backend.
- Placeholder web vitals capture in frontend (console).
Planned:
- Azure Application Insights (server + browser) with dashboards & alerts.
Bicep skeletons live in /infra:
main.bicep+modules/(App Service, Insights—placeholders).- CI job performs syntax check only (no deploy in MVP).
Deployment, Key Vault references, and App Service WebSockets settings are part of the next increment.
- Passwords (future auth) must be hashed (e.g., bcrypt/Argon2), never stored in plaintext.
- Transport via HTTPS/TLS.
- Secrets belong in environment variables and (in cloud) Key Vault—never in the repo.
- Treat all future chat content as health information; implement clear consent and access control when enabling subscriptions and messaging.
- Auth (email/password or external IdP), role-based routes.
- Subscriptions: request/approve/deny, persisted in DB.
- Real-time chat: Socket.IO with delivery/read states.
- MongoDB Atlas integration, seed scripts, indices.
- Azure: App Service (Linux), Key Vault references, Application Insights, deployment slots (staging→prod).
- Privacy UX: consent flows, retention policy, audit log.
- Conventional Commits (e.g.,
feat:,fix:,chore:). - Keep PRs small and focused; update
/docswith any behavior or API change. - Run
pnpm lint && pnpm -r test && pnpm typecheckbefore pushing.
See: /docs/CONTRIBUTING.md, /docs/PR-checklist.md, /docs/definition-of-done.md.
MIT License.