Resume Templates and Customization
Relevant source files
The following files were used as context for generating this wiki page:The Resume Matcher application provides a flexible and powerful system for styling and formatting resumes. Users can choose from multiple templates and customize various visual aspects such as spacing, fonts, and margins. This system is designed to provide a live preview of changes and generate a professional, print-ready PDF that reflects the user's choices.
The core of this system relies on a combination of React components for state management, CSS custom properties (variables) for dynamic styling, and a dedicated server-side rendering path for PDF generation. This architecture separates the concerns of editing, previewing, and printing, ensuring a consistent user experience and high-quality output.
Architecture Overview
The template customization architecture involves several key components working together. The user interacts with formatting controls, which update a state object. This state is then used to generate CSS variables that are applied to the resume preview in real-time. When a PDF is requested, these settings are passed as URL parameters to a print-specific page that is rendered by the backend using Playwright.
This diagram illustrates the flow of template settings from user interaction to the final rendered preview.
Available Templates
The application offers two distinct "Swiss" style templates, each catering to different content presentation needs.
| Template ID | Component | Description |
|---|---|---|
swiss-single | ResumeSingleColumn | A traditional single-column layout where sections are stacked vertically. This template maximizes content density and is ideal for resumes with detailed descriptions. |
swiss-two-column | ResumeTwoColumn | A modern two-column layout with a 65%/35% split. The main column typically contains experience and projects, while the sidebar holds summary, skills, and other supporting information. |
Sources: AGENTS.md, apps/frontend/components/resume/resume-single-column.tsx, apps/frontend/components/resume/resume-two-column.tsx
Single-Column Template
The ResumeSingleColumn component renders all resume sections in a single vertical flow, ordered according to the sectionMeta array in the resume data. It is a straightforward layout that prioritizes chronological or logical flow without spatial separation of content types.
Sources: apps/frontend/components/resume/resume-single-column.tsx:10-15, 203-205
Two-Column Template
The ResumeTwoColumn component organizes content into a main area and a sidebar. Certain sections like workExperience and personalProjects are hardcoded into the main (left) column, while sections like summary, education, and skills are placed in the sidebar (right). This layout is effective for technical roles where separating core experience from supporting details can improve readability.
Sources: apps/frontend/components/resume/resume-two-column.tsx:16-22, 148-151, 230-232
Formatting Controls
Users can customize the appearance of their selected template through a set of controls available in the Resume Builder. These settings are managed in the ResumeBuilder component's state and persisted in localStorage.
| Control | Type | Default Value | Effect |
|---|---|---|---|
| Template | string | swiss-single | Switches between swiss-single and swiss-two-column layouts. |
| Page Size | string | A4 | Sets the target page size for PDF output (A4 or LETTER). |
| Margins | number | 8mm | Sets the page margins for the PDF (range: 5-25mm). |
| Section Spacing | number (1-5) | 3 | Controls the vertical gap between major sections. |
| Item Spacing | number (1-5) | 2 | Controls the gap between items within a section (e.g., between two jobs). |
| Line Height | number (1-5) | 3 | Adjusts the line height of body text. |
| Base Font Size | number (1-5) | 3 | Scales the overall text size (maps to 11-16px). |
| Header Scale | number (1-5) | 3 | A multiplier for the main name and section header font sizes. |
| Header Font | string | serif | Sets the font family for headers (serif, sans-serif, mono). |
| Body Font | string | sans-serif | Sets the font family for body text (serif, sans-serif, mono). |
| Compact Mode | boolean | false | Applies a 0.6x multiplier to spacing and line-height for a denser layout. |
| Contact Icons | boolean | false | Toggles the display of icons next to contact information. |
Sources: AGENTS.md, apps/frontend/components/builder/resume-builder.tsx:64-74, apps/frontend/app/print/resumes/[id]/page.tsx:130-184
Styling with CSS Custom Properties
The template system's dynamism is powered by CSS custom properties (variables). The TemplateSettings object is converted into a style object and applied to the root .resume-body element. CSS rules within globals.css then use these variables to style the resume.
This approach allows for instant visual feedback in the preview pane as the user adjusts formatting controls, without needing to re-render the entire component tree.
Key CSS Variables
The following CSS variables are defined on the .resume-body element and drive the template's appearance.
| Variable | Purpose |
|---|---|
--section-gap | The margin between resume sections. |
--item-gap | The margin between items within a section. |
--line-height | The line height for body text. |
--font-size-base | The base font size from which other text sizes are calculated. |
--header-scale | A multiplier for the main name header size. |
--section-header-scale | A multiplier for section titles. |
--header-font | The font family for all headers. |
--body-font | The font family for all body text. |
--margin-top/bottom/left/right | Padding inside the resume container, which corresponds to the PDF margins. |
Sources: apps/frontend/app/(default)/css/globals.css:201-218
Example Usage
Helper classes use these variables with calc() to create a responsive typographic scale.
/* apps/frontend/app/(default)/css/globals.css:226-230 */
.resume-name {
font-size: calc(var(--font-size-base) * var(--header-scale));
font-family: var(--header-font);
font-weight: 700;
}
This ensures that when the user changes the "Base Font Size" or "Header Scale", the name's font size updates automatically.
Sources: apps/frontend/app/(default)/css/globals.css:226-230
PDF Generation Flow
Generating a PDF uses the same template components but in a different context. The handleDownload function in the ResumeBuilder initiates the process by making an API call with the template settings serialized as URL query parameters.
The following sequence diagram shows the end-to-end flow for PDF generation.
The downloadResumePdf function in resume.ts is responsible for creating the parameterized URL.
// apps/frontend/lib/api/resume.ts:161-187
export async function downloadResumePdf(
resumeId: string,
settings?: TemplateSettings
): Promise<Blob> {
const params = new URLSearchParams();
if (settings) {
params.set('template', settings.template);
params.set('pageSize', settings.pageSize);
params.set('marginTop', String(settings.margins.top));
// ... other settings
params.set('showContactIcons', String(settings.showContactIcons));
} else {
params.set('template', 'swiss-single');
params.set('pageSize', 'A4');
}
const res = await apiFetch(`/resumes/${encodeURIComponent(resumeId)}/pdf?${params.toString()}`);
if (!res.ok) {
const text = await res.text().catch(() => '');
throw new Error(`Failed to download resume (status ${res.status}): ${text}`);
}
return await res.blob();
}
Sources: apps/frontend/lib/api/resume.ts:161-187, apps/frontend/components/builder/resume-builder.tsx:300-318, apps/frontend/app/print/resumes/[id]/page.tsx
Summary
The resume template and customization system is a well-architected feature that provides users with significant control over their resume's final appearance. By leveraging CSS custom properties, it offers a responsive live preview experience. The separation of concerns between the client-side builder and the server-side PDF generation ensures that the output is both accurate and high-quality. This modular design allows for easy maintenance and future expansion, such as the addition of new templates or formatting options.