How lin0et/dev-projects works
1. This is a pnpm/Nx monorepo with three main runtime surfaces: the API backend, several frontend apps, and a shared client-libraries package. The rest of the repo is supporting infrastructure: tests, scripts, config, and CI.
2. The backend lives in api/ and is the central orchestration layer. It is a Node.js service built on Fastify, with MongoDB as the primary database. api/src/index.js boots loaders that wire up Fastify, Mongo, rate limiting, and Inngest.
3. Request handling on the API follows a clear layering: routers expose endpoints, controllers handle HTTP-level coordination, services contain business logic, repositories encapsulate database access, models define Mongo data shapes, and schemas/validators guard request and response contracts. This is the core boundary to diagram for the backend.
4. The backend also owns background and event-driven workflows through api/src/functions/ and the Inngest loader. These jobs cover recurring automation such as SMS drips, rebill handling, order follow-up, shipping updates, and sync tasks, so not all domain work happens through synchronous HTTP requests.
5. External integrations are a major architectural concern in the API. Dedicated adapters under api/src/lib/ and corresponding services wrap third parties such as Konnektive, GogoMeds, MD Integrations, Twilio, Zendesk, AfterShip, Braze, SendGrid, Slack, AWS S3, SmartyStreets, Google Maps/Auth, Facebook, and Genderize. These integrations are isolated behind service boundaries rather than called directly from controllers.
6. Authentication, authorization, and anti-abuse are enforced in middleware and loaders. The API has auth middleware, dashboard whitelisting, SSL/rate-limiting support, and webhook-specific authentication for external callbacks. Error handling is centralized in Fastify middleware, with structured logging and Sentry/Rollbar-style error reporting noted in the README.
7. MongoDB is more than a persistence layer: there are schema/index definitions, migrations, and operational scripts. The repo includes historical migrations, a migration runner config, and helper scripts for seeding, housekeeping, reporting, and data repair, which implies ongoing schema evolution and operational maintenance.
8. The frontend is split by audience and deployment. frontend/employee is the internal/admin/customer-service dashboard, while frontend/patient and the brand-specific patient apps (patient-scoreblue, patient-allamericanpharma, patient-duckymd, patient-scorerx) serve customer onboarding and account experiences. These are separate build targets rather than a single SPA.
9. The patient experience is workflow-driven. The README explicitly calls out PatientRouter-style logic that routes users based on onboarding progress, and the patient app contains distinct pages for survey, checkout, treatment selection, identity verification, billing, shipping, subscriptions, order history, and Zendesk redirection. That workflow is the key client-side state machine.
10. frontend/client-libs is the shared UI/domain package used across the frontends. It provides API client wrappers, shared constants, context providers, forms, models, reusable UI components, routing/auth helpers, and a standalone logger implementation. This is the main reuse boundary between the patient and employee apps.
11. The employee app is optimized for operational tasks and back-office tooling. Its pages focus on user lookup, employee management, order management, user detail views, CS notes, SMS blasts, queue reports, and agent checkout/demographic/survey flows. It consumes the same API and shared client-libs but presents a different operational surface.
12. End-to-end verification is a separate subsystem under e2e-tests/, built with Playwright. It includes environment setup, reusable page objects, fixtures, and flows for guest, customer, and agent scenarios, plus webhook and test-data utilities. This acts as the integration boundary across frontend, API, and external mocks.
13. There is also a small scripts/ workspace for build-time utilities, such as injecting client versions and generating lockfile metadata. These are supporting tools rather than runtime services, but they matter for deployment and release consistency.
14. Local development and deployment are shaped by repo-level infrastructure: Docker Compose, Nginx config templates, a Procfile, GitHub Actions workflows for each app, and shared lint/prettier/tooling packages. This suggests a multi-app release pipeline with shared standards and independently built artifacts.
Main entry points: patient.yml CI workflows · auth.js HTTP layer · index.js Bootstrap · playwright.config.js Playwright suite
Components 20
API
Node.js backend, domain services, persistence, and async workflows.
- Bootstrap · Boot sequence that wires Fastify, MongoDB, rate limiting, and Inngest.
api/src/index.js - HTTP layer · Fastify request boundary: routers, controllers, middleware, schemas, and validators.
api/src/routers/auth.js - Business logic · Domain services and repositories that coordinate core API behavior.
api/src/services/order.js - Mongo layer · Mongo models, indexes, migrations, and operational data-shaping scripts.
api/src/models/user.model.js - Integrations · Third-party adapters and wrappers for messaging, pharmacy, auth, shipping, CRM, and support systems.
api/src/lib/Konnektive.js - Jobs · Background and event-driven workflows for drips, rebills, syncs, fulfillment, and follow-up.
api/src/functions/index.js - Security · Authentication, dashboard whitelisting, SSL, and rate limiting.
api/src/middleware/auth.js - Logging · Structured logging and error reporting pipeline, including Sentry-backed providers.
api/src/utils/logger/index.js
Frontends
Employee and patient applications plus shared client libraries.
- Employee app · Internal operational UI for customer service, orders, users, and tools.
frontend/employee/src/App/App.jsx - Patient app · Patient-facing onboarding and account experience with routing driven by onboarding state.
frontend/patient/src/App/App.jsx - Brand apps · Brand-specific patient deployment targets for distinct customers and builds.
frontend/patient-scoreblue/src/index.tsx - Client libs · Shared API clients, constants, contexts, forms, models, UI components, and helpers used by both frontends.
frontend/client-libs/src/api/auth/auth.js - Patient flow · Patient workflow pages for survey, checkout, verification, billing, shipping, subscriptions, and support redirects.
frontend/patient/src/routes/PatientRoute.jsx - Ops pages · Operational pages for user lookup, employee management, queue reports, SMS blasts, and agent checkout flows.
frontend/employee/src/pages/AdminUserDetailPage/index.jsx
E2E
Playwright integration and workflow verification.
- Playwright suite · Cross-app end-to-end verification for guest, customer, and agent journeys.
e2e-tests/playwright.config.js - Journey flows · Reusable guest, customer, and webhook flows plus page objects and fixtures.
e2e-tests/tests/flows/guest-checkout.js
Infra
Repo-level config, deployment, and CI support.
- CI workflows · Independent build/test workflows for the API, client libs, patient apps, employee app, and e2e runs.
.github/workflows/patient.yml - Tooling · Monorepo-wide lint, prettier, TypeScript, Nx, and release/development helpers.
modules/tooling/src/eslint/configs/base.js - Deploy setup · Local and production-supporting configuration such as Docker Compose, Nginx templates, Procfile, and workspace settings.
compose-local-dev.yaml - Scripts · Small workspace for build-time utilities like client version injection and lockfile metadata generation.
scripts/src/apps/inject-client-version/inject-client-version.ts
Connections 31
- Bootstrap → HTTP layer: bootstraps · Entry point loads the request stack and shared loaders.
- Bootstrap → Mongo layer: connects · Startup initializes persistence and schema-related wiring.
- Bootstrap → Jobs: registers · Boot sequence wires Inngest handlers and background jobs.
- HTTP layer → Security: protected by · Request handlers are guarded by auth, whitelisting, SSL, and rate limiting.
- HTTP layer → Business logic: delegates to · Controllers and routers pass domain work into services and repositories.
- Business logic → Mongo layer: reads/writes · Business logic persists through Mongo models and repositories.
- Business logic → Integrations: calls · Domain services isolate third-party interactions behind adapters.
- Jobs → Business logic: reuses · Background jobs share the same business logic boundary as HTTP flows.
- Jobs → Integrations: syncs with · Jobs drive messaging, fulfillment, CRM, and pharmacy integrations.
- Logging → HTTP layer: captures · Centralized logging and error reporting wraps the Fastify surface.
- Patient app → Patient flow: orchestrates · Patient app is structured around onboarding-state routing and stepwise pages.
- Patient flow → Client libs: uses · Patient workflow pages rely on shared forms, models, and helpers.
- Employee app → Ops pages: hosts · Employee app exposes the back-office operational page set.
- Employee app → Client libs: uses · Operational screens share API clients, contexts, and UI primitives.
- Brand apps → Patient app: variant of · Brand-specific patient shells follow the same patient experience architecture.
- Client libs → HTTP layer: calls · Shared API wrappers encode the backend contract for frontends.
- Playwright suite → Patient app: verifies · Playwright covers guest and customer journeys through the patient app.
- Playwright suite → Employee app: verifies · Playwright covers agent and admin scenarios through the employee app.
- Playwright suite → HTTP layer: hits · End-to-end tests exercise backend endpoints and webhooks.
- Journey flows → Playwright suite: implements · Flows, fixtures, and page objects provide reusable test orchestration.
- CI workflows → Bootstrap: builds/tests · CI runs backend build and verification jobs.
- CI workflows → Employee app: builds/tests · CI runs employee app pipelines.
- CI workflows → Patient app: builds/tests · CI runs patient app pipelines.
- CI workflows → Brand apps: builds/tests · CI runs brand-specific patient app pipelines.
- CI workflows → Playwright suite: runs · Dedicated workflows execute Playwright integration suites.
- Tooling → Bootstrap: standardizes · Shared tooling constrains backend linting, formatting, and TypeScript settings.
- Tooling → Client libs: standardizes · Shared tooling constrains the client-libs package.
- Tooling → Employee app: standardizes · Shared tooling constrains the employee app.
- Tooling → Patient app: standardizes · Shared tooling constrains the patient app.
- Deploy setup → CI workflows: supports · Repo-level runtime and deployment config underpins CI and local execution.
- Scripts → Client libs: supports release · Build-time utilities help inject versions and maintain lockfile metadata.