- Chat page Browser
- Technology: Next.js 16 App Router, React 19, Tailwind 4, atomic components
- Role: Sends the conversation and attached files, shows the reply as it streams, and turns each fenced JSON block into a card (profile, match report, tailored CV, cover letter).
- Why this way: The conversation lives only in the tab: nothing is stored on a server unless the owner turns on My data. Message length and files are checked here first, so mistakes show at once.
- POST /api/chat Next.js server (apps/web)
- Technology: Route handler (handleChat), streams plain text
- Role: Re-checks every message and file against the same limits as the page (Zod chatRequestSchema, type sniffed from content), sends the last 20 turns to the chosen model and streams the reply back.
- Why this way: The browser never calls a model provider, so the API keys stay on the server. Provider errors are logged on the server and shown as plain words.
- Rate limiter Next.js server (apps/web)
- Technology: In memory, per visitor IP: 20 messages / 30 PDFs per 10 minutes by default
- Role: Refuses a visitor who goes over the limit and tells them how many minutes to wait.
- Why this way: Every message costs money. The visitor's IP is read only from trusted proxy hops, so one visitor's limit isn't everyone's.
- POST /api/cv-pdf Next.js server (apps/web)
- Technology: Route handler, @react-pdf/renderer
- Role: Renders the CV, tailored CV or cover letter as a clean single-column PDF with real text.
- Why this way: Whatever the browser sends is untrusted, so this route checks again: JSON only, at most 256 KB, both schemas, and tailorCv for a tailored CV. Characters the PDF font lacks are named and refused, not printed as gaps.
- Persona and system prompt Next.js server (apps/web)
- Technology: Career persona, each block's JSON Schema generated from Zod
- Role: Tells the model how to answer: in fenced blocks (profile, match, tailored, coverletter, pdf) and never inventing facts.
- Why this way: The JSON Schema in the prompt is generated from the same Zod schema the page validates with, so the format taught and the format checked can't drift apart.
- Model catalog Next.js server (apps/web)
- Technology: Discovered from each provider's models API, filtered by CHAT_MODELS
- Role: Lists the models visitors may pick under the message box (the cheap tier of each provider by default).
- Why this way: A provider is on as soon as its key is set; no code change to add or drop one.
- My data recall Next.js server (apps/web)
- Technology: Optional (MY_DATA=on), 3-second budget
- Role: For each reply, adds the visitor's newest saved profile and the saved chunks closest to the message to the system prompt.
- Why this way: Lets a later chat reuse earlier work ("use the paragraph from my last letter") under the same never-invent rules. If the API is slow or down, the reply goes ahead without it.
- Block schemas Checks shared by page and server
- Technology: Zod: profile, match, tailored, coverletter, pdf
- Role: Validate each block before it is shown as a card or turned into a PDF. An incomplete block shows a placeholder while streaming, and a message if it was cut off.
- Why this way: Structured output is only trustworthy if it is checked in code; a block that doesn't parse is never shown as if it were valid.
- tailorCv Checks shared by page and server
- Technology: TypeScript function, unit tested
- Role: Builds the tailored CV from the profile and the tailored block: employers, titles and dates come from the profile; reworded bullets are paired with their originals; anything new is flagged.
- Why this way: The model refers to the profile by index and only writes new wording, so it has no facts to get wrong. A bullet with no source blocks the download; a new number or an unknown skill is a warning.
- Model providers Outside services
- Technology: Anthropic, OpenAI or Gemini (default Claude Haiku 4.5)
- Role: Write the replies, streamed back token by token.
- Why this way: Any provider whose key is configured; the e2e tests use a local mock model instead, so tests never call or pay for a real one.
- GraphQL API API (apps/api)
- Technology: NestJS 12, Apollo (code-first), Sequelize
- Role: saveMyData, myData, searchMyData and deleteMyData for the optional My data mode.
- Why this way: Guards give one place for auth (deny by default) and rate limits. My data operations are refused while the mode is off, and the API won't start with it on in production, because an email is its only key.
- Local embeddings API (apps/api)
- Technology: all-MiniLM-L6-v2 via transformers.js, 384 dimensions
- Role: Turns each saved chunk (a role, a project, a letter paragraph) and each search into a vector.
- Why this way: No key, no cost, and the text never leaves the machine. Tests use a deterministic fake.
- Postgres + pgvector API (apps/api)
- Technology: Postgres 17, pgvector, HNSW cosine index, Umzug migrations
- Role: Stores saved documents (every profile version kept) and their chunks with embeddings.
- Why this way: One database for relational data and vector search; schema changes are explicit, reviewable migrations. Vector queries use bind parameters, never string-built SQL.