# Juan Esteban Sánchez

> Software engineer and architect in Costa Rica, 20 years old, CTO at Meddyg. Works mostly on health interoperability (FHIR, SMART on FHIR, HL7) and the identity specs around it (OAuth2, OIDC), plus LLM agents inside real products. Open to offers and good problems.

Source: https://juanes.meddyg.com/ · Index: https://juanes.meddyg.com/llms.txt · Colophon: https://juanes.meddyg.com/colophon/ · Generated: 2026-12-05

## About

I joined Meddyg as a full stack engineer in 2023 and now I'm its CTO, working mostly with FHIR, OAuth2 and OIDC. Right now I'm writing HIX, an open spec for clinical document exchange, and the services that run it.

I'm a full stack engineer focused on software architecture and the specs most people skim, like OAuth2 and its seven thousand RFCs, OIDC, SMART on FHIR and HL7. So far I've applied them mostly in healthcare, building an authorization server and FHIR platform, LLM agents embedded in real products, and leading the migration of a legacy lab system to NestJS and React, one screen at a time. I'm not tied to the domain though, I just like the kind of problems that fight back.

I wrote Nodecord, the first two versions of Fidechat and the bulk of NGDose by hand. Since mid-2026 I've used Claude Code heavily at work. I design the architecture and the type contracts between parts, the agent drafts the implementation, and I review every diff against integration tests before it merges. That's how HIX's research and Radiation Group's redesign got done without a large team. The decisions in these stories are mine.

I'm 20, and outside work I'm finishing a Software Engineering degree at Fidélitas, learning Rust, and collecting side projects slightly faster than I finish them. I've been coding since 2019 and running Linux for nearly half my life, so the logo isn't decoration.

- Coding since: 2019 (7 years)
- At Meddyg since: 2023 (now its CTO)
- Studying: Software Engineering at Fidélitas

## Contact

Remote roles or consulting, either works. Send me the system nobody wants to touch, the spec nobody read, or the AI feature nobody trusts yet.

- Email: juan@meddyg.com
- GitHub: https://github.com/Datzu712
- LinkedIn: https://www.linkedin.com/in/juanescr/
- Location: Costa Rica (UTC−6)

## Projects

Most of this work lives in private repositories. It is described at a level that is safe to publish: no client institutions, volumes, hosts or internal names. Periods run from first to last commit; "present" means still being worked on.

### NGDose

Moving a radiation-dosimetry platform off a 13-year-old CakePHP app without ever switching it off.

- Status: Production
- Type: work
- Period: dec 2022 → present
- Stack: TypeScript, NestJS, Fastify, Prisma, MariaDB, Redis, Puppeteer, React 19, Vercel AI SDK, Anthropic API, Docker
- Legacy stack (being replaced): PHP, CakePHP, MariaDB, TCPDF, Docker, Nginx
- Highlights: ~95% of daily work migrated; uploads 30 min → 1 min; list 2.9 s → 0.3 s
- Source: private repository, not linked

**Problem.** A CakePHP app from 2013 ran the dosimetry lab's daily work: dosimeters, readings, packing lists, dose reports. It could not stop for a big-bang rewrite.

**Decision.** Strangle it instead of replacing it. I dockerized the legacy app, embedded new screens inside it, and pointed the new NestJS API and React app at the same database.

**Outcome.** About 95% of the daily work now happens in the new app: dosimeters, participants, reading uploads, dose validation and an audit log of who changed what. The old one is only opened for a few administrative processes. Uploading a batch of dose readings went from about 30 minutes to one, and the dosimeter list from 2.9 seconds to 300 milliseconds. An AI assistant answers admins' questions through typed tools instead of free-form SQL.

![before: the dosimeter list in CakePHP (demo data)](https://juanes.meddyg.com/screenshots/ngdose/before-dosimeter-list-legacy.webp)
![during: a new screen inside the old app, in an iframe (demo data)](https://juanes.meddyg.com/screenshots/ngdose/strangler-new-screen-in-legacy.webp)
![after: the same list in the new app (demo data)](https://juanes.meddyg.com/screenshots/ngdose/after-dosimeter-list.webp)
![after: a batch of readings, checked by the server (demo data)](https://juanes.meddyg.com/screenshots/ngdose/after-instadose-batch-upload.webp)
![after: the AI assistant](https://juanes.meddyg.com/screenshots/ngdose/ai-preview.webp)

### Radiation Group

A certificate portal for a radiation-safety firm's hospital clients, with an AI assistant.

- Status: Production
- Type: work
- Period: mar 2026 → present
- Stack: TypeScript, NestJS, Fastify, Prisma, PostgreSQL, Keycloak, React 19, TanStack Query, Anthropic SDK, Testcontainers
- Highlights: in production since apr 2026; assistant in use by admins since nov 2026
- Source: private repository, not linked

**Problem.** The firm keeps equipment certificates for a long list of clients, and every client needs a way to see its own and nobody else's. Admins upload them as PDFs by hand, so a wrong date, client or machine can slip through.

**Decision.** Role-scoped access through Keycloak for admins, clients and suppliers. The assistant reads each PDF twice: deterministic rules pull the critical fields, a model on the Anthropic API reads the rest, and the rules win any disagreement. It can never write. It proposes a change, the server fingerprints the exact call and holds it for fifteen minutes, and it runs once, with the admin's own permissions, only after they click confirm.

**Outcome.** In production since April 2026. Each client signs in and sees only its own certificates, organized by facility, area and machine, and gets an email 60 days before one expires. Admins have been using the assistant since November 2026.

![a proposed change, held until an admin confirms (demo data)](https://juanes.meddyg.com/screenshots/rad-gp/assistant-proposal.webp)
![a question answered with a table and a citation (demo data)](https://juanes.meddyg.com/screenshots/rad-gp/assistant-query-table.webp)
![clients by site, area and machine, and who has access (demo data)](https://juanes.meddyg.com/screenshots/rad-gp/clients-tree.webp)
![one client's certificates, by expiry (demo data)](https://juanes.meddyg.com/screenshots/rad-gp/certificates-client.webp)

### HIX

A FHIR R5 specification for a clinical document exchange in Costa Rica.

- Status: Public draft, open source
- Type: work
- Period: sep 2026 → present
- Stack: FHIR R5, SUSHI, HL7 IG Publisher, IHE MHD / PIXm / PDQm, GitHub Actions, Cloudflare Pages
- Highlights: vol. 1 published sep 2026; draft for review
- Spec: https://hix.meddyg.com/fhir/hix/
- GitHub: https://github.com/meddyg/HIX

*Turns out writing a spec is harder than complaining about one.*

**Problem.** Hospitals, labs and patients need to find and fetch each other's clinical documents without every member integrating with every other one. In a peer mesh, the whole network is only as safe as its weakest member.

**Decision.** A central mediator handles every lookup and every retrieval, while documents stay with the member that created them. I took IHE MHDS as the reference without claiming conformance, since it is FHIR R4 from 2023, and wrote down a cited reason for every place HIX departs from it.

**Outcome.** Volume 1, the architecture, published as v0.1.0 in September 2026 as a draft for review. Volume 2 is going up in parts: the authorization model and two HIX-specific transactions, a mediated token exchange and a patient-app launch, went live in October 2026. Identity, publication and retrieval are in draft, and the consent model comes next.

Video: [how the exchange works · 2 min, no sound](https://juanes.meddyg.com/videos/hix-architecture.mp4)

![the mediated token: one audience per destination](https://juanes.meddyg.com/screenshots/hix/hix-delegation.webp)
![the [HIX-1] token exchange, step by step](https://juanes.meddyg.com/screenshots/hix/hix-token-exchange.webp)

### HIX HIE

The services that run HIX: they check who's asking, find where a patient's records live, and fetch them.

- Status: First release
- Type: work
- Period: jun 2026 → present
- Stack: TypeScript, NestJS, Fastify, oidc-provider, jose, PostgreSQL, Kysely, HAPI FHIR, OpenTelemetry, Turborepo
- Highlights: 0.0.1 released sep 2026; login server for a jun 2026 connectathon
- The connectathon: https://lnkd.in/p/e2e_5WDd

**Problem.** A spec doesn't move documents. Hospitals and labs needed to fetch each other's records without standing access to each other's systems.

**Decision.** Every request goes through a service in the middle that never passes the caller's credentials along: it swaps them for a pass that opens one institution's records and expires within two minutes. Each institution knows a patient by a different ID (MRN), so I built the index that links them (MPI).

**Outcome.** First release, 0.0.1, in September 2026. Since then, a request can be traced end to end, and I've started building the patient index. It grew out of Kivu Conquest, the login server every participant used at a June 2026 connectathon.

### Nodecord

A TypeScript framework that brings NestJS-style modules and dependency injection to Discord bots.

- Status: Released, open source
- Type: side project
- Period: jul 2022 → jul 2026
- Stack: TypeScript, Inversify, discord.js, Vitest, Turborepo, Changesets
- Highlights: v0.2.1 on npm; jul 2026
- GitHub: https://github.com/Datzu712/nodecord
- Docs: https://nodecord.pages.dev
- Npm: https://www.npmjs.com/package/@nodecord/core

*Does a Discord bot need enterprise-grade dependency injection? Probably not. I built it anyway.*

**Problem.** Discord libraries hand you a client and leave the rest to you. Once commands share services or handlers need tests, you end up with one giant file of client.on(...) calls and global state.

**Decision.** Real dependency injection over an Inversify container hierarchy, decorator-driven slash commands, interceptors and exception handlers, split into a Discord-free core and a discord.js adapter, plus a testing adapter that simulates interactions without Discord.

**Outcome.** Started in 2022 and rewritten in 2026; v0.2.1 of both packages published to npm in July 2026.

### Mind & Body

A gym's mobile app and admin dashboard, with an AI coach that answers from each member's own routines.

- Status: Paused, open source
- Type: side project
- Period: mar 2026 → aug 2026
- Stack: TypeScript, React Native, Expo Router, NestJS, Vercel AI SDK, PostgreSQL, Drizzle ORM, Keycloak, TanStack Query, pnpm Workspaces
- Highlights: the AI coach answers through tool calls; forge drafts a routine from 1 sentence
- GitHub: https://github.com/Datzu712/mind-body

**Problem.** The coach was a generic chatbot. It couldn't see a member's routines, measurements or bookings, so "should I change today's workout?" got an answer that could have been for anyone. Trainers built routines by hand, one exercise at a time.

**Decision.** Give the coach tools instead of a longer prompt: five per-member tools (routines, body progress, recent activity, bookings and upcoming classes) plus a search over the exercise catalog, each scoped to the caller's Keycloak token. The reply streams to the React Native app over SSE. For trainers I built Forge, an agent in the dashboard that drafts and edits a routine straight from the catalog, with its own tests for its tools and its prompt.

**Outcome.** Built between July 31 and August 5, 2026. The coach now answers through those five member tools: asked about a sore shoulder, it names the member's own routines and says which one to skip today. Forge drafts a routine from one sentence: six exercises with sets, reps and notes, picked from a catalog of 1,324. Around them the app has class booking with waitlists and four roles. It isn't deployed yet.

Video: [a reply streaming in · 9 s, no sound](https://juanes.meddyg.com/videos/mab-coach-streaming.mp4)

![forge drafting a routine from one sentence (demo data)](https://juanes.meddyg.com/screenshots/mab/forge-routine-builder.webp)
![home, with the coach one tap away](https://juanes.meddyg.com/screenshots/mab/home-coach-fab.webp)
![several active routines, one in focus](https://juanes.meddyg.com/screenshots/mab/routines-focused.webp)
![class booking](https://juanes.meddyg.com/screenshots/mab/class-reservations.webp)

### Fidechat

The same Discord-style chat app, built three times as I learned: Spring, then NestJS on Oracle, now NestJS on Postgres.

- Status: Work in progress, open source
- Type: side project
- Period: nov 2024 → present
- Stack: TypeScript, NestJS, Fastify, PostgreSQL, Drizzle, Socket.IO, Keycloak, React 19, Vite, Tailwind v4, Vercel AI SDK, Transformers.js, Turborepo, Docker
- Legacy stack (being replaced): Java, Spring Boot, Oracle PL/SQL, Next.js, NextAuth
- GitHub: https://github.com/Datzu712/fidechat
- Live demo: https://fidechat.pages.dev

*The live demo has no server: the first tab you open runs it.*

**Problem.** I built it twice at university, each time inside a single four-month term: first on Spring Boot, then on NestJS with the logic buried in Oracle PL/SQL packages and triggers. Both shipped against a deadline, rushed and full of holes I knew about.

**Decision.** Rebuild it without a deadline instead of starting clean. I merged the two repos into one monorepo without losing a commit, moved every rule out of the database into TypeScript on Postgres, and made the API own the login: it runs the PKCE flow and keeps the tokens server-side, so the browser only ever holds an HttpOnly cookie. The AI bots stopped answering every message: an LLM router reads the channel and decides who, if anyone, should speak. Then I made the server optional: every call goes through one interface, so the web app can talk to the real API or to a copy of its rules running in a worker, with the data in IndexedDB.

**Outcome.** The third version is the one I'd defend in a review, and anyone can try it: the live demo runs with no server at all, each tab a different user. The bots are optional there, on a model you choose to download into the browser. The first two are kept as they were, tagged and runnable, as a record of how I got here rather than as examples to follow.

![v3, 2026: the live demo, with the server in a tab](https://juanes.meddyg.com/screenshots/fidechat/v3-demo.webp)
![v1, 2024: Spring Boot](https://juanes.meddyg.com/screenshots/fidechat/v1-chat.webp)
![v2, 2025: NestJS on Oracle, with AI bots](https://juanes.meddyg.com/screenshots/fidechat/v2-bots.webp)
