Creating Custom Resume Templates
Relevant source files
The following files were used as context for generating this wiki page:- AGENTS.md
- apps/frontend/app/(default)/css/globals.css
- apps/frontend/app/print/resumes/[id]/page.tsx
- apps/frontend/components/builder/resume-builder.tsx
- apps/frontend/components/dashboard/resume-component.tsx
- apps/frontend/components/resume/resume-single-column.tsx
- apps/frontend/components/resume/resume-two-column.tsx
- apps/frontend/lib/api/resume.ts
The Resume Matcher application features a flexible resume template system that allows users to select from predefined layouts and extensively customize the formatting. This system is designed to provide real-time visual feedback in the Resume Builder and generate pixel-perfect PDFs for export. The core of this system relies on React components for structure, CSS custom properties for dynamic styling, and a dedicated print-optimized page for PDF generation.
The architecture separates resume data, template structure, and styling, enabling easy extension with new templates or formatting options in the future. All styling is driven by a TemplateSettings object managed within the ResumeBuilder component.
Sources: AGENTS.md, apps/frontend/components/builder/resume-builder.tsx:30-32
System Architecture
The template system is primarily composed of frontend components that work together to render the resume preview. The ResumeBuilder is the central orchestrator, managing the templateSettings state. These settings are passed down to the Resume component, which then selects the appropriate template (ResumeSingleColumn or ResumeTwoColumn) and applies the styling via CSS variables.
Sources: apps/frontend/components/builder/resume-builder.tsx:90-93, apps/frontend/components/dashboard/resume-component.tsx:110-113
The following diagram illustrates the data flow from user interaction in the FormattingControls to the final rendered preview.
Available Templates
The application provides two distinct "Swiss" style resume templates.
| Template ID | Component | Description |
|---|---|---|
swiss-single | ResumeSingleColumn | A traditional, single-column layout that stacks all sections vertically. It is optimized for content density and detailed descriptions. |
swiss-two-column | ResumeTwoColumn | A modern 65%/35% split layout. The main column contains experience and projects, while the sidebar holds skills, summary, and other supporting information. |
Sources: AGENTS.md, apps/frontend/components/resume/resume-single-column.tsx:15-20, apps/frontend/components/resume/resume-two-column.tsx:13-21
Formatting Controls
Users can modify the appearance of the selected template using the controls in the FormattingControls component. These settings are stored in a TemplateSettings object.
| Control | UI Component | Range/Options | Default | Effect |
|---|---|---|---|---|
| Margins | Slider | 5-25mm | 8mm | Sets the page margins for PDF export. |
| Section Spacing | Slider | 1-5 | 3 | Controls the vertical gap between major sections. |
| Item Spacing | Slider | 1-5 | 2 | Controls the gap between items within a section (e.g., between two jobs). |
| Line Height | Slider | 1-5 | 3 | Adjusts the line height of body text. |
| Base Font Size | Slider | 1-5 | 3 | Scales the overall text size (maps to 11-16px). |
| Header Scale | Slider | 1-5 | 3 | A multiplier for the main name and section header font sizes. |
| Header Font | Dropdown | serif, sans-serif, mono | serif | Font family for the main name and section titles. |
| Body Font | Dropdown | serif, sans-serif, mono | sans-serif | Font family for all body text. |
| Compact Mode | Switch | true/false | false | Applies a 0.6x multiplier to spacing and line-height for a denser layout. |
| Contact Icons | Switch | true/false | false | Toggles visibility of icons next to contact information. |
Sources: AGENTS.md, apps/frontend/lib/api/resume.ts:182-198
The state for these settings is managed within the ResumeBuilder component and persisted to localStorage to be remembered across sessions.
Sources: apps/frontend/components/builder/resume-builder.tsx:31, 102-117
Styling with CSS Variables
The template system's flexibility comes from its use of CSS custom properties (variables). The base styles and variables are defined in globals.css.
When the TemplateSettings change, the main Resume component converts these settings into an inline style object, which overrides the default CSS variables. This mechanism allows for real-time updates in the preview without needing to reload stylesheets.
Sources: apps/frontend/app/(default)/css/globals.css:218-237, apps/frontend/components/dashboard/resume-component.tsx:122-125
Key CSS Variables
| Variable | Controlled By | Description |
|---|---|---|
--section-gap | Section Spacing | Gap between resume sections. |
--item-gap | Item Spacing | Gap between items within a section. |
--line-height | Line Height | Line height for body text. |
--font-size-base | Base Font Size | The base font size from which other text sizes are calculated. |
--header-scale | Header Scale | Multiplier for the main name font size. |
--section-header-scale | Header Scale | Multiplier for section title font size. |
--header-font | Header Font | font-family for headers. |
--body-font | Body Font | font-family for body text. |
--margin-top/bottom/left/right | Margins | Padding inside the resume container for preview. |
Sources: apps/frontend/app/(default)/css/globals.css:220-237
Example: CSS Variable Definition
The following snippet from globals.css shows how the default variables are defined for the .resume-body class.
/* apps/frontend/app/(default)/css/globals.css:218-237 */
.resume-body {
/* Spacing defaults (can be overridden via inline styles) */
--section-gap: 1rem;
--item-gap: 0.25rem;
--line-height: 1.35;
--font-size-base: 14px;
--header-scale: 2;
--section-header-scale: 1.2;
--header-font: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
--body-font: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
/* Margin defaults - used as padding inside the resume container */
--margin-top: 10mm;
--margin-bottom: 10mm;
--margin-left: 10mm;
--margin-right: 10mm;
}
PDF Generation and Settings
To ensure the exported PDF perfectly matches the customized preview, the template settings are passed as URL query parameters to a dedicated print page at /print/resumes/[id]. The backend's PDF generation service (using Playwright) visits this URL to render the resume.
Sources: apps/frontend/lib/api/resume.ts:178-206, apps/frontend/app/print/resumes/[id]/page.tsx:15-32
PDF Generation Flow
This diagram shows the sequence of events when a user clicks the "Download" button.
Parsing Settings on the Print Page
The server-side component for the print page is responsible for parsing the URL query parameters back into a TemplateSettings object. This ensures the headless browser renders the resume with the exact same styles selected by the user.
// apps/frontend/app/print/resumes/[id]/page.tsx:110-161
export default async function PrintResumePage({ params, searchParams }: PageProps) {
// ... fetch resume data
// Parse template settings from query params
const settings: TemplateSettings = {
template: parseTemplate(resolvedSearchParams?.template),
pageSize: parsePageSize(resolvedSearchParams?.pageSize),
margins: {
top: parseMargin(resolvedSearchParams?.marginTop, DEFAULT_TEMPLATE_SETTINGS.margins.top),
bottom: parseMargin(
resolvedSearchParams?.marginBottom,
DEFAULT_TEMPLATE_SETTINGS.margins.bottom
),
// ... more margins
},
spacing: {
section: parseSpacingLevel(
resolvedSearchParams?.sectionSpacing,
DEFAULT_TEMPLATE_SETTINGS.spacing.section
),
// ... more spacing
},
fontSize: {
base: parseSpacingLevel(
resolvedSearchParams?.fontSize,
DEFAULT_TEMPLATE_SETTINGS.fontSize.base
),
// ... more font settings
},
compactMode: parseBoolean(
resolvedSearchParams?.compactMode,
DEFAULT_TEMPLATE_SETTINGS.compactMode
),
showContactIcons: parseBoolean(
resolvedSearchParams?.showContactIcons,
DEFAULT_TEMPLATE_SETTINGS.showContactIcons
),
};
// ... render Resume component with settings
}
This robust system ensures that what the user sees in the builder is exactly what they get in the final PDF, providing a consistent and reliable user experience.