mirror of
https://github.com/srbhr/Resume-Matcher.git
synced 2026-01-15 12:05:34 +00:00
- Introduced JD Match feature documentation detailing how tailored resumes match job descriptions. - Added Resume Template Settings documentation outlining template types and formatting controls. - Created LLM Integration Guide for multi-provider AI support, JSON handling, and prompt guidelines. - Compiled Agent Documentation Index for modular documentation on AI agents working with Resume Matcher. - Developed Maintainer Guide for the resume editor, covering architecture, types, and PDF handling. - Established a Code Review & Technical Debt TODO document to track critical issues and improvements.
6.7 KiB
6.7 KiB
Resume Editor – Maintainer Guide and Next Steps
This guide documents how to work with the resume editor/preview, the Zustand store contracts, types, and PDFs so future changes remain consistent and safe.
High-level architecture
- Route:
src/app/editor/page.tsx- Header: back link, SaveStatus, Export PDF
- Split layout: left editor, right live preview
- Editor (tabs):
src/components/resume/resume-editor.tsx- Sections: Personal, Experience, Education, Skills
- Debounced writes to store (300ms) via
use-auto-save
- Preview:
src/components/resume/resume-preview.tsx- Subscribes to active resume; A4 aspect ratio; scrollable
- Store:
src/lib/stores/resume-store.ts- Variants list + active selection + granular update/add/remove/reorder actions
- PDF:
src/lib/pdf-export-impl.tsx(implementation),src/lib/pdf-export.ts[x](shim re-export)
Key types and contracts
src/types/resume-schema.tsResumeJSONis flexible; known keys include:id: string(required)name?: string,title?: string,summary?: stringcontact-details?: ContactDetailswork-experiences?: WorkExperienceEntry[]education?: EducationEntry[]skills?: Record<string, string[] | string | undefined>- Forward-compatible index signature:
[key: string]: unknown
- List entries include optional
_id?: stringto support DnD reordering and stable keys.
List item types
WorkExperienceEntryfields:company,position,duration,location,employment-type,responsibilities?: string[],achievements?: string[],_id?: string.EducationEntryfields:institution,degree,field,graduation-date, etc.,_id?: string.
Zustand store API
File: src/lib/stores/resume-store.ts
- Variant management
addResume(partial?) => ResumeJSONopenResume(id)renameResume(id, name)updateResume(id, patch)removeResume(id)getActive() => ResumeJSON | undefined
- Granular editing (used by the editor)
updateResumeField(id, field: keyof ResumeJSON, value: unknown)- Experience
addExperience(id, experience?: WorkExperienceEntry)removeExperience(id, experienceId: string)reorderExperience(id, fromIndex: number, toIndex: number)
- Education
addEducation(id, entry?: EducationEntry)removeEducation(id, entryId: string)reorderEducation(id, fromIndex: number, toIndex: number)
- Skills
addSkill(id, skill: string, group = 'all')removeSkill(id, skill: string, group = 'all')
Notes:
addExperience/addEducationassign an_idif not provided.- Reorder actions move items by indexes safely (bounds-checked).
Editor patterns
- Debounced writes: use
useAutoSave({ onSave, delayMs: 300 })- Exposes
{ saving, onFieldChange(field, value), forceSave() } useSaveStatusStoreglobal store setssavingfor header indicator.
- Exposes
- Personal Info: update
contact-detailsobject and write viaonFieldChange('contact-details', value). - Experience/Education: mutate a local copy of the array, then
updateResumeField(id, 'work-experiences'|'education', next). - DnD:
@dnd-kitwith_idkeys; reordering callsreorder*actions.
Preview and PDF
- Preview: ensure plain, stable TS types (no
any). Keep A4 ratio withaspect-[1/1.4142]. - PDF export: call
exportResumePdf(resume)from header button.- Implementation lives in
src/lib/pdf-export-impl.tsxusing@react-pdf/renderer. - File name:
${firstName}_${lastName}_Resume.pdf(falls back toMy_Resume.pdf).
- Implementation lives in
Adding a new section (example: Certifications)
- Types: extend
ResumeJSONwithcertifications?: CertificationEntry[](already present) and ensure entry includes optional_id?: stringif reordering is desired. - Store actions:
- Mirror add/remove/reorder as done for experience/education.
- Editor UI:
- Create
components/resume/certifications-editor.tsxwith list add/remove + DnD. - Wire it in
resume-editor.tsxtabs; debounce writes like other sections.
- Create
- Preview:
- Render the section inside
resume-preview.tsx.
- Render the section inside
- PDF:
- Render the section inside
pdf-export-impl.tsxmirroring preview layout.
- Render the section inside
- Smoke test:
- Add few items, reorder, export PDF, verify content and order.
Styling conventions
- Editor panel:
bg-muted/30+ left border separation vialg:border-r. - Preview panel: white/dark background, subtle border and shadow, scroll when overflow.
- Form cards: simple bordered blocks (upgrade to shadcn/ui in future if desired).
Common pitfalls
- Multiple lockfiles: use one package manager. This repo is PNPM (
packageManagerset). Removeyarn.lockto avoid dev-time warnings. - Turbopack runtime errors: run
next devwithout--turbopackif you see SSR runtime chunk issues. - Type safety: avoid
any. Use the provided interfaces andunknownwhere needed; cast collections toWorkExperienceEntry[]/EducationEntry[]when mapping. - IDs for DnD: ensure
_idexists on list entries to keep stable keys.
Maintenance checklist (PRs)
- Types updated for any new fields/sections.
- Store actions added with tests or at least a small local smoke test.
- Editor section created with add/remove/reorder and debounced writes.
- Preview updated to match editor data and order.
- PDF updated to mirror preview.
- Build/lint/typecheck run locally.
Useful commands
- Dev (no Turbopack):
pnpm dev - Build:
pnpm build - Lint:
pnpm lint - Clean state (optional): remove
.next/, then reinstall viapnpm install.
Variables and data mapping quick ref
- Personal Info →
resume['contact-details'] - Summary →
resume.summary - Experience →
resume['work-experiences'](array ofWorkExperienceEntry) - Education →
resume.education(array ofEducationEntry) - Skills →
resume.skills[group](array of strings; default groupall)
If anything gets out of sync (editor vs preview vs PDF), use this guide to trace the flow: Types → Store actions → Editor writes (debounced) → Preview render → PDF render.
Environment hygiene and Turbopack notes
- Prefer a single package manager. This repo is configured for PNPM. To avoid warnings and edge cases, delete
yarn.lockand keeppnpm-lock.yaml. - If you hit the Turbopack runtime chunk error (Cannot find module '../chunks/ssr/[turbopack]_runtime.js'):
- Run dev without Turbopack:
pnpm dev - If you want to re-enable Turbopack:
- Clean: remove
.next/ - Ensure only one lockfile exists and install deps fresh:
pnpm install - Upgrade Next to the latest patch if needed:
pnpm up next - Start with Turbopack:
next dev --turbopack(optional)
- Clean: remove
- If the error persists, stick to
next dev(webpack) for stability.
- Run dev without Turbopack: