Creating a resume builder with React, NodeJS and AI š
In this article, you'll learn how to create a resume builder using React, Node.js, and the OpenAI API. What's better to look for a job and say you have build a job resume builder with AI to do so? š¤©

A small request š„ŗ
I produce content weekly, and your support helps so much to create more content. Please support me by clicking theĀ āLoveāĀ button. You probably want toĀ āSaveāĀ this article also, so you can just click both buttons. Thank you very very much! ā¤ļø
Introduction to the OpenAI API
GPT-3 is a type of artificial intelligence program developed by OpenAI that is really good at understanding and processing human language. It has been trained on a huge amount of text data from the internet, which allows it to generate high-quality responses to a wide range of language-related tasks.
For this article we will use OpenAI GPT3.Once the ChatGPT API is out, I will create another article using it š¤I have been a big fan of OpenAI from the day they released their first API, I have turned to one of the employees and sent them a nice request to get access to the beta version of GPT3, and I got it š

Thatās me in Dec 30, 2020, Begging for access.
Novu ā the first open-source notification infrastructure
Just a quick background about us. Novu provides a unified API that makes it simple to send notifications through multiple channels, including In-App, Push, Email, SMS, and Chat. With Novu, you can create custom workflows and define conditions for each channel, ensuring that your notifications are delivered in the most effective way possible.

I would be super happy if you could give us a star! And let me also know in the comments ā¤ļø https://github.com/novuhq/novu
Project Setup
Here, Iāll guide you through creating the project environment for the web application. Weāll use React.js for the front end and Node.js for the backend server.
Create the project folder for the web application by running the code below:
Setting up the Node.js server
Navigate into the server folder and create aĀ package.jsonĀ file.
Install Express, Nodemon, and the CORS library
ExpressJSĀ is a fast, minimalist framework that provides several features for building web applications in Node.js,Ā CORSĀ is a Node.js package that allows communication between different domains, andĀ NodemonĀ is a Node.js tool that automatically restarts the server after detecting file changes.
Create anĀ index.jsĀ file ā the entry point to the web server.
Set up a Node.js server using Express.js. The code snippet below returns a JSON object when you visit theĀ http://localhost:4000/apiĀ in your browser.
Configure Nodemon by adding the start command to the list of scripts in theĀ package.jsonĀ file. The code snippet below starts the server using Nodemon.
Congratulations! You can now start the server by using the command below.
Setting up the React application
Navigate into the client folder via your terminal and create a new React.js project.
Install Axios and React Router.Ā React RouterĀ is a JavaScript library that enables us to navigate between pages in a React application.Ā AxiosĀ is a promise-based Node.js HTTP client for performing asynchronous requests.
Delete the redundant files, such as the logo and the test files from the React app, and update theĀ App.jsĀ file to display Hello World as below.
Navigate into theĀ src/index.cssĀ file and copy the code below. It contains all the CSS required for styling this project.
Building the application user interface
Here, weāll create the user interface for the resume builder application to enable users to submit their information and print the AI-generated resume.
Create a components folder within theĀ client/srcĀ folder containing theĀ Home.js,Ā Loading.js,Ā Resume.js,Ā ErrorPage.jsĀ files.
From the code snippet above:
- TheĀ
Home.jsĀ file renders the form field to enable users to enter the necessary information. - TheĀ
Loading.jsĀ contains the component shown to the user when the request is pending. - TheĀ
Resume.jsĀ displays the AI-generated resume to the user. - TheĀ
ErrorPage.jsĀ is shown when an error occurs.
Update theĀ App.jsĀ file to render the components using React Router.
The Home page
Here, youāll learn how to build a form layout that can send images via HTTP request and dynamically add and remove input fields.
First, update the Loading component to render the code snippet below, shown to the user when the resume is pending.
Next, update theĀ ErrorPage.jsĀ file to display the component below when users navigate directly to the resume page.
Copy the code snippet below into theĀ Home.jsĀ file
The code snippet renders the form field below. It accepts the full name and current work experience ā (year, position, title) and allows the user to upload a headshot image via the form field.
Lastly, you need to accept the userās previous work experience. So, add a new state that holds the array of job descriptions.
Add the following functions which help with updating the state.
TheĀ handleAddCompanyĀ updates theĀ companyInfoĀ state with the userās input,Ā handleRemoveCompanyĀ is used to remove an item from the list of data provided, and theĀ handleUpdateCompanyĀ updates the item properties ā (name and position) within the list.
Next, render the UI elements for the work experience section.
The code snippet maps through the elements within theĀ companyInfoĀ array and displays them on the webpage. TheĀ handleUpdateCompanyĀ function runs when a user updates the input field, thenĀ handleRemoveCompanyĀ removes an item from the list of elements, and theĀ handleAddCompanyĀ adds a new input field.

The Resume page
This page shows the resume generated from the OpenAI API in a printable format. Copy the code below into theĀ Resume.jsĀ file. Weāll update its content later in this tutorial.
How to submit images via forms in Node.js
Here, Iāll guide you on how to submit the form data to the Node.js server. Since the form contains images, weāll need to set upĀ MulterĀ on the Node.js server.
š”Ā MulterĀ is a Node.js middleware used for uploading files to the server.
Setting up Multer
Run the code below to install Multer
Ensure the form on the frontend application has the method andĀ encTypeĀ attributes, because Multer only process forms which are multpart.
Import the Multer and the Node.js path packages into theĀ index.jsĀ file
Copy the code below into theĀ index.jsĀ to configure Multer.
- From the code snippet above:
- TheĀ
app.use()Ā function enables Node.js to serve the contents of anĀuploadsĀ folder. The contents refer to static files such as images, CSS, and JavaScript files. - TheĀ
storageĀ variable containingĀmulter.diskStorageĀ gives us full control of storing the images. The function above stores the images in the upload folder and renames the image to its upload time (to prevent filename conflicts). - The upload variable passes the configuration to Multer and set a size limit of 5MB for the images.
- TheĀ
Create theĀ uploadsĀ folder on the server. This is where the images will be saved.
How to upload images to a Node.js server
Add a route that accepts all the form inputs from the React app. TheĀ upload.single("headshotImage")Ā function adds the image uploaded via the form to theĀ uploadsĀ folder.
Update theĀ handleFormSubmitĀ function within theĀ Home.jsĀ component to submit the form data to the Node.js server.
The code snippet above creates a key/value pair representing the form fields and their values which are sent via Axios to the API endpoint on the server. If there is a response, it logs the response and redirect the user to the Resume page.
How to communicate with the OpenAI API in Node.js
In this section, youāll learn how to communicate with the OpenAI API within the Node.js server.Weāll send the userās information to the API to generate a profile summary, job description, and achievements or related activities completed at the previous organisations. To accomplish this:
Install the OpenAI API Node.js library by running the code below.
Log in or create an OpenAI accountĀ here.
ClickĀ PersonalĀ on the navigation bar and selectĀ View API keysĀ from the menu bar to create a new secret key.
Copy the API Key somewhere safe on your computer; weāll use it shortly.
Configure the API by copying the code below into theĀ index.jsĀ file.
Create a function that accepts a text (prompt) as a parameter and returns an AI-generated result.
The code snippet above uses theĀ text-davinci-003Ā model to generate an appropriate answer to the prompt. The other key values helps us generate the specific type of response we need.
Update theĀ /resume/createĀ route as done below.
The code snippet above accepts the form data from the client, converts theĀ workHistoryĀ to its original data structure (array), and puts them all into an object.
Next, create the prompts you want to pass into theĀ GPTFunction.
- From the code snippet above:
- TheĀ
remainderTextĀ function loops through the array of work history and returns a string data type of all work experiences. - Then, there are three prompts with instructions on what is needed from the GPT-3 API.
- Next, you store the results in an object and log them to the console.
- TheĀ
Lastly, return the AI-generated result and the information the users entered. You can also create an array representing the database that stores results as done below.
Displaying the response from the OpenAI API
In this section, Iāll guide you through displaying the results generated from the OpenAI API in a readable and printable format on a web page.
Create a React state within theĀ App.jsĀ file. The state will hold the results sent from the Node.js server.
From the code snippet above, onlyĀ setResultĀ is passed as a prop into the Home component and onlyĀ resultĀ for the Resume component.Ā setResultĀ updates the value of the result once the form is submitted and the request is successful, whileĀ resultĀ contains the response retrieved from the server, shown within the Resume component.
Update theĀ resultĀ state within the Home component after the form is submitted and the request is successful.
Update the Resume component as done below to preview the result within the React app.
The code snippet above displays the result on the webpage according to the specified layout. The functionĀ replaceWithBrĀ replaces every new line (\n) with a break tag, and theĀ handlePrintĀ function will enable users to print the resume.
How to print React pages using the React-to-print package
Here, youāll learn how to add a print button to the web page that enables users to print the resume via theĀ React-to-printĀ package.
š”Ā React-to-printĀ is a simple JavaScript package that enables you to print the content of a React component without tampering with the component CSS styles.
Run the code below to install the package
Import the library within theĀ Resume.jsĀ file and add theĀ useRefĀ hook.
Update theĀ Resume.jsĀ file as done below.
TheĀ handlePrintĀ function prints the elements within theĀ componentRefĀ ā main tag, sets the documentās name to the userās full name, and runs the alert function when a user prints the form.
Congratulations! Youāve completed the project for this tutorial.
Here is a sample of the result gotten from the project:

Conclusion
So far, youāve learnt:
- what OpenAI GPT-3 is,
- how to upload images via forms in a Node.js and React.js application,
- how to interact with the OpenAI GPT-3 API, and
- how to print React web pages via the React-to-print library.
This tutorial walks you through an example of an application you can build using the OpenAI API. With the API, you can create powerful applications useful in various fields, such as translators, Q&A, code explanation or generation, etc.
The source code for this tutorial is available here:
https://github.com/novuhq/blog/tree/main/resume-builder-with-react-chatgpt-nodejs
Thank you for reading!
Help me out!
If you feel like this article helped you, I would be super happy if you could give us a star! And let me also know in the comments ā¤ļø
https://github.com/novuhq/novu
