Rhythm Healthcare, 2024 to 2025
Faster pipelines and the tooling around them
Turborepo, an AWS build cache written in Terraform and leaner images took the API pipeline from about 18 minutes to under 6.
~70%
faster API pipeline, about 18 minutes to under 6
- CommitAPI or portal
- Turborepoonly what changed
- Remote cacheAWS, in Terraform
- Parallel jobslint, test, build
- Docker image660 MB to ~120 MB
The problem
Every API change waited about 18 minutes in CI, local builds took 5 minutes, and Docker images weighed 660 MB. The whole team paid for it on every change.
Stack
Turborepo, Terraform, AWS, Docker, pnpm, Vitest, SWC, Rust
What I built
- 1Integrated the SWC compiler into the NestJS API: local builds went from 5 minutes to 2 to 3, with much faster cold and hot starts.
- 2Set up Turborepo for the API and the clinical portal, and built its AWS infrastructure from scratch in Terraform: S3, ECR, CodeBuild and IAM.
- 3Parallelized linting, tests and image builds. API pipeline runs dropped from about 18 minutes to under 6, and the portal’s build and lint went from minutes to seconds.
- 4Switched to multi-stage Docker builds, taking images from 660 MB to about 120 MB, and moved most repositories from Yarn to pnpm.
- 5Rebuilt CI/CD after the move from Bitbucket to GitHub, and moved the API tests from Jest to Vitest with cleaner mocks that made them faster and less flaky.
- 6Wrote two internal tools in Rust: clinic-scoped backup and restore that runs through CI/CD, and a daemon that keeps AWS SSM database sessions open with retry and reconnect.
Why I built it this way
Infrastructure as code for the cache
The Turborepo cache runs on AWS resources defined in Terraform, so the setup is reviewed like any other change and can be rebuilt from scratch.
Back up one clinic, not the dataset
Developers usually need one clinic’s data. Restoring it by clinic ID through CI/CD replaced pulling full datasets onto laptops.
Keep SSM as easy as SSH was
Database access moved from direct SSH to IAM and SSM sessions. The tunnel daemon reconnects on its own, so the safer path is also the convenient one.