Work Architecture
System design · SITIMM platform, November 2026
How the platform is built, and why it's built that way.
Five repositories, four surfaces, one engineer. This page is for the technical reviewer: the system, the contracts between its parts, how a change reaches production, and the trade-offs I chose, with what each one cost.
- Scale
- 70,000 members, 170 companies, 8 languages
- Surfaces
- Next.js website, React Native app on iOS and Android, React admin panel, FastAPI API
- Throughput
- 668 pull requests merged in October 2026, across five repos
- CI spend
- 0 GitHub Actions minutes since 28 Sep 2026; the same checks run before every push
- Deploys
- API as a container image per commit; web and panel on Netlify; the app through both stores
- Decisions on record
- 30 decision records for the admin panel alone
The system
One API serves three frontends. Everything server-side runs in Docker on a single VPS: infrastructure one person can operate, and the union can pay for.
-
Clients
- WebsiteNext.js 16, React Server Components, 8 locales
- Mobile appExpo, React Native New Architecture, iOS and Android
- Admin panelReact 19 single-page app on Vite
-
Delivery
- NetlifyWebsite and panel, a preview per pull request
- App Store and Google PlayNative builds, made by hand
-
API
- FastAPI, asyncREST v2, with legacy v1 being retired
- Socket.IOLive chat between members and their advisors
-
Background work
- Celery workersSeparate queues: membership imports at three priorities, media ingest
- SchedulerRecurring and delayed jobs
-
Data
- PostgreSQL with pgvectorRecords, plus search for the AI assistant
- RedisCache, queue broker, rate limits, socket fan-out
- Object storageS3-compatible, for media and documents
-
Outside services
- Firebase Cloud MessagingPush notifications
- WhatsAppThe publishing bot
- LLM and translation APIsThe assistant, post drafts, 8 languages
- SentryErrors on every surface
Why it looks like this
- Business rules live once, in the API. The frontends render and cache; they don't decide who can see what.
- Postgres does more than store rows. When the assistant needed search, I added pgvector to the database we already ran instead of a new service to operate. The search case has the details.
- The cost is a single machine. One VPS is one point of failure, and the CI runner I once put on it competed with production. That story is below.
Five repos, one contract
I kept the API, website, app, panel and shared types in separate repositories, not a monorepo. Each surface ships on its own clock: the website in minutes, the app after store review. What holds them together is the contract.
- Pydantic modelsThe API's schemas are the source of truth for every request and response.
- JSON Schema bundleA script dumps every model into one deterministic, byte-stable file. A test fails when it's stale.
- Shared types packageA versioned npm package with the v2 shapes, endpoints, socket event names and roles.
- Three frontendsWebsite, app and panel import the same types, so a breaking change shows up as a type error.
Retiring the legacy API without a rewrite
The union inherited a legacy backend and couldn't go dark while I replaced it. So v2 grows beside v1, and v1 can only shrink: its endpoints are frozen in an inventory, and a test fails if one is added. On the website, features live in v1/ and v2/ folders side by side behind one feature flag; the old folder is deleted once its migration is done.
What it costs
- Version skew. The package is at 4.0 while the three frontends pin 2.69 to 2.74. A new major is adopted one surface at a time, on purpose, so a contract change never lands everywhere on the same day.
- Types are mirrored by hand. The TypeScript package follows the schema bundle through a runbook, not a generator. That's the next thing I'd automate.
Frontend architecture
Three React codebases with different jobs, so three different answers to the same questions: where state lives, how data is fetched, and what happens offline.
Website
- Next.js App Router with React Server Components. No Redux or Zustand: Server Components and per-fetch caching cover most data flows.
- Feature-sliced layers, with the import direction enforced by ESLint: app, features, shared, infrastructure, lib. Features reach each other only through their public entry point.
- Eight locales through next-intl, with translation keys type-checked at build time.
- Accessibility is enforced by lint rules and typed components. The accessibility case shows how.
Mobile app
- Expo with generated native projects: the
ios/andandroid/folders come from config, not from commits. New Architecture, Hermes and the React Compiler. - RTK Query for data. The socket only receives; every write goes over HTTP, and server events patch the cache.
- Offline first: failed writes wait in an encrypted queue and replay on reconnect, only for the account that made them. Sign-in and personal-data writes are never queued.
- Tokens live in the OS keystore, and personal data is stripped before state is saved to disk.
Admin panel
- A React 19 single-page app on Vite. API endpoints are injected per feature into a few RTK Query slices.
- One shared lock for token refresh, so parallel 401s trigger a single refresh. Only idempotent requests are retried.
- Its own design system, Clay: tokens and components with the same API in every screen.
- Rebuilt screen by screen. Each screen gets a decision record that describes what exists before anything changes.
Shipping without paid CI
The pipeline I run today wasn't the plan. It's what was left after volume outgrew the budget. I kept the rigor and moved where it runs.
- Hybrid CIUntil mid-2026: GitHub-hosted runners for the frontends, a self-hosted runner for the API, cloud builds on top.
- Volume jumpsMerged pull requests went from 114 in June to 544 in July. Workflow runs went from 752 to 3,140.
- The budget runs outThe monthly Actions budget ran out partway through each month. Jobs were refused without running a step, and new features waited for the next billing cycle.
- The runner fights productionThe API's runner lived on the production VPS, with 2 vCPUs. One CI run sat queued for 14 h 44 min.
- Decision28 Sep 2026: Actions off in all five repos. Every check moves to the pre-push hook. One workflow stays: the API deploy, which spends no minutes.
| Month, 2026 | Merged pull requests | Actions runs | What ran |
|---|---|---|---|
| June | 114 | 752 | Hybrid CI |
| July | 544 | 3,140 | Budget runs out; most runs refused |
| August | 327 | 2,035 | Same; the API's runner leaves production |
| September | 257 | 1,264 | Actions turned off on the 28th |
| October | 668 | 165 | Local checks; Actions only for API deploys and dependency updates |
| November, to the 23rd | 445 | 118 | Same |
Counted from the GitHub API on 23 Nov 2026. A run that was refused for budget still counts as a run.
The incident that shaped the deploy
That 14-hour queue finished on 29 Jul 2026. The deploy workflow fired three seconds later and built a commit five behind main, then tried to put it on production. A database migration refused it, by luck rather than design. Since then, a guard compares the commit against the real head of main and skips any deploy that's been overtaken. Skipped, not failed: a red mark for a correct outcome teaches people to ignore red marks.
What runs before every push
| Repo | Checks |
|---|---|
| API | Formatting, Ruff, isort, mypy, an access-control check on company-scoped endpoints, the full pytest suite in parallel, and the contract-freshness test. About 7 minutes. Secrets and Bandit scans on commit. |
| Website | Types for the app and for its tests, ESLint with zero warnings, Vitest, a dependency audit, and validation of the end-to-end config. |
| Admin panel | Seven steps: ESLint, types, formatting, quality rules on touched files, the unit tests related to the diff, a production build, and security and translation checks. It refuses to push uncommitted work and leaves a receipt. |
| App | Module boundaries, dependency and audit checks, coverage of changed lines, docs, and the v2 contract invariants. |
How each surface deploys
- API. A manual dispatch builds a container image tagged with the commit, pushes it to the GitHub registry, and a self-hosted runner deploys it and runs the Alembic migrations. One deploy at a time, never cancelled midway. Rolling back means deploying an older tag.
- Website and panel. Netlify builds main, with a preview for every pull request.
- App. Built by hand on the laptop. QA installs it over the published version, with real data, before it goes to the stores.
What I gave up, and what covers it
| Given up | Why it's acceptable here | What covers it |
|---|---|---|
| A clean, neutral build machine | The agents write the code on this same machine anyway. | A real install in every worktree, a check that the hooks exist, a production build inside the gate. |
| Checks visible on each pull request | I'm the only person who merges. | The gate leaves a receipt, and the reviewing model reports what it actually read. |
| Parallel CI capacity | Five or six agent sessions already share the laptop. | A machine-wide lock runs one heavy job at a time, after a memory check. |
| Required status checks on main | Private repos on a free plan can't enforce them anyway. | Only I merge, after the local gate and a second model's review. |
When a second engineer joins, or the budget comes back, CI returns first for the API, the riskiest repo. It would run the same command as the laptop, so the two can't drift.
How I make decisions
Each decision gets the same five questions: what forced it, what else I considered, what I chose, what it costs, and what would make me change it.
| Decision | Instead of | What it costs | I'd revisit when |
|---|---|---|---|
| Checks before push, Actions off | Paying for more minutes, or cutting checks | One machine is the build farm | A second engineer or a CI budget |
| Search inside Postgres with pgvector | A separate vector database | Tuning by hand, in SQL | Search load starts to slow writes |
| Separate repos and a versioned types package | A monorepo | Version skew between surfaces | Skew causes a production bug |
| v2 beside v1, v1 can only shrink | A rewrite and a cut-over date | Two backends live; the app talks to both | The v1 inventory reaches zero |
| One VPS with Docker | Managed cloud services | A single point of failure | Uptime needs outgrow one machine |
| Native builds by hand | Paid cloud builds | Laptop time and manual signing per release | Releases get more frequent than weekly |
| Socket receives, HTTP writes | Writes over the socket | A second connection for live chat | HTTP round-trips become the chat bottleneck |
What experience bought
The agents write most of the code. Eight years of building frontends is what decides which code is worth writing, and what has to hold when the budget doesn't.
- Knowing what not to cut. When CI money ran out, the checks moved to the laptop. None of them were dropped.
- Measuring before deciding. The CI decision came with run counts, queue times and a near-miss deploy, not with a feeling.
- Picking boring technology one person can run. Postgres, Redis, Docker and one VPS. Nothing that needs a team on call.
- Writing the reason down. Decision records and guardrails mean every agent session, and the next engineer, starts from the why.
What I'd do differently
- Set a spending alert before the first cutoff, not after it.
- Generate the TypeScript types from the schema bundle from day one.
- Never put a CI runner on the production machine, even for a week.
How this site is built and tested
The same discipline, at the scale of one portfolio. Static HTML with no framework, ten visual styles from one semantic document. Every change goes through a pull request and one gate, and the same gate runs again on exactly what ships before each deploy. The source and tests and every CI run are public.
| Layer | What has to hold |
|---|---|
| Accessibility | WCAG 2.2 AA with axe on every page in all ten styles, and AAA color contrast (7:1) in every one. Reflow at 320 px, a visible focus ring in every style, reduced motion, Windows high contrast. |
| End to end | Playwright in Chrome, Firefox, and WebKit (Safari's engine) on an iPhone profile. Any console error or CSP violation fails the run. The site also works without JavaScript. |
| Visual regression | 57 screens compared against reviewed baselines. |
| Performance | Lighthouse on mobile and desktop for every page: performance 95 or more, every other category 100, LCP under 2.5 s, layout shift under 0.1, 800 KB per page at most. Below that, the merge is blocked. |
| Security | A Content Security Policy with no unsafe-inline: each inline script and style is allowed by its hash. HSTS, self-hosted fonts, no cookies, and a secrets scan over the whole history. |
| Content | Valid HTML, structured data, and a spell check on everything a visitor reads or hears. |
One thing it caught
Lighthouse measured a layout shift of 0.22 on every page. At 412 px wide, a common Android width, the header fit one more item on its first row with the fallback font than with Bodoni, which is 14 px wider. So it re-wrapped when the font arrived and pushed the page down 22 px. Pinning the header layout on narrow screens brought the shift under 0.05 and performance from 88 to 99, and the budget that found it now blocks any change that brings it back.
Every deploy is a tagged release, and rolling back is one workflow that restores the previous deploy. Production is watched too: an uptime check every few minutes that opens an incident issue on its own, a daily smoke test and security-header grade, and Lighthouse against the live site every week.
Want to go deeper?
I'm happy to walk through any of these decisions, including the ones I'd make differently now.