Try the live demo: no sign-up, a sample family that is deleted after 24 hours.
Design system ·
API repository ·
Coverage report ·
Releases
Cygnus is a mobile-first web app where parents keep their children's health record in one place: Brazil's National Immunization Program (PNI) schedule, with what was given and what is overdue; doctor visits; weight and height on the WHO growth charts; developmental milestones with photos; medications, professionals and health plans. A record can be shared with every person who helps care, so it does not live in one parent's drawer. Portuguese, English and Spanish; light and dark.
This repository is the frontend. The backend is cygnus-api. Both are a portfolio project, built the way a product is built: tests, an accessible design system, a public contract between the two halves, production deploys, privacy terms and observability.
Cygnus organizes information. It does not replace advice from healthcare professionals.
Taken from the live demo by scripts/render-readme-assets.mjs.
They follow your GitHub theme.
Landing page, which never waits for the API |
Dashboard for the whole family |
Vaccines on the PNI schedule |
Growth over the WHO reference bands |
The decisions below are the ones a reviewer would ask about. Each names the file where it lives.
- No token ever reaches JavaScript. Sessions are HttpOnly,
SameSite=Strictcookies. Concurrent 401s share one silentPOST /auth/refreshand retry once, and mutating requests echo the readablecsrf_tokencookie asX-CSRF-Token(double-submit). All three live insrc/lib/http-client.tsand nowhere else. Strict cookies do not travel to a cross-site host, so production calls the API through a same-origin Vercel rewrite (vercel.json). - Every response is parsed at the boundary. Each
*.api.tsfetchesunknownand returns a Zod-parsed type, so a contract drift surfaces as a validation error with a path, not as a broken render three components later. In CI,npm run contract:checkcompares the mapped schemas with theopenapi.jsonthe API commits (scripts/). - Accessibility is a build gate, not a panel. Every Storybook story runs axe in the light and
the dark theme, and a violation fails CI. There is no exception list. Four colour tokens in
src/index.cssdeliberately differ from the design reference, because the reference values measured below WCAG AA; each says so where it is defined. - The landing page never waits for the API. The API runs on a free Render instance that sleeps
and takes about a minute to wake. The session cookies are HttpOnly, so the readable
csrf_tokencookie is the hint: without it,/renders at once and sends no request (LandingRoute.tsx). - A demo without sign-up. "Try the demo" asks the API for a disposable account, pre-filled with a sample family and deleted after 24 hours. The demo skips the terms gate, and a banner says the data is fake and how to leave.
- The schedule also ships outside the app.
embed/is a dependency-free web component in a shadow root (2.78 kB gzip, measured 2026-10-13), with an iframe variant and a versionedpostMessageprotocol.mf/exposes the same schedule as a Module Federation remote that shares the host's React as a singleton. Both are published contracts with stable URLs. - Dates are calendar dates. A
YYYY-MM-DDbirth date is not a UTC instant. Vitest runs inAmerica/Sao_Paulo, because in UTC (the CI default) that class of bug passes silently (src/lib/date.ts). - Motion that respects the reader. Page changes are View Transitions, and the scroll-driven
effects sit behind
@supports (animation-timeline: view()). Every effect is off underprefers-reduced-motion.
flowchart TB
subgraph Clients
SPA["Cygnus app<br/>(React SPA)"]
Site["Any website<br/>embed widget"]
Host["Another React app<br/>Module Federation host"]
end
subgraph Vercel["Vercel · cygnus.samuelsantana.dev"]
Static["Static build<br/>/ · /embed/* · /mf/*"]
Proxy["Rewrite<br/>/api/* · /uploads/*"]
end
subgraph Render
API["cygnus-api<br/>Fastify 5"]
Redis[("Redis")]
end
Neon[("PostgreSQL<br/>Neon")]
SPA --> Static
SPA -- "same-origin, cookies" --> Proxy
Site -- "GET /public/vaccine-schedule" --> Proxy
Host -- "remoteEntry.js" --> Static
Proxy --> API
API --> Neon
API --> Redis
The browser only ever talks to cygnus.samuelsantana.dev. GitHub Pages hosts the
design system and the
coverage report, and Sentry receives errors
and Web Vitals.
| Concern | Choice |
|---|---|
| UI | React 19, React Router 7, Tailwind CSS 4, shadcn/ui on Radix |
| Server state | TanStack Query, with exported query-key factories |
| Forms and validation | React Hook Form and Zod |
| UI state | Zustand, for UI state only |
| Localization | i18next: Brazilian Portuguese (default), English, Spanish |
| Build | Vite 8, strict TypeScript, oxlint, Module Federation |
| Tests | Vitest, Testing Library and MSW; Storybook 10 with axe; Playwright |
| Delivery | Vercel, GitHub Pages, Docker with nginx, Sentry |
Use Node.js 24 and npm. Start the API first; it
listens on http://localhost:3005 by default.
npm ci
npm run dev # http://localhost:4205To point at another API, create .env.local with VITE_API_BASE_URL. Every VITE_* variable is
compiled into the public bundle, so never put a secret in one; the Google credentials belong to the
API.
With Docker, nginx serves the production build on the same port, without hot reload:
docker compose up -d --build webRebuild after each change. Docker and Vite both use port 4205, so run one at a time. Compose does
not start the API; pass VITE_API_BASE_URL as a build argument to change its origin.
| Command | What it checks |
|---|---|
npm run lint |
oxlint |
npx tsc -b |
Types for the app, stories, embed and Module Federation |
npm test |
Unit and component tests in jsdom, with strict MSW |
npm run test:coverage |
The same, with V8 coverage and a summary |
npm run contract:check |
Mapped schemas against the API's published OpenAPI |
npm run test:storybook |
Every story in Chromium: render, interactions and axe |
npm run test:e2e |
Playwright journeys against a running stack |
npm run build |
Typecheck, then the app, the embed and the remote, in that order |
CI runs lint, types, the contract check, coverage and the build in one job, and the Storybook suite
in another. The Storybook suite needs npx playwright install chromium. The E2E suite is not in CI,
because it needs a checkout of the API with PostgreSQL and Redis; the
E2E instructions explain how to run it. The contract check covers an explicit map
of endpoints, and axe does not replace a manual accessibility review.
The coverage report counts every TypeScript
module in src/, embed/ and mf/, imported by a test or not, and excludes declarations, tests,
stories and test infrastructure. Storybook and E2E runs do not add to it. CI fails below a floor set
in vitest.config.ts: 89% of lines, 87% of statements, 83% of functions and 80% of branches.
| Path | What lives there |
|---|---|
src/app/ |
Router, providers, layouts and the session gate |
src/features/<domain>/ |
One folder per domain: api/ (fetch, Zod schemas, hooks), components/, routes/ |
src/components/ui/ |
shadcn/ui primitives, without business logic |
src/shared/, src/hooks/, src/lib/ |
Cross-feature components and infrastructure: HTTP client, query client, i18n, dates |
src/locales/ |
Copy in the three languages |
src/docs/ |
Storybook pages |
embed/, mf/ |
The widget and the federated remote |
e2e/ |
Playwright journeys |
Routes are lazy-loaded. Design tokens live in src/index.css, and stories sit beside their
components.
A merge to main deploys to Vercel and republishes the design system and the coverage report to
GitHub Pages. One build produces three artifacts:
| Artifact | Public entry point | Notes |
|---|---|---|
| The app | / |
lazy routes; entry chunk 183.8 kB gzip (measured 2026-10-13) |
| Embed widget | /embed/embed.js, /embed/iframe.html |
embed/README.md |
| Module Federation remote | /mf/remoteEntry.js |
mf/README.md |
Those three URLs are contracts: they live in other people's HTML and deployments, so they never
change, and they are cached for ten minutes. Only hashed assets are immutable. Vercel and the
Docker nginx keep separate header configurations, and one script checks either:
node scripts/check-static-serving.mjs # headers, caching and 404s
node scripts/check-static-serving.mjs --browser # plus the iframe, from another origin, in ChromiumIt checks the Docker build on port 4205 by default; set STATIC_BASE_URL to check another target.
The browser check calls the real API.
The Terms of Use and the
Privacy Policy are versioned in
src/shared/legal.ts, with the text in src/features/legal/content/. A new
version asks every signed-in user to accept again, and the API records each acceptance.
MIT, © 2026 Samuel Santana. Dependencies and third-party material keep their own licenses.
Built by Samuel Santana: samuel.ssa89@gmail.com.




