Building an AI-Powered Resume Builder with Tambo AI and React PDF

Today we're going to see how to start with a basic AI chatbot and add in tools and custom UI components. For this tutorial we'll add a resume builder tool and a live preview component along with pdf export to give a chatbot resume-building abilities in about 30 minutes.
1. Create a New Tambo App
We'll start by creating a new Tambo app (Tambo is an open source generative UI framework):
npx tambo create-app my-cursor-for-resumes
cd my-cursor-for-resumes
npx tambo init
Once you have your Tambo project set up, you can delete a few of the template files from the example:
rm src/components/ui/card-data.tsx src/services/population-stats.ts
2. Define Resume Types
Let's define a few types which we'll use later, put these into src/lib/resume.ts:
import { z } from "zod";
export const HeaderSectionSchema = z.object({
name: z.string(),
bio: z.string(),
location: z.string().optional(),
contacts: z.object({
website: z.string().optional(),
email: z.string().optional(),
phone: z.string().optional(),
linkedin: z.string().optional(),
github: z.string().optional(),
}),
});
export const WorkExperienceSectionSchema = z.array(
z.object({
company: z.string(),
title: z.string(),
location: z.string(),
start: z.string(),
end: z.string().optional().nullable(),
description: z.string(),
}),
);
export const ResumeDataSchema = z.object({
header: HeaderSectionSchema,
workExperience: WorkExperienceSectionSchema,
// rest of the schema
});
export type ResumeDataSchemaType = z.infer<typeof ResumeDataSchema>;
3. Create a PDF Parsing Service
Let's add the ability to parse uploaded PDF resumes using Google Gemini. We'll use pdf-ts to extract text and Vercel AI SDK to process it.
First, install the required dependencies:
npm install pdf-ts @ai-sdk/google ai dedent
Here's our PDF parsing implementation from src/lib/server/parse-pdf.ts:
import { pdfToText } from "pdf-ts";
export async function parsePdf(pdfUrl: string) {
const pdfFetch = await fetch(pdfUrl);
const pdf = await pdfFetch.arrayBuffer();
const text = await pdfToText(new Uint8Array(pdf));
return text;
}
And here's our AI-powered resume generation from src/lib/server/ai/generate-resume-object.ts:
"use server";
import { generateObject } from "ai";
import { google } from "@ai-sdk/google";
import { ResumeDataSchema } from "../../resume";
import dedent from "dedent";
export async function generateResumeObject(resumeText: string) {
try {
const startTime = Date.now();
const { object } = await generateObject({
model: google("gemini-2.5-flash"),
schema: ResumeDataSchema,
maxRetries: 1,
mode: "json",
prompt:
dedent(`You are an expert resume writer. Generate a resume object from the following resume text. Be professional and concise.
## Instructions:
- If the resume text does not include an 'about' section or specfic skills mentioned, please generate appropriate content for these sections based on the context of the resume and based on the job role.
- For the about section: Create a professional summary that highlights the candidate's experience, expertise, and career objectives.
- For the skills: Generate a maximum of 10 skills taken from the ones mentioned in the resume text or based on the job role / job title infer some if not present.
- If the resume doesn't contain the full link to social media website leave the username/link as empty strings to the specific social meda websites. The username never contains any space so make sure to only return the full username for the website otherwise don't return it.
## Resume text:
${resumeText}
`),
});
const endTime = Date.now();
console.log(
`Generating resume object took ${(endTime - startTime) / 1000} seconds`,
);
return object;
} catch (error) {
console.error("Impossible generating resume object", error);
return undefined;
}
}
4. Create a Resume Data Service
Now, let's create a comprehensive service that handles resume data management and PDF upload. This will integrate with our Zustand store for state management.
First, let’s install Zustand:
npm install zustand
Now let's look at our store structure in src/store/resume-store.ts:
import { create } from "zustand";
import { persist, createJSONStorage } from "zustand/middleware";
import { ResumeDataSchemaType } from "@/lib/resume";
interface ResumeStore {
resumeData: ResumeDataSchemaType | null;
isLoading: boolean;
error: string | null;
setResumeData: (data: ResumeDataSchemaType) => void;
clearResumeData: () => void;
setLoading: (loading: boolean) => void;
setError: (error: string | null) => void;
}
export const useResumeStore = create<ResumeStore>()(
persist(
(set) => ({
resumeData: null,
isLoading: false,
error: null,
setResumeData: (data) => set({ resumeData: data, error: null }),
clearResumeData: () => set({ resumeData: null, error: null }),
setLoading: (loading) => set({ isLoading: loading }),
setError: (error) => set({ error }),
}),
{
name: "resume-storage",
storage: createJSONStorage(() => localStorage),
partialize: (state) => ({
resumeData: state.resumeData,
}),
},
),
);
5. Build Interactable Components
For the next step, we'll create interactable components that the Tambo can control. Let's build the header component that displays personal information and contact details.
Here's the actual implementation from src/components/resume/header.tsx:
import { z } from "zod";
import { GlobeIcon, MailIcon, PhoneIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { HeaderSectionSchema, ResumeDataSchemaType } from "@/lib/resume";
import { useMemo } from "react";
import { Icons } from "../icons";
import { withInteractable } from "@tambo-ai/react";
import { cn } from "@/lib/utils";
interface HeaderProps {
header: ResumeDataSchemaType["header"];
className?: string;
}
/**
* Header component displaying personal information and contact details
*/
export function Header({ header, className }: HeaderProps) {
if (!header) {
return null;
}
return (
<header
className={cn(
"flex items-start md:items-center justify-between gap-4",
className,
)}
>
<div className="flex-1 space-y-1.5">
<h1 className="text-2xl font-bold" id="resume-name">
{header.name}
</h1>
<p
className="max-w-md text-pretty text-sm print:text-[12px] text-neutral-500"
aria-labelledby="resume-name"
>
{header.bio}
</p>
{/* Rest of the component */}
</header>
);
}
export const InteractableHeader = withInteractable(Header, {
componentName: "Header",
description: "Header section with personal information",
propsSchema: z.object({
header: HeaderSectionSchema,
picture: z.string().optional().describe("URL of the profile picture"),
}),
});
6. Export PDF with React PDF
Now let's add the ability to export your resume as a professional PDF. We'll use React PDF to create a beautifully formatted document that matches your web preview.
First, install React PDF:
npm install @react-pdf/renderer
Here's our complete PDF rendering implementation at src/components/resume/resume-pdf.tsx:
"use client";
import {
Document,
Page,
Text,
View,
StyleSheet,
Link,
} from "@react-pdf/renderer";
import { ResumeDataSchemaType, getShortMonth, getYear } from "@/lib/resume";
const styles = StyleSheet.create({
page: {
padding: 30,
fontSize: 12,
fontFamily: "Helvetica",
},
name: {
fontSize: 24,
fontWeight: "bold",
marginBottom: 5,
},
bio: {
fontSize: 11,
color: "#6b7280",
marginBottom: 5,
},
// rest of the styles
});
interface ResumePDFProps {
resume: ResumeDataSchemaType;
}
export function ResumePDF({ resume }: ResumePDFProps) {
return (
<Document>
<Page size="A4" style={styles.page}>
{/* Header */}
<View style={styles.section}>
<Text style={styles.name}>{resume.header.name || "Your Name"}</Text>
{resume.header.bio && (
<Text style={styles.bio}>{resume.header.bio}</Text>
)}
{resume.header.location && (
<Text style={styles.location}>{resume.header.location}</Text>
)}
{/* Experience */}
{resume.workExperience.length > 0 && (
<View style={styles.section}>
<Text style={styles.sectionTitle}>Work Experience</Text>
{resume.workExperience.map(
(
exp: ResumeDataSchemaType["workExperience"][0],
index: number,
) => {
const formattedDate = `${getShortMonth(exp.start)} ${getYear(
exp.start,
)} - ${
exp.end
? `${getShortMonth(exp.end)} ${getYear(exp.end)}`
: "Present"
}`;
return (
<View key={index} style={styles.experienceItem}>
<View style={styles.experienceHeader}>
<View style={styles.titleLocationContainer}>
<Text style={styles.jobTitle}>{exp.title}</Text>
{exp.location && (
<Text style={styles.locationBadge}>
{exp.location}
</Text>
)}
</View>
<Text style={styles.formattedDate}>{formattedDate}</Text>
</View>
<View style={styles.companyContractContainer}>
<Text style={styles.company}>
{exp.company.toLowerCase()}
</Text>
{exp.company && exp.contract && (
<Text style={styles.separator}>•</Text>
)}
{exp.contract && (
<Text style={styles.contract}>{exp.contract}</Text>
)}
</View>
{exp.description && (
<Text style={styles.description}>{exp.description}</Text>
)}
</View>
);
},
)}
</View>
)}
// rest of the code
</Page>
</Document>
);
}
Now let's create a PDF download component at src/components/resume-action-bar.tsx:
"use client";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { Download, Loader2 } from "lucide-react";
import { pdf } from "@react-pdf/renderer";
import { ResumePDF } from "./resume-pdf";
import { ResumeDataSchemaType } from "@/lib/resume";
interface ResumeActionBarProps {
resume: ResumeDataSchemaType;
}
export function ResumeActionBar({ resume }: ResumeActionBarProps) {
const [isGenerating, setIsGenerating] = useState(false);
const downloadPDF = async () => {
try {
setIsGenerating(true);
// Generate PDF blob
const blob = await pdf(<ResumePDF resume={resume} />).toBlob();
// Create download link
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = `${resume.header.name || "resume"}.pdf`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
} catch (error) {
console.error("Error generating PDF:", error);
} finally {
setIsGenerating(false);
}
};
return (
<div className="sticky top-0 z-10 bg-white border-b p-4">
<div className="flex justify-between items-center">
<h1 className="text-xl font-semibold">Resume Builder</h1>
<Button
onClick={downloadPDF}
disabled={isGenerating}
className="flex items-center gap-2"
>
{isGenerating ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
<Download className="w-4 h-4" />
)}
{isGenerating ? "Generating..." : "Download PDF"}
</Button>
</div>
</div>
);
}
6. Create the Chat Interface
Now let's create the main chat page that brings everything together:
export default function ChatPage() {
const { resumeData } = useResumeStore();
return (
<TamboProvider
apiKey={process.env.NEXT_PUBLIC_TAMBO_API_KEY!}
components={components}
tools={tools}
>
<main className="flex h-screen">
{/* Chat Interface */}
<div className="flex-1">
<MessageThreadFull
hideHistory
className="h-full"
contextKey="resume-builder"
/>
</div>
{/* Resume */}
<div className="flex-1 overflow-auto">
{resumeData && <ResumeActionBar resume={resumeData} />}
<div className="p-4">
<FullResume resume={resumeData} />
</div>
</div>
</main>
</TamboProvider>
);
}
Conclusion
That's it! Your AI-powered resume builder should work now (or let me know 😉). For the full code, please checkout Aniket-508/openself. There's a lot more that can be added such as more resume sections, and enhanced styling.
Join the Tambo Discord to see more projects you can build with Tambo!
About the author
Wannabe professional software developer
Comments
Join the discussionNo comments yet. Be the first to comment.
