L.J.K ConsultantStart a project

CV coach

A chat that helps you apply for a job without making anything up. Attach your CV and a job ad: it reads the CV into a structured profile, shows how well it matches, tailors the CV and writes a cover letter, each checked against what the CV actually says. Everything downloads as clean PDFs.

  • AI chat app
  • Next.js 16
  • React 19
  • NestJS
  • GraphQL
  • PostgreSQL + pgvector
  • Zod

Try the demo

Recorded from the real app with canned replies from its test mock model (no real AI calls; Jane Citizen is fictional). Jane adds experience her CV leaves out, and the match is checked again. Watch the recording (MP4)

01 / Context

The problem

AI writing tools are good at making a CV sound better, and just as good at quietly adding a skill you don't have, a bigger team than you led or a number you never measured. For a job application that is worse than useless. The tool has to help with the wording while keeping every fact traceable to the candidate's own CV.

02 / Solution

What we built

You askYou get
Read my CVProfile: the CV as structured data (contact, roles, projects, education, skills), copied, not reworded. Correct it, or add experience the CV leaves out (no CV holds everything), in plain words, and a new version replaces it; the match is then checked against the new version.
How well does it match?Match report: a score, and each requirement of the job ad as met, partial or missing, with the evidence from the CV and an honest next step.
Tailor my CVTailored CV: roles, bullets and skills reordered and reworded for the job, with what was left out and each reworded bullet shown beside its original.
Write a cover letterCover letter: 3 to 5 paragraphs for the job, with the name and contact details taken from the profile.

Each card has Preview PDF and Download PDF: one clean, single-column, ATS-friendly template with real text. Asking in your own words (“PDF please”, “can I print the letter?”) works too.

Visitors can pick the model (Anthropic, OpenAI or Gemini, whichever keys are configured). An optional My data mode saves profiles and letters to Postgres and recalls the relevant parts in a later chat (“use the accessibility paragraph from my last letter”).

03 / Engineering artefacts

How we worked

  • A design note per feature, then a plan, then the code. Profile, match report, tailored CV, PDF and My data each have their own written design in the repo before implementation.
  • Atomic design and Storybook. Every component has stories, every story is a test with an axe check, and text meets WCAG AAA contrast.
  • Tests that protect what would hurt most: block schemas, tailorCv, rate limits and the route handlers as unit tests; the whole chat end to end in Playwright against a mock model (streaming, every card, PDF downloads, failures), on mobile and desktop.
  • An accuracy eval against the real model, kept out of the normal test run because it costs money: 10 synthetic CVs and job ads with known answers and traps, each run 3 times, checking word-for-word profiles, false credits in match reports, tailored CVs without blocking flags, and cover-letter claims.
  • AI as a pair, with a human reviewer. Built with Claude Code: we set the plan and constraints, reviewed every pull request and asked for changes. The README lists where testing caught the AI’s mistakes.

04 / Interactive system map

How it's built

The browser talks only to the Next.js server. The server streams the model's reply, and the page parses the fenced JSON blocks in it against Zod schemas before showing them as cards. PDFs are rendered on the server, which checks everything again. The NestJS GraphQL API and Postgres hold the optional saved data; the chat keeps working if the API is down.

Scroll the diagram sideways to see all of it.

  • Browser
  • Next.js server (apps/web)
  • Checks shared by page and server
  • Outside services
  • API (apps/api)
Every component, as text
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.
Security headers Next.js server (apps/web)
Technology: proxy.ts: per-request CSP nonce, nosniff, frame and referrer policies
Role: Sets a nonce-based Content-Security-Policy and other security headers on every page.
Why this way: Scripts and styles run only with that request's nonce. The block parser runs Zod in jitless mode so the strict CSP needs no eval.
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.

How a request travels

Tailor a CV

  1. Chat page: Jane asks "Tailor my CV for this job". The page checks the message and files, then sends the last 20 turns.
  2. POST /api/chat: The route re-checks everything with Zod and reads the body only up to its size limit.
  3. Rate limiter: One message counted against Jane's limit for this window.
  4. Persona and system prompt: The career persona's system prompt, with each block's JSON Schema and the never-invent rules.
  5. Model providers: The chosen model streams its answer: a short note and a tailored block that points at profile entries by index.
  6. POST /api/chat: The reply streams back to the page as plain text. Keys and provider details never reach the browser.
  7. Chat page: Text appears as it arrives; the card shows a placeholder until its block is complete.
  8. Block schemas: The tailored block is parsed with its Zod schema. If it doesn't parse, the card says it couldn't be shown.
  9. tailorCv: tailorCv merges it with the profile: facts from the profile, each reworded bullet beside its original, anything without a source flagged.
  10. Chat page: The tailored CV card shows the changes, what was left out, and any flags. Blocking flags disable Download PDF.

Make a PDF

  1. Chat page: Jane presses Download PDF on the tailored CV. The page sends the profile and the tailored block as JSON.
  2. POST /api/cv-pdf: JSON only (415 otherwise), at most 256 KB.
  3. Rate limiter: One PDF counted against Jane's PDF limit.
  4. Block schemas: Both blocks are validated again on the server.
  5. tailorCv: tailorCv runs again on that pair. A CV with blocking flags is refused here too, whatever the page says.
  6. POST /api/cv-pdf: @react-pdf/renderer draws the single-column template. Characters the font lacks are named and refused.
  7. Chat page: The file downloads, named after the person and the employer, e.g. Jane-Citizen-CV-Harbourside-Health.pdf.

Recall saved data

  1. Chat page: With My data on, Jane gives her email and asks to reuse a paragraph from an earlier letter.
  2. POST /api/chat: Before calling the model, the route asks My data recall for context.
  3. My data recall: Recall uses the newest email in the chat and has 3 seconds; if the API is slow, the reply goes ahead without it.
  4. GraphQL API: searchMyData looks up only that email's data.
  5. Local embeddings: The message is embedded locally; nothing goes to a third party.
  6. Postgres + pgvector: pgvector returns the closest saved chunks via the HNSW cosine index.
  7. Persona and system prompt: The saved profile and chunks are added to the system prompt for this reply only, as Jane's own facts under the same rules.
  8. Model providers: The model answers with the recalled paragraph in context.

05 / Engineering rationale

Key decisions

Structured output, one schema for both sides.

The model answers in fenced JSON blocks (profile, match, tailored, coverletter) defined by Zod schemas. The same schema validates the reply and, turned into JSON Schema, goes into the system prompt.

Why The format the model is taught and the format the page checks can't drift apart.

A tailored CV refers to the profile, it doesn't restate it.

The tailored block points at profile entries by index (“role 0, bullets 1 and 2”) and only adds new wording. tailorCv takes employers, titles and dates from the profile itself. A bullet with no source is a blocking flag; a new number or an unknown skill is a warning. A CV with blocking flags can’t be downloaded.

Why Facts are copied by code, so the model has nothing to get wrong; only the wording is the model's.

Contact details come from the profile, not the model.

The cover letter block holds only the letter; the name, email and phone are filled in when it is shown or printed.

Why The model can't mistype them. Claims in prose can't be checked mechanically, so for letters "never invent" is a prompt rule, measured by the eval.

The server checks again before making a PDF.

POST /api/cv-pdf re-validates both schemas and re-runs tailorCv, accepts JSON only up to 256 KB, and refuses characters the PDF font lacks rather than printing gaps.

Why Whatever the browser sends is untrusted.

Keys and limits stay on the server.

The browser never calls a model provider or the API. Each visitor is rate limited per IP (messages and PDFs), the request body is read only up to its limit, and files are re-checked by their content, not their name.

Why Every message costs money.

Nothing stored by default.

The conversation lives in the browser tab. My data is off by default and, because an email is its only key, the API refuses to start with it on in production. Embeddings are computed locally (all-MiniLM-L6-v2 through transformers.js) and stored in pgvector.

Why No personal data on a server unless the owner chooses, and no third party sees the saved documents.

Trade-off Deploying My data would need sign-in or email verification first; the README says so.

CV coach running with its test mock model (fictional data)

06 / Try it

Interactive demo with sample data. No AI is called.

Follow Jane Citizen (fictional) as she applies for a fictional job: profile, match report, tailored CV beside the original, cover letter and the PDFs. One step shows what happens when a model invents something.

Start the demo

07 / Outcomes

Results and links

  1. Tests at every layer: API unit, API end to end against real Postgres, a black-box smoke test of production builds, web unit and story tests with axe, Playwright end to end with axe, and the paid accuracy eval.
  2. The README lists what is not done yet, including CI, revocable sessions and non-Latin PDFs, and what would change at ten times the scale.

Next step

Need an AI assistant that sticks to the facts?

Tell me what you need