### Basic Subscription Modal Usage (React/TypeScript) Source: https://github.com/jassbawa/resumate/blob/main/SUBSCRIPTION_MODAL_FIXES.md Demonstrates the basic usage of the SubscriptionModal component in a React application using TypeScript. It shows how to control the modal's visibility and handle success and cancel events. This example assumes the component is imported from '@/components/payment/SubscriptionModal'. ```tsx import { SubscriptionModal } from '@/components/payment/SubscriptionModal'; function App() { const [showModal, setShowModal] = useState(false); return ( { console.log('Payment successful!'); setShowModal(false); }} onCancel={() => { console.log('Payment cancelled'); setShowModal(false); }} /> ); } ``` -------------------------------- ### Custom Subscription Plan Configuration (React/TypeScript) Source: https://github.com/jassbawa/resumate/blob/main/SUBSCRIPTION_MODAL_FIXES.md Illustrates how to configure a custom subscription plan for the SubscriptionModal component. This example defines a `customPlan` object with specific properties like id, name, price, period, and features, and then passes it to the modal for a 'purchase' mode. It highlights the flexibility in defining plan details. ```tsx const customPlan = { id: 'yearly', name: 'Pro Yearly', price: 999, period: 'year' as const, features: ['All Pro features', 'Priority support', '2 months free'], popular: true, }; ; ``` -------------------------------- ### Define User Model and Query/Update Operations (TypeScript - Prisma) Source: https://context7.com/jassbawa/resumate/llms.txt Defines the Prisma schema for the User model, including fields for authentication, subscription status, and payment history. Provides example queries to retrieve user data with related threads and payment history, and an example to update user subscription details. ```typescript // Prisma schema model User { id String @id @default(cuid()) name String clerkId String @unique email String threads Thread[] isSubscribed Boolean @default(false) subscriptionId String? @unique razorpayCustomerId String? subscriptionEndDate DateTime? paymentHistory Payment[] createdAt DateTime @default(now()) } // Query examples const user = await prisma.user.findUnique({ where: { clerkId: userId }, include: { threads: { orderBy: { updatedAt: 'desc' }, take: 10 }, paymentHistory: { where: { status: 'COMPLETED' }, orderBy: { createdAt: 'desc' } } } }); // Update subscription await prisma.user.update({ where: { id: user.id }, data: { isSubscribed: true, subscriptionEndDate: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000), subscriptionId: paymentId } }); ``` -------------------------------- ### Get All Threads Source: https://context7.com/jassbawa/resumate/llms.txt Retrieves a list of all resume threads associated with the currently authenticated user. ```APIDOC ## GET /api/threads ### Description Retrieves all resume threads for the authenticated user. ### Method GET ### Endpoint /api/threads ### Parameters #### Query Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., 'Bearer '). ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **data** (array) - An array of resume thread objects. - Each object contains: - **id** (string) - Unique identifier for the thread. - **title** (string) - The title of the thread. - **userId** (string) - The ID of the user who owns the thread. - **parsedSections** (object) - Object containing parsed resume data. - **createdAt** (string) - Timestamp of creation. - **updatedAt** (string) - Timestamp of last update. #### Response Example ```json { "success": true, "data": [ { "id": "clxyz123", "title": "Software Engineer Resume", "userId": "user_123", "parsedSections": { /* resume data */ }, "createdAt": "2024-01-15T10:30:00.000Z", "updatedAt": "2024-01-15T10:30:00.000Z" } ] } ``` ``` -------------------------------- ### Get Resume Versions Source: https://context7.com/jassbawa/resumate/llms.txt Retrieves the complete version history for a specific resume thread, showing all past changes and their associated diffs. ```APIDOC ## GET /api/threads/[id]/versions ### Description Retrieves all version history for a given resume thread, including details about each change. ### Method GET ### Endpoint /api/threads/{id}/versions ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the thread whose versions are to be retrieved. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **versions** (array) - An array of version objects, ordered chronologically or by version number. - Each object contains: - **id** (string) - Unique identifier for the version. - **threadId** (string) - The ID of the thread this version belongs to. - **title** (string) - A descriptive title for the version (e.g., timestamp). - **diff** (object) - A JSON object representing the differences from the previous version. - **createdAt** (string) - Timestamp when this version was created. #### Response Example ```json { "success": true, "versions": [ { "id": "ver_123", "threadId": "clxyz123", "title": "Changes at 1/15/2024, 2:30:00 PM", "diff": { /* JSON diff object */ }, "createdAt": "2024-01-15T14:30:00.000Z" }, { "id": "ver_122", "threadId": "clxyz123", "title": "Initial full version", "diff": { /* JSON diff object */ }, "createdAt": "2024-01-15T10:30:00.000Z" } ] } ``` ``` -------------------------------- ### Get All Resume Threads API Endpoint Source: https://context7.com/jassbawa/resumate/llms.txt Retrieves all resume threads associated with the authenticated user. This endpoint requires an authorization token and returns a list of resume thread objects, including their details and creation timestamps. ```typescript GET /api/threads const response = await fetch('/api/threads', { method: 'GET', headers: { 'Authorization': 'Bearer ' } }); const result = await response.json(); // { "success": true, // "data": [ // { // "id": "clxyz123", // "title": "Software Engineer Resume", // "userId": "user_123", // "parsedSections": { /* resume data */ }, // "createdAt": "2024-01-15T10:30:00.000Z", // "updatedAt": "2024-01-15T10:30:00.000Z" // } // ] // } ``` -------------------------------- ### Define ResumeVersion Model and Create Operation (TypeScript - Prisma) Source: https://context7.com/jassbawa/resumate/llms.txt Defines the Prisma schema for ResumeVersion, which stores historical differences or versions of a resume. It links to a Thread and contains a JSON field for the difference (diff) and a title. An example demonstrates creating a new resume version with computed differences. ```typescript model ResumeVersion { id String @id @default(cuid()) threadId String diff Json title String thread Thread @relation(fields: [threadId], references: [id]) createdAt DateTime @default(now()) } // Create version with diff const version = await prisma.resumeVersion.create({ data: { threadId: thread.id, diff: computedDiff, title: 'Added quantified achievements' } }); ``` -------------------------------- ### Define Thread Model and Query Operation (TypeScript - Prisma) Source: https://context7.com/jassbawa/resumate/llms.txt Defines the Prisma schema for the Thread model, which represents a conversation or document context. It includes fields for thread details, file association, sharing status, and parsed content. An example query demonstrates retrieving a thread with its associated resume versions, ordered chronologically. ```typescript model Thread { id String @id @default(cuid()) title String userId String fileId String publicId String @unique @default(cuid()) isSharable Boolean @default(false) viewerCount Int @default(0) resumeText String parsedSections Json openaiThreadId String? versions ResumeVersion[] user User @relation(fields: [userId], references: [id]) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } // Query with versions const thread = await prisma.thread.findUnique({ where: { id: threadId }, include: { versions: { orderBy: { createdAt: 'asc' } } } }); ``` -------------------------------- ### Get Resume Versions API Endpoint Source: https://context7.com/jassbawa/resumate/llms.txt Retrieves the version history for a specific resume thread. This endpoint is crucial for tracking changes and allowing users to revert to previous states of their resume. It returns a list of version objects, each containing a diff. ```typescript GET /api/threads/[id]/versions const response = await fetch(`/api/threads/${threadId}/versions`); const result = await response.json(); // { "success": true, // "versions": [ // { // "id": "ver_123", // "threadId": "clxyz123", // "title": "Changes at 1/15/2024, 2:30:00 PM", // "diff": { /* JSON diff object */ }, // "createdAt": "2024-01-15T14:30:00.000Z" // }, // { // "id": "ver_122", // "threadId": "clxyz123", // "title": "Initial full version", // "diff": { /* JSON diff object */ }, // "createdAt": "2024-01-15T10:30:00.000Z" // } // ] // } ``` -------------------------------- ### Define Payment Model and Update Operation (TypeScript - Prisma) Source: https://context7.com/jassbawa/resumate/llms.txt Defines the Prisma schema for the Payment model, tracking payment transactions including order IDs, amounts, currency, and status. It includes an enum for PaymentStatus. An example shows how to verify and update a payment record to 'COMPLETED' status upon successful transaction. ```typescript model Payment { id String @id @default(cuid()) userId String razorpayOrderId String @unique razorpayPaymentId String? amount Int // paise currency String @default("INR") status PaymentStatus @default(PENDING) planType String user User @relation(fields: [userId], references: [id]) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } enum PaymentStatus { PENDING COMPLETED FAILED REFUNDED } // Verify and complete payment const payment = await prisma.payment.update({ where: { razorpayOrderId: orderId }, data: { status: 'COMPLETED', razorpayPaymentId: paymentId, updatedAt: new Date() } }); ``` -------------------------------- ### Core Service: Parse and Store Resume Source: https://context7.com/jassbawa/resumate/llms.txt Parses an uploaded resume file into a structured JSON format and creates the initial version of the resume. ```APIDOC ## Core Service: Parse and Store Resume ### Description Parses an uploaded resume file into structured JSON and creates the initial version of the resume. This service is typically called after a file upload. ### Method (This is a service function, not an HTTP endpoint. Example usage shown with `async/await`.) ### Endpoint N/A ### Parameters #### Function Parameters - **threadId** (string) - Required - The ID associated with the resume thread. ### Request Example (Conceptual Service Call) ```typescript import { parseAndStoreResume } from '@/services/resume.services'; const threadId = 'your_thread_id_here'; const result = await parseAndStoreResume(threadId); ``` ### Response #### Success Response Returns an object containing the resume thread details and the ID of the newly created version. - **thread** (object) - Details of the resume thread. - **id** (string) - The unique ID of the resume thread. - **parsedSections** (object) - A structured representation of the resume content, including: - **contactInfo** (object) - **summary** (object) - **skills** (object) - **workExperience** (array of objects) - **education** (array of objects) - ... (other potential resume sections) - **resumeText** (string) - The full extracted text content of the resume. - **openaiThreadId** (string) - The ID of the associated OpenAI thread. - **currentVersionId** (string) - The ID of the initial version created for this resume. #### Response Example ```json { "thread": { "id": "clxyz123", "parsedSections": { "contactInfo": { "data": { "name": "Jane Doe", "email": "jane@example.com", "phone": "+1-234-567-8900", "location": "New York, NY", "linkedin": "linkedin.com/in/janedoe" } }, "summary": { "data": { "summary": "Experienced Software Developer..." } }, "skills": { "data": { "skills": ["JavaScript", "React", "Node.js", "Python", "AWS"] } }, "workExperience": { "data": [ { "title": "Senior Software Engineer", "company": "TechCorp", "duration": "Jan 2023 - Present", "responsibilities": [ "Led development of microservices architecture", "Improved system performance by 60%" ] } ] }, "education": { "data": [ { "institution": "MIT", "degree": "B.S. Computer Science", "startDate": "Sep 2015", "endDate": "May 2019", "cgpa": "3.8" } ] } }, "resumeText": "Full extracted text...", "openaiThreadId": "thread_openai_abc123" }, "currentVersionId": "ver_123" } ``` ### Process Overview 1. Fetches the resume file from the OpenAI vector store. 2. Extracts the text content from the file. 3. Uses GPT-4o Mini with a specific parsing prompt to process the text. 4. Creates a structured JSON object from the GPT model's response. 5. Generates an initial difference (diff) representing the change from an empty state to the full resume. 6. Creates an OpenAI thread containing the parsed resume content. 7. Updates the database with the parsed sections and the associated OpenAI thread ID. ``` -------------------------------- ### POST /api/payments/create-order Source: https://context7.com/jassbawa/resumate/llms.txt Creates a Razorpay payment order for a pro subscription. ```APIDOC ## POST /api/payments/create-order ### Description Creates a Razorpay payment order for the pro subscription. ### Method POST ### Endpoint /api/payments/create-order ### Parameters (No parameters defined for this endpoint) ### Request Example (No request body example provided, typically none for this operation) ### Response #### Success Response (200) - **success** (boolean) - Indicates if the order creation was successful. - **data** (object) - Contains the details of the created payment order. - **id** (string) - The unique ID for the Razorpay order. - **amount** (number) - The amount to be paid in the smallest currency unit (e.g., paise for INR). - **currency** (string) - The currency of the transaction (e.g., 'INR'). - **receipt** (string) - A unique identifier for the receipt. - **status** (string) - The current status of the order (e.g., 'created'). #### Response Example ```json { "success": true, "data": { "id": "order_razorpay_123", "amount": 9900, "currency": "INR", "receipt": "order_user_123", "status": "created" } } ``` ### Usage Notes Use the returned `order_id` with the Razorpay checkout SDK. ``` -------------------------------- ### Create Resume Thread Source: https://context7.com/jassbawa/resumate/llms.txt Creates a new, empty thread for managing a resume. This initializes a space for resume content and its associated AI conversation. ```APIDOC ## POST /api/threads ### Description Creates a new empty thread for resume management. ### Method POST ### Endpoint /api/threads ### Parameters #### Request Body - **title** (string) - Required - The title for the new resume thread. ### Request Example ```json { "title": "Software Engineer Resume" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **data** (object) - Contains the details of the newly created thread. - **id** (string) - Unique identifier for the thread. - **title** (string) - The title of the thread. - **userId** (string) - The ID of the user who owns the thread. - **fileId** (string) - Identifier for any associated file. - **parsedSections** (object) - Object containing parsed resume sections. - **createdAt** (string) - Timestamp of creation. - **updatedAt** (string) - Timestamp of last update. #### Response Example ```json { "success": true, "data": { "id": "clxyz123...", "title": "Software Engineer Resume", "userId": "user_123", "fileId": "", "parsedSections": {}, "createdAt": "2024-01-15T10:30:00.000Z", "updatedAt": "2024-01-15T10:30:00.000Z" } } ``` ``` -------------------------------- ### Parse and Store Resume Service Source: https://context7.com/jassbawa/resumate/llms.txt Parses an uploaded resume file into a structured JSON format and creates the initial version of the resume. This service, `parseAndStoreResume`, fetches the file from OpenAI's vector store, extracts text, uses GPT-4o Mini for parsing, and updates the database with structured sections and an OpenAI thread ID. ```typescript import { parseAndStoreResume } from '@/services/resume.services'; // After file upload, call this service const result = await parseAndStoreResume(threadId); // Returns: // { // thread: { // id: "clxyz123", // parsedSections: { // contactInfo: { // data: { // name: "Jane Doe", // email: "jane@example.com", // phone: "+1-234-567-8900", // location: "New York, NY", // linkedin: "linkedin.com/in/janedoe" // } // }, // summary: { // data: { // summary: "Experienced Software Developer..." // } // }, // skills: { // data: { // skills: ["JavaScript", "React", "Node.js", "Python", "AWS"] // } // }, // workExperience: { // data: [ // { // title: "Senior Software Engineer", // company: "TechCorp", // duration: "Jan 2023 - Present", // responsibilities: [ // "Led development of microservices architecture", // "Improved system performance by 60%" // ] // } // ] // }, // education: { // data: [ // { // institution: "MIT", // degree: "B.S. Computer Science", // startDate: "Sep 2015", // endDate: "May 2019", // cgpa: "3.8" // } // ] // } // }, // resumeText: "Full extracted text…", // openaiThreadId: "thread_openai_abc123" // }, // currentVersionId: "ver_123" // } // Process: // 1. Fetches file from OpenAI vector store // 2. Extracts text content // 3. Uses GPT-4o Mini with parsing prompt // 4. Creates structured JSON from response // 5. Generates initial diff (from {} to full resume) // 6. Creates OpenAI thread with parsed content // 7. Updates database with parsed sections and thread ID ``` -------------------------------- ### Upload Resume to Thread Source: https://context7.com/jassbawa/resumate/llms.txt Uploads a resume file (PDF or DOCX) to a specified thread. The file is then automatically processed by the AI for parsing and storage. ```APIDOC ## PATCH /api/threads/[id]/upload-resume ### Description Uploads a PDF or DOCX resume file to an existing thread for parsing. The resume is automatically processed, parsed, and stored. ### Method PATCH ### Endpoint /api/threads/{id}/upload-resume ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the thread to upload the resume to. #### Request Body - **file** (File) - Required - The resume file (PDF or DOCX) to upload. ### Request Example ```javascript const formData = new FormData(); formData.append('file', resumeFile); // File object from input const response = await fetch(`/api/threads/${threadId}/upload-resume`, { method: 'PATCH', body: formData }); const result = await response.json(); ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the upload and initial processing were successful. #### Response Example ```json { "success": true } ``` ### Notes After upload, the resume is automatically: 1. Uploaded to OpenAI file storage. 2. Stored in OpenAI vector store for embeddings. 3. Parsed into structured JSON using GPT-4o Mini. 4. Saved with initial version in the database. ``` -------------------------------- ### Upload Resume to Thread API Endpoint Source: https://context7.com/jassbawa/resumate/llms.txt Uploads a resume file (PDF or DOCX) to an existing thread for parsing and storage. The uploaded file is processed by OpenAI for storage and embedding, then parsed into structured JSON and saved with version control. ```typescript PATCH /api/threads/[id]/upload-resume const formData = new FormData(); formData.append('file', resumeFile); // File object from input const response = await fetch(`/api/threads/${threadId}/upload-resume`, { method: 'PATCH', body: formData }); const result = await response.json(); // { "success": true } // After upload, the resume is automatically: // 1. Uploaded to OpenAI file storage // 2. Stored in OpenAI vector store for embeddings // 3. Parsed into structured JSON using GPT-4o Mini // 4. Saved with initial version in database ``` -------------------------------- ### POST /api/payments/verify Source: https://context7.com/jassbawa/resumate/llms.txt Verifies the Razorpay payment signature and activates the user's subscription. ```APIDOC ## POST /api/payments/verify ### Description Verifies the Razorpay payment signature and activates the user's subscription. This endpoint is called after the user completes the payment through Razorpay checkout. ### Method POST ### Endpoint /api/payments/verify ### Parameters #### Request Body - **orderCreationId** (string) - Required - The ID of the order created by the application. - **razorpayPaymentId** (string) - Required - The payment ID generated by Razorpay. - **razorpayOrderId** (string) - Required - The order ID generated by Razorpay. - **razorpaySignature** (string) - Required - The signature generated by Razorpay for payment verification. - **razorpayCustomerId** (string) - Required - The customer ID associated with the payment. ### Request Example ```json { "orderCreationId": "order_razorpay_123", "razorpayPaymentId": "pay_razorpay_456", "razorpayOrderId": "order_razorpay_123", "razorpaySignature": "generated_signature_hash", "razorpayCustomerId": "cust_razorpay_789" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the payment verification and subscription activation were successful. #### Response Example ```json { "success": true } ``` ### On Success - Payment status is updated to 'COMPLETED'. - User subscription is activated for 1 month. - `subscriptionEndDate` is set to the current date plus 1 month. ``` -------------------------------- ### Revert to Version Source: https://context7.com/jassbawa/resumate/llms.txt Reconstructs the resume state from its version history using diffs. This allows users to revert their resume to a previous state by applying the stored differences. ```APIDOC ## POST /resumes/{threadId}/revert/{versionId} ### Description Reconstructs resume state from version history using diffs. ### Method POST ### Endpoint `/resumes/{threadId}/revert/{versionId}` ### Parameters #### Path Parameters - **threadId** (string) - Required - The unique identifier for the resume thread. - **versionId** (string) - Required - The unique identifier for the version to revert to. ### Response #### Success Response (200) - **parsedSections** (object) - The reconstructed resume sections at the specified version. - **updatedAt** (string) - The timestamp when the resume was reverted. #### Response Example ```json { "parsedSections": { "contactInfo": { /* ... */ }, "summary": { /* ... */ }, "skills": { /* ... */ }, "workExperience": { /* ... */ } }, "updatedAt": "2024-01-15T17:00:00.000Z" } ``` ``` -------------------------------- ### Create Payment Order for Subscription (API) Source: https://context7.com/jassbawa/resumate/llms.txt Creates a Razorpay payment order for a pro subscription via a POST request to /api/payments/create-order. It returns order details including ID, amount, currency, and status, which are then used to initiate the Razorpay checkout process. ```typescript // POST /api/payments/create-order const response = await fetch('/api/payments/create-order', { method: 'POST' }); const result = await response.json(); // { // "success": true, // "data": { // "id": "order_razorpay_123", // "amount": 9900, // "currency": "INR", // "receipt": "order_user_123", // "status": "created" // } // } // Use this order ID with Razorpay checkout const options = { key: process.env.NEXT_PUBLIC_RAZORPAY_KEY_ID, amount: result.data.amount, currency: result.data.currency, order_id: result.data.id, name: 'Resume Builder Pro', description: 'Pro Plan Subscription', handler: function(response) { // Verify payment on backend verifyPayment(response); } }; ``` -------------------------------- ### Verify Payment Signature and Activate Subscription (API) Source: https://context7.com/jassbawa/resumate/llms.txt Verifies the Razorpay payment signature and activates the user's subscription. This POST request to /api/payments/verify sends payment details and the generated signature for backend validation. Upon success, the payment status is updated, and the subscription is activated. ```typescript // POST /api/payments/verify const response = await fetch('/api/payments/verify', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ orderCreationId: 'order_razorpay_123', razorpayPaymentId: 'pay_razorpay_456', razorpayOrderId: 'order_razorpay_123', razorpaySignature: 'generated_signature_hash', razorpayCustomerId: 'cust_razorpay_789' }) }); const result = await response.json(); // { "success": true } // On success: // - Payment status updated to COMPLETED // - User subscription activated for 1 month // - subscriptionEndDate set to current date + 1 month ``` -------------------------------- ### POST /api/threads/[id]/revert/[versionId] Source: https://context7.com/jassbawa/resumate/llms.txt Reverts a resume to a specific version from its history. ```APIDOC ## POST /api/threads/[id]/revert/[versionId] ### Description Reverts a resume to a specific version from its history. ### Method POST ### Endpoint /api/threads/[id]/revert/[versionId] ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the thread. - **versionId** (string) - Required - The ID of the version to revert to. ### Request Example (No request body example provided, typically none for this operation) ### Response #### Success Response (200) - **success** (boolean) - Indicates if the revert operation was successful. - **data** (object) - Contains the reconstructed resume state. - **parsedSections** (object) - The reconstructed resume sections. - **updatedAt** (string) - The timestamp when the resume was updated. #### Response Example ```json { "success": true, "data": { "parsedSections": { /* reconstructed resume state */ }, "updatedAt": "2024-01-15T15:45:00.000Z" } } ``` ``` -------------------------------- ### Process File Upload to OpenAI and Create Embeddings (TypeScript) Source: https://context7.com/jassbawa/resumate/llms.txt Handles the upload of files (e.g., .docx, .pdf) to OpenAI, creates vector embeddings, and updates the thread with the file ID. It includes validation for file type and size. This function is crucial for enabling semantic search and AI-powered parsing of documents. ```typescript import { processUpload } from '@/lib/processUpload'; // Called after file upload endpoint receives file await processUpload(file, threadId); // Process: // 1. Uploads file to OpenAI with purpose='assistants' // 2. Adds file to OpenAI vector store for embeddings // 3. Updates thread with OpenAI file ID // 4. Enables semantic search and AI-powered parsing // Usage in API route: const formData = await request.formData(); const file = formData.get('file') as File; // Validate file if (!file.name.endsWith('.docx') && !file.name.endsWith('.pdf')) { throw new Error('Only .docx or .pdf files allowed'); } if (file.size > 10 * 1024 * 1024) { throw new Error('File too large (max 10MB)'); } await processUpload(file, threadId); ``` -------------------------------- ### Create Resume Thread API Endpoint Source: https://context7.com/jassbawa/resumate/llms.txt Creates a new empty thread for managing resume data. This endpoint is essential for initializing a new resume within the system. It accepts a title for the resume thread and returns the newly created thread object. ```typescript POST /api/threads const response = await fetch('/api/threads', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ title: 'Software Engineer Resume' }) }); const result = await response.json(); // { "success": true, // "data": { // "id": "clxyz123...", // "title": "Software Engineer Resume", // "userId": "user_123", // "fileId": "", // "parsedSections": {}, // "createdAt": "2024-01-15T10:30:00.000Z", // "updatedAt": "2024-01-15T10:30:00.000Z" // } // } ``` -------------------------------- ### Chat with AI Assistant Source: https://context7.com/jassbawa/resumate/llms.txt Allows users to interact with the AI assistant by sending messages related to their resume. The AI provides suggestions and can edit resume sections conversationally. ```APIDOC ## POST /api/chat ### Description Sends messages to the AI assistant for resume editing and advice. The assistant processes the message in the context of the specified thread. ### Method POST ### Endpoint /api/chat ### Parameters #### Request Body - **threadId** (string) - Required - The ID of the resume thread to interact with. - **message** (string) - Required - The user's message or query for the AI assistant. ### Request Example ```json { "threadId": "clxyz123", "message": "Add more quantifiable achievements to my work experience" } ``` ### Response #### Success Response (200) - **type** (string) - The type of AI response (e.g., 'suggestion'). - **content** (string) - The main textual content of the AI's response. - **data** (object) - Structured data, potentially representing updated resume sections or analysis. - Example structure for `data.workExperience`: - **workExperience** (object) - **data** (array) - Array of work experience objects. - Each object contains: - **title** (string) - Job title. - **company** (string) - Company name. - **duration** (string) - Employment duration. - **responsibilities** (array) - Array of strings describing responsibilities. #### Response Example ```json { "type": "suggestion", "content": "I've analyzed your work experience...", "data": { "workExperience": { "data": [ { "title": "Software Developer", "company": "TechCorp", "duration": "Jan 2023 - Present", "responsibilities": [ "Improved CI/CD pipeline efficiency by 40%, reducing deployment time from 30 to 18 minutes", "Led team of 5 developers in implementing microservices architecture, serving 2M+ users" ] } ] } } } ``` ``` -------------------------------- ### Analyze Resume Against Job Source: https://context7.com/jassbawa/resumate/llms.txt Analyzes resume sections against specific job requirements, providing insights into matching and missing skills, and generating a draft cover letter. ```APIDOC ## POST /resumes/analyze ### Description Analyzes resume sections against specific job requirements. ### Method POST ### Endpoint `/resumes/analyze` ### Parameters #### Request Body - **sections** (object) - Required - The resume sections to analyze. - **contactInfo** (object) - Optional. - **summary** (object) - Optional. - **skills** (object) - Optional. - **workExperience** (object) - Optional. - **jobContext** (object) - Required - Contextual information about the job. - **jobDescription** (string) - Required - The full job description. - **company** (string) - Required - The name of the company. - **role** (string) - Required - The job title. ### Request Example ```json { "sections": { "skills": { "data": { "skills": ["JavaScript", "React", "Node.js", "Python"] } } }, "jobContext": { "jobDescription": "We're seeking a Senior Full-Stack Engineer with 5+ years experience. Required: React, TypeScript, Node.js, AWS, Docker, Kubernetes. Experience with microservices and CI/CD pipelines essential.", "company": "TechCorp Inc", "role": "Senior Full-Stack Engineer" } } ``` ### Response #### Success Response (200) - **sectionAnalysis** (object) - Analysis results for each resume section. - **summary** (object) - Analysis of the summary section. - **matchScore** (number) - Overall match score. - **matchingSkills** (array) - Skills found in both resume and job description. - **missingKeywords** (array) - Keywords from job description missing in resume. - **skillMatchPercent** (number) - Percentage of skills matched. - **areasOfImprovement** (string) - Suggestions for improving the section. - **skills** (object) - Analysis of the skills section. - **matchScore** (number) - Overall match score. - **matchingSkills** (array) - Skills found in both resume and job description. - **missingKeywords** (array) - Keywords from job description missing in resume. - **skillMatchPercent** (number) - Percentage of skills matched. - **areasOfImprovement** (string) - Suggestions for improving the section. - **workExperience** (object) - Analysis of the work experience section. - **matchScore** (number) - Overall match score. - **matchingSkills** (array) - Skills found in both resume and job description. - **missingKeywords** (array) - Keywords from job description missing in resume. - **skillMatchPercent** (number) - Percentage of skills matched. - **areasOfImprovement** (string) - Suggestions for improving the section. - **combinedAnalysis** (string) - A comprehensive analysis combining insights from all sections. - **coverLetter** (string) - A generated draft cover letter based on the analysis. #### Response Example ```json { "sectionAnalysis": { "summary": { "matchScore": 72, "matchingSkills": ["React", "Node.js", "Full-Stack Development"], "missingKeywords": ["TypeScript", "Microservices", "5+ years"], "skillMatchPercent": 65, "areasOfImprovement": "Emphasize years of experience and TypeScript expertise. Add microservices architecture examples." }, "skills": { "matchScore": 68, "matchingSkills": ["JavaScript", "React", "Node.js"], "missingKeywords": ["TypeScript", "AWS", "Docker", "Kubernetes"], "skillMatchPercent": 50, "areasOfImprovement": "Add TypeScript, AWS, Docker, and Kubernetes to match job requirements. These are critical for the role." }, "workExperience": { "matchScore": 75, "matchingSkills": ["CI/CD", "Team Leadership", "Architecture"], "missingKeywords": ["Microservices", "Docker", "Kubernetes"], "skillMatchPercent": 60, "areasOfImprovement": "Highlight microservices projects and container orchestration experience." } }, "combinedAnalysis": "Strong foundation in React and Node.js aligns well with full-stack requirements. The CI/CD experience is valuable. Key gaps include TypeScript expertise, container technologies (Docker/Kubernetes), and explicit microservices architecture experience. Adding these would significantly strengthen the application for this senior role.", "coverLetter": "Dear Hiring Manager,\n\nI am excited to apply for the Senior Full-Stack Engineer position at TechCorp Inc. With extensive experience in React, Node.js, and modern web development, I am well-positioned to contribute to your engineering team.\n\nIn my current role, I have successfully built scalable applications using React and Node.js, implemented CI/CD pipelines, and led development teams. My experience with cloud infrastructure and commitment to code quality align perfectly with TechCorp's technical standards. I am particularly drawn to your focus on innovation and would bring both technical excellence and collaborative leadership.\n\nI would welcome the opportunity to discuss how my skills can help TechCorp achieve its goals. Thank you for considering my application.\n\nBest regards,\nJane Doe" } ``` ``` -------------------------------- ### Revert Resume to Previous Version (API) Source: https://context7.com/jassbawa/resumate/llms.txt Reverts a resume to a specific version from its history using a POST request to the /api/threads/[id]/revert/[versionId] endpoint. It takes the thread ID and version ID as parameters and returns the reconstructed resume state and update timestamp. ```typescript // POST /api/threads/[id]/revert/[versionId] const response = await fetch( `/api/threads/${threadId}/revert/${versionId}`, { method: 'POST' } ); const result = await response.json(); // { // "success": true, // "data": { // "parsedSections": { /* reconstructed resume state */ }, // "updatedAt": "2024-01-15T15:45:00.000Z" // } // } ``` -------------------------------- ### Analyze Resume Sections Against Job Requirements Source: https://context7.com/jassbawa/resumate/llms.txt Analyzes the provided resume sections against a given job description and context to assess skill match, identify missing keywords, and suggest areas for improvement. It generates a detailed section-by-section analysis, a combined overview of the resume's fit for the role, and a draft cover letter. The function takes resume sections and job context as input and returns a comprehensive analysis object. ```typescript import { analyseResumeSections } from '@/services/analysis.services'; const sections = { contactInfo: { /* ... */ }, summary: { /* ... */ }, skills: { data: { skills: ["JavaScript", "React", "Node.js", "Python"] } }, workExperience: { /* ... */ } }; const jobContext = { jobDescription: ` We're seeking a Senior Full-Stack Engineer with 5+ years experience. Required: React, TypeScript, Node.js, AWS, Docker, Kubernetes. Experience with microservices and CI/CD pipelines essential. `, company: 'TechCorp Inc', role: 'Senior Full-Stack Engineer' }; const analysis = await analyseResumeSections(sections, jobContext); // Returns: // { // sectionAnalysis: { // summary: { // matchScore: 72, // matchingSkills: ["React", "Node.js", "Full-Stack Development"], // missingKeywords: ["TypeScript", "Microservices", "5+ years"], // skillMatchPercent: 65, // areasOfImprovement: "Emphasize years of experience and TypeScript expertise. Add microservices architecture examples." // }, // skills: { // matchScore: 68, // matchingSkills: ["JavaScript", "React", "Node.js"], // missingKeywords: ["TypeScript", "AWS", "Docker", "Kubernetes"], // skillMatchPercent: 50, // areasOfImprovement: "Add TypeScript, AWS, Docker, and Kubernetes to match job requirements. These are critical for the role." // }, // workExperience: { // matchScore: 75, // matchingSkills: ["CI/CD", "Team Leadership", "Architecture"], // missingKeywords: ["Microservices", "Docker", "Kubernetes"], // skillMatchPercent: 60, // areasOfImprovement: "Highlight microservices projects and container orchestration experience." // } // }, // combinedAnalysis: "Strong foundation in React and Node.js aligns well with full-stack requirements. The CI/CD experience is valuable. Key gaps include TypeScript expertise, container technologies (Docker/Kubernetes), and explicit microservices architecture experience. Adding these would significantly strengthen the application for this senior role.", // coverLetter: "Dear Hiring Manager,\n\nI am excited to apply for the Senior Full-Stack Engineer position at TechCorp Inc. With extensive experience in React, Node.js, and modern web development, I am well-positioned to contribute to your engineering team.\n\nIn my current role, I have successfully built scalable applications using React and Node.js, implemented CI/CD pipelines, and led development teams. My experience with cloud infrastructure and commitment to code quality align perfectly with TechCorp's technical standards. I am particularly drawn to your focus on innovation and would bring both technical excellence and collaborative leadership.\n\nI would welcome the opportunity to discuss how my skills can help TechCorp achieve its goals. Thank you for considering my application.\n\nBest regards,\nJane Doe" // } ``` -------------------------------- ### Chat with AI Assistant API Endpoint Source: https://context7.com/jassbawa/resumate/llms.txt Allows users to interact with the AI assistant for resume editing and advice. This endpoint takes a thread ID and a user message, returning AI-generated suggestions and content modifications for the resume. ```typescript POST /api/chat const response = await fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ threadId: 'clxyz123', message: 'Add more quantifiable achievements to my work experience' }) }); const result = await response.json(); // { "type": "suggestion", // "content": "I've analyzed your work experience...", // "data": { // "workExperience": { // "data": [ // { // "title": "Software Developer", // "company": "TechCorp", // "duration": "Jan 2023 - Present", // "responsibilities": [ // "Improved CI/CD pipeline efficiency by 40%, reducing deployment time from 30 to 18 minutes", // "Led team of 5 developers in implementing microservices architecture, serving 2M+ users" // ] // } // ] // } // } // } ```