Architecture Overview
Relevant source files
The following files were used as context for generating this wiki page:
Resume Matcher is a full-stack application designed to help users tailor their resumes for specific job applications using AI. The architecture follows a modern two-tier model, comprising a Next.js frontend for the user interface and a Python-based FastAPI backend that handles business logic, data persistence, and AI integration. This separation allows for independent development, scaling, and deployment of the client and server components.
The system is designed for flexibility, supporting both local and cloud-based AI models through a unified interface. Data is stored in a simple, file-based JSON database (TinyDB), making local setup straightforward. The application also provides containerized deployment options using Docker. For more detailed information, refer to the Backend Guide and Frontend Workflow documents.
Sources: AGENTS.md, SETUP.md, README.md
High-Level System Design
The application consists of a frontend client, a backend API server, a file-based database, and an external or local AI provider. The user interacts with the Next.js frontend, which communicates with the FastAPI backend via a REST API. The backend processes requests, interacts with the TinyDB database for storage, and makes calls to an AI service (like OpenAI, Anthropic, or a local Ollama instance) for tasks like resume parsing and content generation.
The diagram below illustrates the main components and their interactions.
Frontend Architecture (apps/frontend/)
The frontend is a Next.js application built with React and TypeScript. It is responsible for all user-facing views, state management, and communication with the backend API. The styling is implemented using Tailwind CSS, following a "Swiss International Style" design system.
Key Components & Structure
| Directory/File | Description |
|---|---|
app/ | Contains the Next.js App Router pages for different views like Dashboard, Builder, Tailor, and Settings. |
components/ | Houses reusable React components used across the application, such as UI elements and resume templates. |
lib/ | Includes utility functions, API clients (lib/api/), and custom React hooks for managing application state. |
messages/ | Stores JSON files for internationalization (i18n), with separate files for each supported language (e.g., en.json, es.json). |
app/(default)/css/globals.css | Defines global styles, Tailwind CSS configuration, and CSS variables for resume templates. |
Sources: AGENTS.md, apps/frontend/messages/en.json, apps/frontend/app/(default)/css/globals.css
Resume Templates & Styling
The application supports multiple resume templates (swiss-single, swiss-two-column) that are styled using CSS custom properties. This allows for dynamic control over formatting aspects like margins, font sizes, and spacing directly from the UI.
The styling is controlled by a set of CSS variables defined in globals.css.
| Variable | Example | Purpose |
|---|---|---|
--section-gap | 1rem | Spacing between major resume sections. |
--item-gap | 0.25rem | Spacing between items within a section. |
--font-size-base | 14px | The base font size for the resume body. |
--header-scale | 2 | Multiplier for the main header (name) font size. |
--header-font | ui-serif | Font family for headers. |
--body-font | ui-sans-serif | Font family for body text. |
--margin-top | 10mm | Top page margin for PDF generation. |
Sources: AGENTS.md:Resume Template Settings, apps/frontend/app/(default)/css/globals.css:201-220, apps/frontend/components/resume/resume-single-column.tsx, apps/frontend/components/resume/resume-two-column.tsx
Backend Architecture (apps/backend/)
The backend is a lightweight FastAPI application written in Python. It serves as the API layer, handling all business logic, data persistence, and interactions with AI models.
Key Components & Structure
| Directory/File | Description |
|---|---|
app/main.py | The main entry point for the FastAPI application, where routers and CORS middleware are configured. |
app/routers/ | Defines the API endpoints. For example, resumes.py handles all resume-related operations. |
app/services/ | Contains the core business logic, such as the resume parser (parser.py) and improver (improver.py). |
app/prompts/ | Stores LLM prompt templates used for various AI tasks like parsing, improving, and generating content. |
app/llm.py | A wrapper around the LiteLLM library, providing a unified interface for calling different AI providers. |
app/database.py | A wrapper for TinyDB, which provides a simple, file-based JSON database. |
app/pdf.py | Contains logic for rendering PDFs using Playwright to take a screenshot of a frontend page. |
data/ | The directory where TinyDB stores its JSON database files (auto-created). |
.env.example | A template for environment variables, including AI provider configuration. |
Sources: AGENTS.md:Project Structure & Module Organization, SETUP.md:Project Structure Overview, INSTALL.md:Project Structure
Data Storage
The application uses TinyDB, a lightweight, document-oriented database that stores data in a JSON file (apps/backend/data/database.json). This simplifies local setup as it requires no external database server. The app/database.py file provides a wrapper around TinyDB for creating, reading, updating, and deleting records for resumes, jobs, and other entities.
Sources: SETUP.md:Database Management, AGENTS.md:Backend (apps/backend/)
AI & LLM Integration
A core feature of the application is its integration with Large Language Models (LLMs) for intelligent resume processing. The backend uses the LiteLLM library to provide a unified API for interacting with a wide range of AI providers.
Sources: AGENTS.md:LLM & AI Workflow Notes, README.md:Supported AI Providers
Supported Providers
The system supports both cloud-based and local AI models. Configuration is managed via the frontend Settings page or the backend .env file.
| Provider | Type | Example Model |
|---|---|---|
| Ollama | Local | llama3.2 |
| OpenAI | Cloud | gpt-4o-mini |
| Anthropic | Cloud | claude-3-5-sonnet |
| Google Gemini | Cloud | gemini-1.5-flash |
| OpenRouter | Cloud | anthropic/claude-3.5-sonnet |
| DeepSeek | Cloud | deepseek-chat |
Sources: README.md:Supported AI Providers, INSTALL.md:Supported LLM Providers, apps/frontend/app/(default)/settings/page.tsx:39-46
LLM Workflow: Resume Tailoring
The resume tailoring process is a key AI-driven workflow. When a user provides a master resume and a job description, the backend orchestrates a series of LLM calls to generate a new, optimized resume.
The following sequence diagram shows the flow for the POST /resumes/improve endpoint.
Core Workflows
Resume Upload and Parsing
Users can upload their resume as a PDF or DOCX file. The backend processes the file, converts it to Markdown, and then uses an LLM to parse it into a structured JSON format.
This diagram shows the flow for the POST /resumes/upload endpoint.
PDF Generation
The application generates professional-looking PDFs for resumes and cover letters. The backend uses Playwright to launch a headless Chromium browser, navigate to a special print-optimized page on the frontend, and save the rendered output as a PDF. This approach ensures that the PDF perfectly matches what the user sees in the preview.
This diagram illustrates the PDF generation process.
Internationalization (i18n)
The application is designed to support multiple languages for both the user interface and the AI-generated content.
- UI Language: The interface text (labels, buttons, etc.) is translated using JSON files stored in
apps/frontend/messages/. The user can select their preferred UI language in the Settings page. - Content Language: The language for AI-generated content (like tailored resumes and cover letters) is configured separately. This language code is passed to the backend and inserted into the LLM prompts using an
{output_language}placeholder.
| Language | Code | UI Support | Content Generation |
|---|---|---|---|
| English | en | Yes | Yes |
| Spanish | es | Yes | Yes |
| Chinese | zh | Yes | Yes |
| Japanese | ja | Yes | Yes |
Sources: AGENTS.md:Internationalization (i18n), apps/frontend/messages/en.json, apps/frontend/messages/zh.json, apps/backend/app/prompts/templates.py:4-14, IMPROVE_RESUME_PROMPT
Summary
The Resume Matcher architecture is a well-defined, two-tier system that effectively separates frontend presentation from backend logic. Its use of a lightweight stack (FastAPI, TinyDB) and containerization (Docker) simplifies local setup and deployment. The modular design, particularly the LiteLLM integration, provides significant flexibility in choosing AI providers. Key workflows like resume parsing, tailoring, and PDF generation are robustly implemented, leveraging modern tools like Playwright for high-fidelity output. The thoughtful inclusion of internationalization ensures the application is accessible to a global audience.